Skip to content

Commit

Permalink
py/mkrules.mk: Add rule for compiling auto-generated source files.
Browse files Browse the repository at this point in the history
This prevents each port Makefile from having to add an explicit rule for
`build-BOARD/pins_BOARD.c`.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <[email protected]>
  • Loading branch information
jimmo authored and dpgeorge committed Nov 3, 2023
1 parent aa329d1 commit 2eda513
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 18 deletions.
3 changes: 0 additions & 3 deletions ports/cc3200/application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,3 @@ $(OBJ): | $(GEN_PINS_HDR)
$(GEN_PINS_SRC) $(GEN_PINS_HDR) $(GEN_PINS_QSTR): $(BOARD_PINS) $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) > $(GEN_PINS_SRC)

$(BUILD)/pins.o: $(BUILD)/pins.c
$(call compile_c)
3 changes: 0 additions & 3 deletions ports/mimxrt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,4 @@ $(BUILD)/%_gen.c $(HEADER_BUILD)/%.h: $(BOARD_PINS) $(MAKE_PINS) $(AF_FILE) $(PR
--iomux $(abspath $(TOP)/$(MCU_DIR)/drivers/fsl_iomuxc.h) \
--prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) > $(GEN_PINS_SRC)

$(GEN_PINS_SRC:.c=.o): $(GEN_PINS_SRC)
$(call compile_c)

include $(TOP)/py/mkrules.mk
3 changes: 0 additions & 3 deletions ports/nrf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,6 @@ $(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(BUILD)/%_qst
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) --af-const $(GEN_PINS_AF_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)

$(GEN_PINS_SRC:.c=.o): $(GEN_PINS_SRC)
$(call compile_c)

$(PY_BUILD)/nlr%.o: CFLAGS += -Os -fno-lto

include ../../py/mkrules.mk
Expand Down
3 changes: 0 additions & 3 deletions ports/renesas-ra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,6 @@ $(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(HEADER_
$(ECHO) "GEN $@"
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) --ad-const $(GEN_PINS_AD_CONST) --af-const $(GEN_PINS_AF_CONST) --af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)

#$(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c
# $(call compile_c)

CMSIS_MCU_HDR = $(CMSIS_DIR)/$(CMSIS_MCU_LOWER).h

include $(TOP)/py/mkrules.mk
3 changes: 0 additions & 3 deletions ports/stm32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,6 @@ $(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(HEADER_
--af-defs $(GEN_PINS_AF_DEFS) --af-defs-cmp-strings \
--af-py $(GEN_PINS_AF_PY) > $(GEN_PINS_SRC)

$(GEN_PINS_SRC:.c=.o): $(GEN_PINS_SRC)
$(call compile_c)

modmachine.c: $(GEN_PLLFREQTABLE_HDR)
$(GEN_PLLFREQTABLE_HDR): $(PLLVALUES) | $(HEADER_BUILD)
$(ECHO) "GEN $@"
Expand Down
4 changes: 4 additions & 0 deletions py/mkrules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ $(BUILD)/%.pp: %.c
$(ECHO) "PreProcess $<"
$(Q)$(CPP) $(CFLAGS) -Wp,-C,-dD,-dI -o $@ $<

# Special case for compiling auto-generated source files.
$(BUILD)/%.o: $(BUILD)/%.c
$(call compile_c)

# The following rule uses | to create an order only prerequisite. Order only
# prerequisites only get built if they don't exist. They don't cause timestamp
# checking to be performed.
Expand Down
3 changes: 0 additions & 3 deletions shared/memzip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ OBJ += $(BUILD)/memzip-files.o
MAKE_MEMZIP = ../shared/memzip/make-memzip.py
$(BUILD)/memzip-files.o: $(BUILD)/memzip-files.c
$(call compile_c)
$(BUILD)/memzip-files.c: $(shell find ${MEMZIP_DIR} -type f)
@$(ECHO) "Creating $@"
$(Q)$(PYTHON) $(MAKE_MEMZIP) --zip-file $(BUILD)/memzip-files.zip --c-file $@ $(MEMZIP_DIR)
Expand Down

0 comments on commit 2eda513

Please sign in to comment.