Makefile improvements
This commit is contained in:
40
Makefile
40
Makefile
@@ -352,10 +352,44 @@ LIBS =
|
||||
|
||||
DEPS = $(OBJS:.o=.d)
|
||||
|
||||
ifdef OS
|
||||
RM = del /Q
|
||||
FixPath = $(subst /,\,$1)
|
||||
WHERE = where
|
||||
else
|
||||
ifeq ($(shell uname), Linux)
|
||||
RM = rm -f
|
||||
FixPath = $1
|
||||
WHERE = which
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (, $(shell $(WHERE) python))
|
||||
MY_PYTHON := python
|
||||
else ifneq (, $(shell $(WHERE) python3))
|
||||
MY_PYTHON := python3
|
||||
endif
|
||||
|
||||
ifdef MY_PYTHON
|
||||
HAS_CRCMOD := $(shell $(MY_PYTHON) -c "import crcmod" 2>&1)
|
||||
endif
|
||||
|
||||
all: $(TARGET)
|
||||
$(OBJCOPY) -O binary $< $<.bin
|
||||
-python fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
|
||||
-python3 fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
|
||||
|
||||
ifndef MY_PYTHON
|
||||
$(info )
|
||||
$(info !!!!!!!! PYTHON NOT FOUND, *.PACKED.BIN WON'T BE BUILT)
|
||||
$(info )
|
||||
else ifneq (,$(HAS_CRCMOD))
|
||||
$(info )
|
||||
$(info !!!!!!!! CRCMOD NOT INSTALLED, *.PACKED.BIN WON'T BE BUILT)
|
||||
$(info !!!!!!!! run: pip install crcmod)
|
||||
$(info )
|
||||
else
|
||||
-$(MY_PYTHON) fw-pack.py $<.bin $(GIT_HASH) $<.packed.bin
|
||||
endif
|
||||
|
||||
$(SIZE) $<
|
||||
|
||||
debug:
|
||||
@@ -382,4 +416,4 @@ bsp/dp32g030/%.h: hardware/dp32g030/%.def
|
||||
-include $(DEPS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS)
|
||||
$(RM) $(call FixPath, $(TARGET).bin $(TARGET).packed.bin $(TARGET) $(OBJS) $(DEPS))
|
||||
|
Reference in New Issue
Block a user