[make] add options to add extra .o files to the link line at the module and global scope

This commit is contained in:
Travis Geiselbrecht
2012-09-23 18:29:34 -07:00
parent 1286f5bdc9
commit 6830dfe447
3 changed files with 8 additions and 3 deletions

View File

@@ -6,10 +6,10 @@ $(OUTBIN): $(OUTELF)
$(NOECHO)$(SIZE) $<
$(NOCOPY)$(OBJCOPY) -O binary $< $@
$(OUTELF): $(ALLMODULE_OBJS) $(LINKER_SCRIPT)
$(OUTELF): $(ALLMODULE_OBJS) $(EXTRA_OBJS) $(LINKER_SCRIPT)
@echo linking $@
$(NOECHO)$(SIZE) -t $(ALLMODULE_OBJS)
$(NOECHO)$(LD) $(GLOBAL_LDFLAGS) -T $(LINKER_SCRIPT) $(ALLMODULE_OBJS) $(LIBGCC) -o $@
$(NOECHO)$(LD) $(GLOBAL_LDFLAGS) -T $(LINKER_SCRIPT) $(ALLMODULE_OBJS) $(EXTRA_OBJS) $(LIBGCC) -o $@
$(OUTELF).sym: $(OUTELF)
@echo generating symbols: $@

View File

@@ -12,6 +12,7 @@
# MODULE_CPPFLAGS : CPPFLAGS local to this module
# MODULE_ASMFLAGS : ASMFLAGS local to this module
# MODULE_SRCDEPS : extra dependencies that all of this module's files depend on
# MODULE_EXTRA_OBJS : extra .o files that should be linked with the module
# MODULE_ARM_OVERRIDE_SRCS : list of source files, local path that should be force compiled with ARM (if applicable)
@@ -67,7 +68,7 @@ include make/compile.mk
# build a ld -r style combined object
MODULE_OBJECT := $(call TOBUILDDIR,$(MODULE_SRCDIR).mod.o)
$(MODULE_OBJECT): $(MODULE_OBJS)
$(MODULE_OBJECT): $(MODULE_OBJS) $(MODULE_EXTRA_OBJS)
@$(MKDIR)
@echo linking $@
$(NOECHO)$(LD) -r $^ -o $@
@@ -95,6 +96,7 @@ MODULE_CFLAGS :=
MODULE_CPPFLAGS :=
MODULE_ASMFLAGS :=
MODULE_SRCDEPS :=
MODULE_EXTRA_OBJS :=
MODULE_CONFIG :=
MODULE_OBJECT :=
MODULE_ARM_OVERRIDE_SRCS :=

View File

@@ -82,6 +82,9 @@ EXTRA_BUILDDEPS :=
# any rules you put here will be depended on in clean builds
EXTRA_CLEANDEPS :=
# any objects you put here get linked with the final image
EXTRA_OBJS :=
include project/$(PROJECT).mk
include target/$(TARGET)/rules.mk
include platform/$(PLATFORM)/rules.mk