Quieten build system.

This commit is contained in:
Gareth McMullin 2015-03-07 10:32:52 -08:00
parent 1eac78b1c8
commit 0d99e22a26
6 changed files with 45 additions and 24 deletions

View File

@ -1,13 +1,18 @@
ifneq ($(V), 1)
MFLAGS += --no-print-dir
Q := @
endif
all:
@if [ ! -f libopencm3/Makefile ]; then \
$(Q)if [ ! -f libopencm3/Makefile ]; then \
echo "Initialising git submodules..." ;\
git submodule init ;\
git submodule update ;\
fi
$(MAKE) -C libopencm3 lib
$(MAKE) -C src
$(Q)$(MAKE) $(MFLAGS) -C libopencm3 lib
$(Q)$(MAKE) $(MFLAGS) -C src
%:
$(MAKE) -C libopencm3 $@
$(MAKE) -C src $@
clean:
$(Q)$(MAKE) $(MFLAGS) -C libopencm3 $@
$(Q)$(MAKE) $(MFLAGS) -C src $@

View File

@ -2,6 +2,11 @@ PROBE_HOST ?= native
PLATFORM_DIR = platforms/$(PROBE_HOST)
VPATH += platforms/common $(PLATFORM_DIR)
ifneq ($(V), 1)
MAKEFLAGS += --no-print-dir
Q := @
endif
BUILDDATE := `date +"%Y%m%d"`
CFLAGS += -Wall -Wextra -Wno-pointer-sign -Wno-char-subscripts\
@ -45,29 +50,37 @@ include $(PLATFORM_DIR)/Makefile.inc
OBJ = $(SRC:.c=.o)
blackmagic: $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
@echo " LD $@"
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
%.o: %.c
@echo " CC $<"
$(Q)$(CC) $(CFLAGS) -c $< -o $@
%.bin: %
$(OBJCOPY) -O binary $^ $@
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O binary $^ $@
%.hex: %
$(OBJCOPY) -O ihex $^ $@
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O ihex $^ $@
.PHONY: clean host_clean all_platforms
clean: host_clean
-$(RM) *.o *.d *~ blackmagic $(HOSTFILES)
-$(RM) platforms/*/*.o platforms/*/*.d mapfile
$(Q)echo " CLEAN"
-$(Q)$(RM) -f *.o *.d *~ blackmagic $(HOSTFILES)
-$(Q)$(RM) -f platforms/*/*.o platforms/*/*.d mapfile
all_platforms:
set -e ;\
$(Q)set -e ;\
for i in platforms/*/Makefile.inc ; do \
export DIRNAME=`dirname $$i` ;\
export PROBE_HOST=`basename $$DIRNAME` ;\
export CFLAGS=-Werror ;\
echo $$PROBE_HOST ;\
$(MAKE) clean ;\
$(MAKE) ;\
echo "Building for hardware platform: $$PROBE_HOST" ;\
$(MAKE) $(MAKEFLAGS) clean ;\
$(MAKE) $(MAKEFLAGS);\
if [ -f blackmagic.bin ]; then \
mv blackmagic.bin blackmagic-$$PROBE_HOST.bin ;\
fi ;\

View File

@ -25,4 +25,4 @@ SRC += cdcacm.c \
all: blackmagic.bin
host_clean:
-rm blackmagic.bin
-$(Q)$(RM) blackmagic.bin

View File

@ -24,9 +24,9 @@ SRC += cdcacm.c \
all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex
blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o
$(CC) $^ -o $@ $(LDFLAGS_BOOT)
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)
host_clean:
-rm blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex
-$(Q)$(RM) -f blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex

View File

@ -23,11 +23,13 @@ SRC += cdcacm.c \
all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade.bin dfu_upgrade.hex
blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o
$(CC) $^ -o $@ $(LDFLAGS_BOOT)
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)
dfu_upgrade: dfu_upgrade.o dfucore.o dfu_f1.o
$(CC) $^ -o $@ $(LDFLAGS)
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS)
host_clean:
-rm blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade dfu_upgrade.bin dfu_upgrade.hex
-$(Q)$(RM) blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade dfu_upgrade.bin dfu_upgrade.hex

View File

@ -23,8 +23,9 @@ SRC += cdcacm.c \
all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex
blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o
$(CC) $^ -o $@ $(LDFLAGS_BOOT)
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)
host_clean:
-rm blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex
-$(Q)$(RM) blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex