diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5ed6f5..e4832e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,4 +96,4 @@ jobs: run: ./scripts/deps.sh - name: Build firmware - run: make BOARD=${{ matrix.vendor}}/${{ matrix.board }} + run: make BOARD=${{ matrix.vendor}}/${{ matrix.board }} VERBOSE=1 diff --git a/Makefile b/Makefile index debdd3e..47a2ac5 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,11 @@ # Disable built-in rules and variables MAKEFLAGS += -rR +# Default to silent builds +ifneq ($(VERBOSE),1) +MAKEFLAGS += -s +endif + # Parameter for current board ifeq ($(BOARD),) all: @@ -20,11 +25,12 @@ REV=$(shell git describe --abbrev=7 --always --dirty) VERSION?=$(DATE)_$(REV) # Set build directory -BUILD=build/$(BOARD)/$(VERSION) +obj = build +BUILD = $(obj)/$(BOARD)/$(VERSION) # Default target - build the board's EC firmware all: $(BUILD)/ec.rom - $(info Built '$(VERSION)' for '$(BOARD)') + $(info Built $(VERSION) for $(BOARD)) # Include common source COMMON_DIR=src/common @@ -65,4 +71,4 @@ endif # Target to remove build artifacts clean: - rm -rf build + rm -rf $(obj) diff --git a/src/arch/8051/toolchain.mk b/src/arch/8051/toolchain.mk index f01a8b3..a9a0725 100644 --- a/src/arch/8051/toolchain.mk +++ b/src/arch/8051/toolchain.mk @@ -31,22 +31,26 @@ sim: $(BUILD)/ec.rom # Convert from Intel Hex file to binary file $(BUILD)/ec.rom: $(BUILD)/ec.ihx - @mkdir -p $(@D) + @echo " OBJCOPY $(subst $(obj)/,,$@)" + mkdir -p $(@D) objcopy -I ihex -O binary --gap-fill=0xFF $< $@ # Link object files into Intel Hex file $(BUILD)/ec.ihx: $(OBJ) - @mkdir -p $(@D) + @echo " LINK $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(CC) $(LDFLAGS) -o $@ $^ # Compile ASM files into object files $(ASM_OBJ): $(BUILD)/%.rel: src/%.asm - @mkdir -p $(@D) + @echo " AS $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(AS) $(ASFLAGS) $@ $< # Compile C files into object files $(C_OBJ): $(BUILD)/%.rel: src/%.c $(INCLUDE) - @mkdir -p $(@D) + @echo " CC $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(CC) $(CFLAGS) -o $@ -c $< # Add dependency rules diff --git a/src/arch/avr/toolchain.mk b/src/arch/avr/toolchain.mk index 0222396..6dbf8b5 100644 --- a/src/arch/avr/toolchain.mk +++ b/src/arch/avr/toolchain.mk @@ -19,22 +19,26 @@ sim: $(BUILD)/ec.elf # Convert from Intel Hex file to binary file $(BUILD)/ec.rom: $(BUILD)/ec.ihx - @mkdir -p $(@D) + @echo " OBJCOPY $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(OBJCOPY) -I ihex -O binary --gap-fill 0xFF $< $@ # Convert from ELF file to Intel Hex file $(BUILD)/ec.ihx: $(BUILD)/ec.elf - @mkdir -p $(@D) + @echo " OBJCOPY $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(OBJCOPY) -j .text -j .data -O ihex $< $@ # Link object files into ELF file $(BUILD)/ec.elf: $(OBJ) - @mkdir -p $(@D) + @echo " LINK $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(CC) -o $@ $^ # Compile C files into object files $(BUILD)/%.o: src/%.c $(INCLUDE) - @mkdir -p $(@D) + @echo " CC $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(CC) $(CFLAGS) -o $@ -c $< # Add dependency rules diff --git a/src/board/system76/common/flash/flash.mk b/src/board/system76/common/flash/flash.mk index 455ffde..f77e295 100644 --- a/src/board/system76/common/flash/flash.mk +++ b/src/board/system76/common/flash/flash.mk @@ -33,22 +33,26 @@ FLASH_CC=\ # Convert from binary file to C header $(BUILD)/include/flash.h: $(FLASH_BUILD)/flash.rom - @mkdir -p $(@D) + @echo " XXD $(subst $(obj)/,,$@)" + mkdir -p $(@D) xxd -include < $< > $@ # Convert from Intel Hex file to binary file $(FLASH_BUILD)/flash.rom: $(FLASH_BUILD)/flash.ihx - @mkdir -p $(@D) + @echo " OBJCOPY $(subst $(obj)/,,$@)" + mkdir -p $(@D) objcopy -I ihex -O binary $< $@ # Link object files into Intel Hex file $(FLASH_BUILD)/flash.ihx: $(FLASH_OBJ) - @mkdir -p $(@D) + @echo " LINK $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(FLASH_CC) -o $@ $^ # Compile C files into object files $(FLASH_OBJ): $(FLASH_BUILD)/%.rel: src/%.c $(FLASH_INCLUDE) - @mkdir -p $(@D) + @echo " CC $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(FLASH_CC) $(FLASH_CFLAGS) -o $@ -c $< # Include flash header in main firmware diff --git a/src/board/system76/common/scratch/scratch.mk b/src/board/system76/common/scratch/scratch.mk index 2b30ea1..6b7d27a 100644 --- a/src/board/system76/common/scratch/scratch.mk +++ b/src/board/system76/common/scratch/scratch.mk @@ -32,22 +32,26 @@ SCRATCH_CC=\ # Convert from binary file to C header $(BUILD)/include/scratch.h: $(SCRATCH_BUILD)/scratch.rom - @mkdir -p $(@D) + @echo " XXD $(subst $(obj)/,,$@)" + mkdir -p $(@D) xxd -include < $< > $@ # Convert from Intel Hex file to binary file $(SCRATCH_BUILD)/scratch.rom: $(SCRATCH_BUILD)/scratch.ihx - @mkdir -p $(@D) + @echo " OBJCOPY $(subst $(obj)/,,$@)" + mkdir -p $(@D) objcopy -I ihex -O binary $< $@ # Link object files into Intel Hex file $(SCRATCH_BUILD)/scratch.ihx: $(SCRATCH_OBJ) - @mkdir -p $(@D) + @echo " LINK $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(SCRATCH_CC) -o $@ $^ # Compile C files into object files $(SCRATCH_OBJ): $(SCRATCH_BUILD)/%.rel: src/%.c $(SCRATCH_INCLUDE) - @mkdir -p $(@D) + @echo " CC $(subst $(obj)/,,$@)" + mkdir -p $(@D) $(SCRATCH_CC) $(SCRATCH_CFLAGS) -o $@ -c $< # Include scratch header in main firmware