Use a variable for all target objects
Instead of specifying them individually. This lets included makefiles (like my audio/Makefile.include) append objects.
This commit is contained in:
parent
036b80e3c1
commit
6b4d6a9ade
|
@ -65,13 +65,13 @@ include $(MC1322X)/src/Makefile.src
|
||||||
# $(SRCLIB) as well as target-specific rules that link $(SRCLIB_ROMVARS)
|
# $(SRCLIB) as well as target-specific rules that link $(SRCLIB_ROMVARS)
|
||||||
|
|
||||||
# Normal targets (wildcard rule):
|
# Normal targets (wildcard rule):
|
||||||
%_$(BOARD).elf: $(OBJDIR)/%.o $(OBJDIR)/board.a $(MC1322X)/lib/libmc1322x.a $(SRCLIB)
|
%_$(BOARD).elf: $(OBJDIR)/%.o $(TARGET_OBJ) $(SRCLIB)
|
||||||
$(call pretty,LINK,$@)
|
$(call pretty,LINK,$@)
|
||||||
$Q$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $^ -lm -Wl,--end-group
|
$Q$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $^ -lm -Wl,--end-group
|
||||||
|
|
||||||
# Targets that need space for rom variables:
|
# Targets that need space for rom variables:
|
||||||
define build_elf_rule
|
define build_elf_rule
|
||||||
$(1)_$$(BOARD).elf: $$(OBJDIR)/$(1).o $$(OBJDIR)/board.a $$(MC1322X)/lib/libmc1322x.a $$(SRCLIB_ROMVARS)
|
$(1)_$$(BOARD).elf: $$(OBJDIR)/$(1).o $$(TARGET_OBJ) $$(SRCLIB_ROMVARS)
|
||||||
$$(call pretty,LINK (romvars),$$@)
|
$$(call pretty,LINK (romvars),$$@)
|
||||||
$$Q$$(CC) $$(LDFLAGS) -o $$@ -Wl,--start-group $$^ -lm -Wl,--end-group
|
$$Q$$(CC) $$(LDFLAGS) -o $$@ -Wl,--start-group $$^ -lm -Wl,--end-group
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -21,6 +21,8 @@ $(OBJDIR)/board.a: $(OBJDIR)/board.h
|
||||||
$Q$(AR) $(ARFLAGS) $@
|
$Q$(AR) $(ARFLAGS) $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
TARGET_OBJ += $(OBJDIR)/board.a
|
||||||
|
|
||||||
# And is built from files in the parent directory
|
# And is built from files in the parent directory
|
||||||
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h $(FORCE_C_DEPENDS)
|
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h $(FORCE_C_DEPENDS)
|
||||||
$(call pretty,CC,$@)
|
$(call pretty,CC,$@)
|
||||||
|
|
|
@ -7,6 +7,8 @@ LIBOBJS ?= $(patsubst %.c,%.o,$(wildcard $(MC1322X)/lib/*.c))
|
||||||
|
|
||||||
$(MC1322X)/lib/libmc1322x.a: $(MC1322X)/lib/libmc1322x.a($(LIBOBJS))
|
$(MC1322X)/lib/libmc1322x.a: $(MC1322X)/lib/libmc1322x.a($(LIBOBJS))
|
||||||
|
|
||||||
|
TARGET_OBJ += $(MC1322X)/lib/libmc1322x.a
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
-include $(wildcard $(MC1322X)/lib/*.d)
|
-include $(wildcard $(MC1322X)/lib/*.d)
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue