Makefile: add dependency for linker scripts
This commit is contained in:
parent
fe84c58450
commit
84051a9071
4 changed files with 9 additions and 9 deletions
8
Makefile
8
Makefile
|
@ -89,7 +89,7 @@ CFLAGS += -O2 -MMD -Wall -Werror $(INCFLAGS) \
|
|||
-Wno-main -U_FORTIFY_SOURCE -fvisibility=hidden
|
||||
CXXFLAGS += $(CFLAGS) -ffreestanding -fno-rtti -fno-exceptions
|
||||
ASFLAGS += -MMD $(INCFLAGS)
|
||||
LDFLAGS += -z noexecstack
|
||||
LDFLAGS += -z noexecstack $(addprefix -T, $(LDSCRIPTS))
|
||||
|
||||
## 4. Arch-Specific Configurations
|
||||
|
||||
|
@ -123,13 +123,13 @@ $(LIBS): %:
|
|||
@$(MAKE) -s -C $(AM_HOME)/$* archive
|
||||
|
||||
### Rule (link): objects (`*.o`) and libraries (`*.a`) -> `IMAGE.elf`, the final ELF binary to be packed into image (ld)
|
||||
$(IMAGE).elf: $(LINKAGE)
|
||||
$(IMAGE).elf: $(LINKAGE) $(LDSCRIPTS)
|
||||
@echo \# Creating image [$(ARCH)]
|
||||
@echo + LD "->" $(IMAGE_REL).elf
|
||||
ifneq ($(filter $(ARCH),native),)
|
||||
$(CXX) -o $@ -Wl,--whole-archive $^ -Wl,-no-whole-archive $(LDFLAGS_CXX)
|
||||
$(CXX) -o $@ -Wl,--whole-archive $(LINKAGE) -Wl,-no-whole-archive $(LDFLAGS_CXX)
|
||||
else
|
||||
@$(LD) $(LDFLAGS) -o $@ --start-group $^ --end-group
|
||||
@$(LD) $(LDFLAGS) -o $@ --start-group $(LINKAGE) --end-group
|
||||
endif
|
||||
|
||||
### Rule (archive): objects (`*.o`) -> `ARCHIVE.a` (ar)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue