diff options
| author | Andrew Scheller | 2014-04-11 00:02:10 +0100 |
|---|---|---|
| committer | Andrew Scheller | 2014-04-16 02:41:26 +0100 |
| commit | 1452221aca8851df029702e8a71be339005bd5fd (patch) | |
| tree | 1d310c209c57b3b8d2e0add4125fec5fb001b49d /stmhal/Makefile | |
| parent | 2822d4e6ce9cdb29fcf4646212519447da338678 (diff) | |
Auto-generate the stmhal/pybcdc_inf header file from static files
The USB VID&PID are automatically extracted from usbd_desc_cdc_msc.c
and inserted into pybcdc_inf.template, ensuring that the same USB
IDs get used everywhere
Diffstat (limited to 'stmhal/Makefile')
| -rw-r--r-- | stmhal/Makefile | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/stmhal/Makefile b/stmhal/Makefile index 978918994..f0d132520 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -210,6 +210,14 @@ PREFIX_FILE = boards/stm32f4xx-prefix.c GEN_PINS_SRC = $(BUILD)/pins_$(BOARD).c GEN_PINS_HDR = $(BUILD)/pins.h +INSERT_USB_IDS = ../tools/insert-usb-ids.py +FILE2H = ../tools/file2h.py + +USB_IDS_FILE = usbd_desc_cdc_msc.c +CDCINF_TEMPLATE = pybcdc.inf_template +GEN_CDCINF_FILE = $(BUILD)/pybcdc.inf +GEN_CDCINF_HEADER = $(BUILD)/pybcdc_inf.h + # Making OBJ use an order-only depenedency on the generated pins.h file # has the side effect of making the pins.h file before we actually compile # any of the objects. The normal dependency generation will deal with the @@ -217,6 +225,8 @@ GEN_PINS_HDR = $(BUILD)/pins.h # which source files might need it. $(OBJ): | $(BUILD)/pins.h +$(BUILD)/main.o: $(GEN_CDCINF_HEADER) + # Use a pattern rule here so that make will only call make-pins.py once to make # both pins_$(BOARD).c and pins.h $(BUILD)/%_$(BOARD).c $(BUILD)/%.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) @@ -226,4 +236,12 @@ $(BUILD)/%_$(BOARD).c $(BUILD)/%.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE $(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c $(call compile_c) +$(GEN_CDCINF_HEADER): $(GEN_CDCINF_FILE) $(FILE2H) + $(ECHO) "Create $@" + $(Q)$(PYTHON) $(FILE2H) $< > $@ + +$(GEN_CDCINF_FILE): $(CDCINF_TEMPLATE) $(INSERT_USB_IDS) $(USB_IDS_FILE) + $(ECHO) "Create $@" + $(Q)$(PYTHON) $(INSERT_USB_IDS) $(USB_IDS_FILE) $< > $@ + include ../py/mkrules.mk |
