Pretty-print the output by default.
This makes it a lot easier to see what's going on, and let me find some problems. Use "make Q=" or set Q= blank in your user Makefile to see the full commands.
This commit is contained in:
parent
87e628b897
commit
0c163122da
|
@ -5,6 +5,12 @@
|
||||||
all: $(addsuffix _$(BOARD).bin, $(TARGETS) $(TARGETS_ROMVARS))
|
all: $(addsuffix _$(BOARD).bin, $(TARGETS) $(TARGETS_ROMVARS))
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
|
# Pretty print output. Use "make Q=" to see full commands
|
||||||
|
Q ?= @
|
||||||
|
define pretty
|
||||||
|
@printf "%8s %s\n" "$1" "$2"
|
||||||
|
endef
|
||||||
|
|
||||||
# Don't delete intermediate targets
|
# Don't delete intermediate targets
|
||||||
.SECONDARY:
|
.SECONDARY:
|
||||||
|
|
||||||
|
@ -46,6 +52,7 @@ AFLAGS ?= -Wa,-gstabs $(CFLAGS)
|
||||||
|
|
||||||
# Misc tool options
|
# Misc tool options
|
||||||
OBJCOPYFLAGS ?= --gap-fill=0xff
|
OBJCOPYFLAGS ?= --gap-fill=0xff
|
||||||
|
ARFLAGS = cr
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
||||||
|
@ -58,7 +65,8 @@ include $(MC1322X)/src/Makefile.src
|
||||||
# that links $(SRCLIB) as well as target-specific rules that link $(SRCLIB_ROMVARS)
|
# that links $(SRCLIB) as well as target-specific rules that link $(SRCLIB_ROMVARS)
|
||||||
define build_elf_rule
|
define build_elf_rule
|
||||||
$(1)_$$(BOARD).elf: $$(OBJDIR)/$(1).o $$(OBJDIR)/board.a $$(MC1322X)/lib/libmc1322x.a $(2)
|
$(1)_$$(BOARD).elf: $$(OBJDIR)/$(1).o $$(OBJDIR)/board.a $$(MC1322X)/lib/libmc1322x.a $(2)
|
||||||
$$(CC) $$(LDFLAGS) -o $$@ -Wl,--start-group $$^ -lm -Wl,--end-group
|
$$(call pretty,LINK,$$@)
|
||||||
|
$$Q$$(CC) $$(LDFLAGS) -o $$@ -Wl,--start-group $$^ -lm -Wl,--end-group
|
||||||
endef
|
endef
|
||||||
# Targets that need space for rom variables:
|
# Targets that need space for rom variables:
|
||||||
$(foreach t, $(TARGETS_ROMVARS), $(eval $(call build_elf_rule,$(t),$(SRCLIB_ROMVARS))))
|
$(foreach t, $(TARGETS_ROMVARS), $(eval $(call build_elf_rule,$(t),$(SRCLIB_ROMVARS))))
|
||||||
|
@ -67,25 +75,35 @@ $(eval $(call build_elf_rule,%,$(SRCLIB)))
|
||||||
|
|
||||||
# Generic rules
|
# Generic rules
|
||||||
%.srec: %.elf
|
%.srec: %.elf
|
||||||
$(OBJCOPY) $(OBJCOPYFLAGS) -O srec $< $@
|
$(call pretty,OBJCOPY,$@)
|
||||||
|
$Q$(OBJCOPY) $(OBJCOPYFLAGS) -O srec $< $@
|
||||||
|
|
||||||
%.ihex: %.elf
|
%.ihex: %.elf
|
||||||
$(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $< $@
|
$(call pretty,OBJCOPY,$@)
|
||||||
|
$Q$(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $< $@
|
||||||
|
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
$(OBJCOPY) $(OBJCOPYFLAGS) -O binary $< $@
|
$(call pretty,OBJCOPY,$@)
|
||||||
|
$Q$(OBJCOPY) $(OBJCOPYFLAGS) -O binary $< $@
|
||||||
|
|
||||||
%.dis: %.elf
|
%.dis: %.elf
|
||||||
$(OBJDUMP) -Sd $< > $@ || rm -f $@
|
$(call pretty,OBJDUMP,$@)
|
||||||
|
$Q$(OBJDUMP) -Sd $< > $@ || rm -f $@
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) $(CFLAGS_THUMB) -MMD -c -o $@ $<
|
$(call pretty,CC,$@)
|
||||||
|
$Q$(CC) $(CFLAGS) $(CFLAGS_THUMB) -MMD -c -o $@ $<
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
%.o: %.S
|
%.o: %.S
|
||||||
$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
$(call pretty,AS,$@)
|
||||||
|
$Q$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
|
(%): %
|
||||||
|
$(call pretty,AR,$@($<))
|
||||||
|
@$(AR) $(ARFLAGS) $@ $<
|
||||||
|
|
||||||
# Fix the dependencies generated for a particular target .o
|
# Fix the dependencies generated for a particular target .o
|
||||||
# See http://make.paulandlesley.org/autodep.html#advanced
|
# See http://make.paulandlesley.org/autodep.html#advanced
|
||||||
define FINALIZE_DEPENDENCY
|
define FINALIZE_DEPENDENCY
|
||||||
|
|
|
@ -7,19 +7,22 @@ CFLAGS += -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
|
||||||
|
|
||||||
# Create directory and board.h include
|
# Create directory and board.h include
|
||||||
$(OBJDIR)/board.h:
|
$(OBJDIR)/board.h:
|
||||||
mkdir -p $(OBJDIR)
|
$(call pretty,GEN,$@)
|
||||||
echo '/* This file was automatically generated */' > $(OBJDIR)/board.h
|
$(Q)mkdir -p $(OBJDIR)
|
||||||
echo '#include "$(BOARD).h"' >> $(OBJDIR)/board.h
|
$(Q)echo '/* This file was automatically generated */' > $(OBJDIR)/board.h
|
||||||
|
$(Q)echo '#include "$(BOARD).h"' >> $(OBJDIR)/board.h
|
||||||
|
|
||||||
# $(OBJDIR)/board.a contains all the objects defined in COBJS
|
# $(OBJDIR)/board.a contains all the objects defined in COBJS
|
||||||
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR)/board.a($(addprefix $(OBJDIR)/, $(COBJS)))
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR)/board.a($(addprefix $(OBJDIR)/, $(COBJS)))
|
||||||
|
|
||||||
# And is built from files in the parent directory
|
# And is built from files in the parent directory
|
||||||
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h
|
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h
|
||||||
$(CC) $(CFLAGS) $(CFLAGS_THUMB) -MMD -c -o $@ $<
|
$(call pretty,CC,$@)
|
||||||
|
$Q$(CC) $(CFLAGS) $(CFLAGS_THUMB) -MMD -c -o $@ $<
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.S $(OBJDIR)/board.h
|
$(OBJDIR)/%.o: %.S $(OBJDIR)/board.h
|
||||||
|
$(call pretty,AS,$@)
|
||||||
$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,14 @@ $(SRCLIB): $(SRCLIB)($(SRC_OBJS) $(START))
|
||||||
|
|
||||||
# ISR is built without thumb
|
# ISR is built without thumb
|
||||||
$(ISR): $(ISR:.o=.c)
|
$(ISR): $(ISR:.o=.c)
|
||||||
$(CC) $(CFLAGS) -MMD -c -o $@ $<
|
$(call pretty,CC (isr),$@)
|
||||||
|
$Q$(CC) $(CFLAGS) -MMD -c -o $@ $<
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
# start-romvars.o is built from start.S with the right flags
|
# start-romvars.o is built from start.S with the right flags
|
||||||
$(MC1322X)/src/start-romvars.o: $(MC1322X)/src/start.S
|
$(MC1322X)/src/start-romvars.o: $(MC1322X)/src/start.S
|
||||||
$(CC) $(AFLAGS) -MMD -DUSE_ROM_VARS -c -o $@ $<
|
$(call pretty,CC (romvars),$@)
|
||||||
|
$Q$(CC) $(AFLAGS) -MMD -DUSE_ROM_VARS -c -o $@ $<
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
|
Loading…
Reference in a new issue