-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefile.include: separate link
in subtargets
#8844
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,7 +308,12 @@ BASELIBS += $(BINDIR)/$(APPLICATION_MODULE).a | |
BASELIBS += $(APPDEPS) | ||
|
||
.PHONY: all link clean flash flash-only term doc debug debug-server reset objdump help info-modules | ||
.PHONY: print-size | ||
.PHONY: ..in-docker-container | ||
# Target can depend on FORCE to always rebuild but still let make use file | ||
# modification timestamp (contrary to .PHONY). | ||
# Use it for goals that may keep outputs unchanged when executed. | ||
.PHONY: FORCE | ||
|
||
ELFFILE ?= $(BINDIR)/$(APPLICATION).elf | ||
HEXFILE ?= $(ELFFILE:.elf=.hex) | ||
|
@@ -321,23 +326,38 @@ LINKFLAGPREFIX ?= -Wl, | |
|
||
DIRS += $(EXTERNAL_MODULE_DIRS) | ||
|
||
_LINK = $(if $(CPPMIX),$(LINKXX),$(LINK)) $(UNDEF) $(LINKFLAGPREFIX)--start-group $(BASELIBS) -lm $(LINKFLAGPREFIX)--end-group $(LINKFLAGPREFIX)-Map=$(BINDIR)/$(APPLICATION).map $(LINKFLAGS) | ||
# Linker rule | ||
$(ELFFILE): FORCE | ||
ifeq ($(BUILDOSXNATIVE),1) | ||
_LINK = $(if $(CPPMIX),$(LINKXX),$(LINK)) $(UNDEF) $$(find $(BASELIBS) -size +8c) $(LINKFLAGS) $(LINKFLAGPREFIX)-no_pie | ||
else | ||
_LINK = $(if $(CPPMIX),$(LINKXX),$(LINK)) $(UNDEF) $(LINKFLAGPREFIX)--start-group $(BASELIBS) -lm $(LINKFLAGPREFIX)--end-group $(LINKFLAGS) $(LINKFLAGPREFIX)-Map=$(BINDIR)/$(APPLICATION).map | ||
endif # BUILDOSXNATIVE | ||
|
||
ifeq ($(BUILD_IN_DOCKER),1) | ||
link: ..in-docker-container | ||
else | ||
## make script for your application. Build RIOT-base here! | ||
link: ..compiler-check ..build-message $(RIOTBUILD_CONFIG_HEADER_C) $(USEPKG:%=$(BINDIR)/%.a) $(APPDEPS) | ||
$(Q)DIRS="$(DIRS)" "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk | ||
ifeq (,$(RIOTNOLINK)) | ||
ifeq ($(BUILDOSXNATIVE),1) | ||
$(Q)$(if $(CPPMIX),$(LINKXX),$(LINK)) $(UNDEF) -o $(ELFFILE) $$(find $(BASELIBS) -size +8c) $(LINKFLAGS) $(LINKFLAGPREFIX)-no_pie | ||
link: ..compiler-check ..build-message $(ELFFILE) $(HEXFILE) print-size | ||
else | ||
$(Q)$(_LINK) -o $(ELFFILE) | ||
endif | ||
$(Q)$(SIZE) $(ELFFILE) | ||
$(Q)$(OBJCOPY) $(OFLAGS) $(ELFFILE) $(HEXFILE) | ||
endif | ||
link: ..compiler-check ..build-message $(BASELIBS) | ||
endif # RIOTNOLINK | ||
|
||
$(ELFFILE): $(BASELIBS) | ||
$(Q)$(_LINK) -o $@ | ||
|
||
# All modules are built by application.inc.mk makefile | ||
$(BINDIR)/$(APPLICATION_MODULE).a: $(RIOTBUILD_CONFIG_HEADER_C) $(USEPKG:%=$(BINDIR)/%.a) $(APPDEPS) | ||
$(Q)DIRS="$(DIRS)" "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk | ||
$(BINDIR)/$(APPLICATION_MODULE).a: FORCE | ||
|
||
# 'print-size' triggers a rebuild. Use 'info-buildsize' if you do not need to rebuild. | ||
print-size: $(ELFFILE) | ||
$(Q)$(SIZE) $< | ||
|
||
$(HEXFILE): $(ELFFILE) | ||
$(Q)$(OBJCOPY) $(OFLAGS) $< $@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no -Oihex? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this PR I only put it to a separate target but keep the old rule. Many boards are using 'HEXFILE' for a '.bin' file so cannot replace it here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
||
endif # BUILD_IN_DOCKER | ||
|
||
# Check given command is available in the path | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing hexfile here to flashfile comes later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because changing to
FLASHFILE
requires other changes in the flasher scripts.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok