arch/makefile: preprocess link script to make configure more flexibly
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
5c9b094d65
commit
6bc4baa4ca
@ -109,7 +109,8 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
LDFLAGS += $(addprefix $(SCRIPT_OPT),$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT))
|
||||||
|
LDFLAGS += $(addprefix $(SCRIPT_OPT),$(ARCHSCRIPT).tmp) $(EXTRALINKCMDS)
|
||||||
LIBPATHS += $(LIBPATH_OPT) $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
|
LIBPATHS += $(LIBPATH_OPT) $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
|
||||||
|
|
||||||
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
|
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
|
||||||
@ -165,7 +166,10 @@ define LINK_ALLSYMS
|
|||||||
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT) $(ARCHSCRIPT)
|
$(addsuffix .tmp,$(ARCHSCRIPT)): $(ARCHSCRIPT)
|
||||||
|
$(call PREPROCESS, $(patsubst %.tmp,%,$@), $@)
|
||||||
|
|
||||||
|
nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT) $(addsuffix .tmp,$(ARCHSCRIPT))
|
||||||
$(Q) echo "LD: nuttx"
|
$(Q) echo "LD: nuttx"
|
||||||
ifneq ($(CONFIG_ALLSYMS),y)
|
ifneq ($(CONFIG_ALLSYMS),y)
|
||||||
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
||||||
@ -184,6 +188,7 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||||
sort > $(TOPDIR)$(DELIM)System.map
|
sort > $(TOPDIR)$(DELIM)System.map
|
||||||
endif
|
endif
|
||||||
|
$(Q) $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT)))
|
||||||
|
|
||||||
# This is part of the top-level export target
|
# This is part of the top-level export target
|
||||||
# Note that there may not be a head object if layout is handled
|
# Note that there may not be a head object if layout is handled
|
||||||
@ -220,6 +225,7 @@ clean:
|
|||||||
ifeq ($(BOARDMAKE),y)
|
ifeq ($(BOARDMAKE),y)
|
||||||
$(Q) $(MAKE) -C board clean
|
$(Q) $(MAKE) -C board clean
|
||||||
endif
|
endif
|
||||||
|
$(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT)))
|
||||||
$(call DELFILE, $(KBIN))
|
$(call DELFILE, $(KBIN))
|
||||||
$(call DELFILE, $(BIN))
|
$(call DELFILE, $(BIN))
|
||||||
ifneq ($(EXTRADELFILE),)
|
ifneq ($(EXTRADELFILE),)
|
||||||
|
@ -79,7 +79,8 @@ UOBJS = $(UAOBJS) $(UCOBJS)
|
|||||||
KBIN = libkarch$(LIBEXT)
|
KBIN = libkarch$(LIBEXT)
|
||||||
BIN = libarch$(LIBEXT)
|
BIN = libarch$(LIBEXT)
|
||||||
|
|
||||||
LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT))
|
||||||
|
LDFLAGS += $(addprefix -T,$(ARCHSCRIPT).tmp) $(EXTRALINKCMDS)
|
||||||
|
|
||||||
ifeq ($(LD),$(CC))
|
ifeq ($(LD),$(CC))
|
||||||
LDSTARTGROUP ?= -Wl,--start-group
|
LDSTARTGROUP ?= -Wl,--start-group
|
||||||
@ -145,7 +146,10 @@ define LINK_ALLSYMS
|
|||||||
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) $(ARCHSCRIPT)
|
$(addsuffix .tmp,$(ARCHSCRIPT)): $(ARCHSCRIPT)
|
||||||
|
$(call PREPROCESS, $(patsubst %.tmp,%,$@), $@)
|
||||||
|
|
||||||
|
nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) $(addsuffix .tmp,$(ARCHSCRIPT))
|
||||||
$(Q) echo "LD: nuttx"
|
$(Q) echo "LD: nuttx"
|
||||||
ifneq ($(CONFIG_ALLSYMS),y)
|
ifneq ($(CONFIG_ALLSYMS),y)
|
||||||
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
||||||
@ -164,6 +168,7 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||||
sort > $(TOPDIR)/System.map
|
sort > $(TOPDIR)/System.map
|
||||||
endif
|
endif
|
||||||
|
$(Q) $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT)))
|
||||||
|
|
||||||
# This is part of the top-level export target
|
# This is part of the top-level export target
|
||||||
# Note that there may not be a head object if layout is handled
|
# Note that there may not be a head object if layout is handled
|
||||||
@ -200,6 +205,7 @@ clean:
|
|||||||
ifeq ($(BOARDMAKE),y)
|
ifeq ($(BOARDMAKE),y)
|
||||||
$(Q) $(MAKE) -C board clean
|
$(Q) $(MAKE) -C board clean
|
||||||
endif
|
endif
|
||||||
|
$(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT)))
|
||||||
$(call DELFILE, $(KBIN))
|
$(call DELFILE, $(KBIN))
|
||||||
$(call DELFILE, $(BIN))
|
$(call DELFILE, $(BIN))
|
||||||
$(call DELFILE, $(HEAD_OBJ))
|
$(call DELFILE, $(HEAD_OBJ))
|
||||||
|
@ -80,7 +80,8 @@ BIN = libarch$(LIBEXT)
|
|||||||
|
|
||||||
# Override in Make.defs if linker is not 'ld'
|
# Override in Make.defs if linker is not 'ld'
|
||||||
|
|
||||||
LDFLAGS += $(addprefix -T,$(call CONVERT_PATH,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
|
ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT))
|
||||||
|
LDFLAGS += $(addprefix -T,$(ARCHSCRIPT).tmp) $(EXTRALINKCMDS)
|
||||||
|
|
||||||
ifeq ($(LD),$(CC))
|
ifeq ($(LD),$(CC))
|
||||||
LDSTARTGROUP ?= -Wl,--start-group
|
LDSTARTGROUP ?= -Wl,--start-group
|
||||||
@ -142,7 +143,10 @@ define LINK_ALLSYMS
|
|||||||
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
$(Q) $(call DELFILE, allsyms.tmp allsyms$(OBJEXT))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
nuttx$(EXEEXT): $(STARTUP_OBJS) board/libboard$(LIBEXT) $(ARCHSCRIPT)
|
$(addsuffix .tmp,$(ARCHSCRIPT)): $(ARCHSCRIPT)
|
||||||
|
$(call PREPROCESS, $(patsubst %.tmp,%,$@), $@)
|
||||||
|
|
||||||
|
nuttx$(EXEEXT): $(STARTUP_OBJS) board/libboard$(LIBEXT) $(addsuffix .tmp,$(ARCHSCRIPT))
|
||||||
$(Q) echo "LD: nuttx"
|
$(Q) echo "LD: nuttx"
|
||||||
ifneq ($(CONFIG_ALLSYMS),y)
|
ifneq ($(CONFIG_ALLSYMS),y)
|
||||||
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
|
||||||
@ -161,6 +165,7 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||||
sort > $(TOPDIR)/System.map
|
sort > $(TOPDIR)/System.map
|
||||||
endif
|
endif
|
||||||
|
$(Q) $(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT)))
|
||||||
|
|
||||||
# This is part of the top-level export target
|
# This is part of the top-level export target
|
||||||
|
|
||||||
@ -193,6 +198,7 @@ clean:
|
|||||||
ifeq ($(BOARDMAKE),y)
|
ifeq ($(BOARDMAKE),y)
|
||||||
$(Q) $(MAKE) -C board clean
|
$(Q) $(MAKE) -C board clean
|
||||||
endif
|
endif
|
||||||
|
$(call DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT)))
|
||||||
$(call DELFILE, $(KBIN))
|
$(call DELFILE, $(KBIN))
|
||||||
$(call DELFILE, $(BIN))
|
$(call DELFILE, $(BIN))
|
||||||
$(call CLEAN)
|
$(call CLEAN)
|
||||||
|
Loading…
Reference in New Issue
Block a user