Simpler build, less dependencies (#827)

* Simpler build, less dependencies
* Follow ugly python linter
* Introduce Brewfile & Update Readme
* Make dist.sh target-specific
* Tidy up make output
* Get rid of cat and truncate (I still love cats tho)
* Suppress dd output
* Long live the cat
This commit is contained in:
Anna Prosvetova
2021-11-18 11:46:47 +03:00
committed by GitHub
parent cc044c5033
commit 4303945748
15 changed files with 273 additions and 198 deletions

2
make/defaults.mk Normal file
View File

@@ -0,0 +1,2 @@
TARGET ?= f7
export TARGET

View File

@@ -2,7 +2,7 @@ GIT_COMMIT := $(shell git rev-parse --short HEAD || echo 'unknown')
GIT_BRANCH := $(shell echo $${WORKFLOW_BRANCH_OR_TAG-$$(git rev-parse --abbrev-ref HEAD || echo 'unknown')})
GIT_BRANCH_NUM := $(shell git rev-list --count HEAD || echo 'nan')
BUILD_DATE := $(shell date '+%d-%m-%Y' || echo 'unknown')
VERSION := $(shell git describe --tags --abbrev=0 --exact-match || echo 'unknown')
VERSION := $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null || echo 'unknown')
CFLAGS += \
-DGIT_COMMIT=\"$(GIT_COMMIT)\" \

View File

@@ -33,6 +33,7 @@ CHECK_AND_REINIT_SUBMODULES_SHELL=\
$(info $(shell $(CHECK_AND_REINIT_SUBMODULES_SHELL)))
all: $(OBJ_DIR)/$(PROJECT).elf $(OBJ_DIR)/$(PROJECT).hex $(OBJ_DIR)/$(PROJECT).bin $(OBJ_DIR)/$(PROJECT).dfu $(OBJ_DIR)/$(PROJECT).json
@:
$(OBJ_DIR)/$(PROJECT).elf: $(OBJECTS)
@echo "\tLD\t" $@
@@ -47,27 +48,28 @@ $(OBJ_DIR)/$(PROJECT).bin: $(OBJ_DIR)/$(PROJECT).elf
@echo "\tBIN\t" $@
@$(BIN) $< $@
$(OBJ_DIR)/$(PROJECT).dfu: $(OBJ_DIR)/$(PROJECT).hex
$(OBJ_DIR)/$(PROJECT).dfu: $(OBJ_DIR)/$(PROJECT).bin
@echo "\tDFU\t" $@
@hex2dfu \
-i $(OBJ_DIR)/$(PROJECT).hex \
@../scripts/bin2dfu.py \
-i $(OBJ_DIR)/$(PROJECT).bin \
-o $(OBJ_DIR)/$(PROJECT).dfu \
-a $(FLASH_ADDRESS) \
-l "Flipper Zero $(shell echo $(TARGET) | tr a-z A-Z)" > /dev/null
$(OBJ_DIR)/$(PROJECT).json: $(OBJ_DIR)/$(PROJECT).dfu
@echo "\tJSON\t" $@
@python3 ../scripts/meta.py -p $(PROJECT) $(CFLAGS) > $(OBJ_DIR)/$(PROJECT).json
@../scripts/meta.py generate -p $(PROJECT) $(CFLAGS) > $(OBJ_DIR)/$(PROJECT).json
$(OBJ_DIR)/%.o: %.c $(OBJ_DIR)/BUILD_FLAGS
@echo "\tCC\t" $< "->" $@
@echo "\tCC\t" $(subst $(PROJECT_ROOT)/,,$(realpath $<)) "->" $@
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJ_DIR)/%.o: %.s $(OBJ_DIR)/BUILD_FLAGS
@echo "\tASM\t" $< "->" $@
@echo "\tASM\t" $(subst $(PROJECT_ROOT)/,,$(realpath $<)) "->" $@
@$(AS) $(CFLAGS) -c $< -o $@
$(OBJ_DIR)/%.o: %.cpp $(OBJ_DIR)/BUILD_FLAGS
@echo "\tCPP\t" $< "->" $@
@echo "\tCPP\t" $(subst $(PROJECT_ROOT)/,,$(realpath $<)) "->" $@
@$(CPP) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
$(OBJ_DIR)/flash: $(OBJ_DIR)/$(PROJECT).bin