Replace some Makefile commands with variables in py/mkenv.mk
This commit is contained in:
parent
36e75aef38
commit
902d9552c5
|
@ -39,12 +39,17 @@ BUILD ?= build
|
|||
|
||||
RM = rm
|
||||
ECHO = @echo
|
||||
CP = cp
|
||||
MKDIR = mkdir
|
||||
SED = sed
|
||||
PYTHON = python
|
||||
|
||||
AS = $(CROSS_COMPILE)as
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
LD = $(CROSS_COMPILE)ld
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
STRIP = $(CROSS_COMPILE)strip
|
||||
|
||||
all:
|
||||
.PHONY: all
|
||||
|
|
|
@ -35,10 +35,10 @@ $(ECHO) "CC $<"
|
|||
$(Q)$(CC) $(CFLAGS) -c -MD -o $@ $<
|
||||
@# The following fixes the dependency file.
|
||||
@# See http://make.paulandlesley.org/autodep.html for details.
|
||||
@cp $(@:.o=.d) $(@:.o=.P); \
|
||||
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
|
||||
@$(CP) $(@:.o=.d) $(@:.o=.P); \
|
||||
$(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
|
||||
-e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.d) >> $(@:.o=.P); \
|
||||
rm -f $(@:.o=.d)
|
||||
$(RM) -f $(@:.o=.d)
|
||||
endef
|
||||
|
||||
vpath %.c . $(TOP)
|
||||
|
@ -61,7 +61,7 @@ $(BUILD)/%.pp: %.c
|
|||
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
||||
$(OBJ): | $(OBJ_DIRS)
|
||||
$(OBJ_DIRS):
|
||||
mkdir -p $@
|
||||
$(MKDIR) -p $@
|
||||
|
||||
ifneq ($(PROG),)
|
||||
# Build a standalone executable (unix and unix-cpy do this)
|
||||
|
@ -72,9 +72,9 @@ $(PROG): $(OBJ)
|
|||
$(ECHO) "LINK $@"
|
||||
$(Q)$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
|
||||
ifndef DEBUG
|
||||
$(Q)strip $(PROG)
|
||||
$(Q)$(STRIP) $(PROG)
|
||||
endif
|
||||
$(Q)size $(PROG)
|
||||
$(Q)$(SIZE) $(PROG)
|
||||
|
||||
clean: clean-prog
|
||||
clean-prog:
|
||||
|
|
2
py/py.mk
2
py/py.mk
|
@ -105,7 +105,7 @@ $(PY_BUILD)/py-version.h: FORCE
|
|||
$(PY_BUILD)/qstrdefs.generated.h: | $(PY_BUILD)/
|
||||
$(PY_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqstrdata.py
|
||||
$(ECHO) "makeqstrdata $(PY_QSTR_DEFS) $(QSTR_DEFS)"
|
||||
$(Q)python $(PY_SRC)/makeqstrdata.py $(PY_QSTR_DEFS) $(QSTR_DEFS) > $@
|
||||
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py $(PY_QSTR_DEFS) $(QSTR_DEFS) > $@
|
||||
|
||||
# We don't know which source files actually need the generated.h (since
|
||||
# it is #included from str.h). The compiler generated dependencies will cause
|
||||
|
|
|
@ -174,7 +174,7 @@ all: $(BUILD)/flash.dfu
|
|||
|
||||
$(BUILD)/flash.dfu: $(BUILD)/flash0.bin $(BUILD)/flash1.bin
|
||||
$(ECHO) "Create $@"
|
||||
$(Q)python $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@
|
||||
$(Q)$(PYTHON) $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@
|
||||
|
||||
$(BUILD)/flash0.bin: $(BUILD)/flash.elf
|
||||
$(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $@
|
||||
|
@ -205,7 +205,7 @@ $(OBJ): | $(BUILD)/pins.h
|
|||
# both pins_$(BOARD).c and pins.h
|
||||
$(BUILD)/%_$(BOARD).c $(BUILD)/%.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE)
|
||||
$(ECHO) "Create $@"
|
||||
$(Q)python $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) > $(GEN_PINS_SRC)
|
||||
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) > $(GEN_PINS_SRC)
|
||||
|
||||
$(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c
|
||||
$(call compile_c)
|
||||
|
|
|
@ -189,7 +189,7 @@ all: $(BUILD)/flash.dfu
|
|||
|
||||
$(BUILD)/flash.dfu: $(BUILD)/flash0.bin $(BUILD)/flash1.bin
|
||||
$(ECHO) "Create $@"
|
||||
$(Q)python $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@
|
||||
$(Q)$(PYTHON) $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@
|
||||
|
||||
$(BUILD)/flash0.bin: $(BUILD)/flash.elf
|
||||
$(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $@
|
||||
|
@ -220,7 +220,7 @@ $(OBJ): | $(BUILD)/pins.h
|
|||
# both pins_$(BOARD).c and pins.h
|
||||
$(BUILD)/%_$(BOARD).c $(BUILD)/%.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE)
|
||||
$(ECHO) "Create $@"
|
||||
$(Q)python $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) > $(GEN_PINS_SRC)
|
||||
$(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) > $(GEN_PINS_SRC)
|
||||
|
||||
$(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c
|
||||
$(call compile_c)
|
||||
|
|
Loading…
Reference in New Issue