From 6f6bc758ccd46eaf2f29901fe298d1b5d12c7b14 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 4 Sep 2018 16:04:25 -0600 Subject: [PATCH] Application.mk: Add module install logic. Possibly only needed in KERNEL build mode? Makefile: Simplify import target for KERNEL build. A symbol table is not needed because the KERNEL-mode programs are completely linked. Also fix missing deletion in clean and distclean targets. tools/mksymtab.sh: Fix a typo introduced in previous commit. --- Application.mk | 1 + Makefile | 32 ++++++++++++-------------------- tools/mksymtab.sh | 2 +- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Application.mk b/Application.mk index 9f422c24e..6bf225eb1 100644 --- a/Application.mk +++ b/Application.mk @@ -190,6 +190,7 @@ PROGOBJ := $(MAINOBJ) ifneq ($(PROGOBJ),) $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) $(ARCHCRT0OBJ) $(firstword $(PROGOBJ)) $(LDLIBS) -o $(firstword $(PROGLIST)) $(Q) $(NM) -u $(firstword $(PROGLIST)) + $(Q) install -m 0755 -D $(firstword $(PROGLIST)) $(BIN_DIR)/$(firstword $(PROGLIST)) $(eval PROGLIST=$(filter-out $(firstword $(PROGLIST)),$(PROGLIST))) $(eval PROGOBJ=$(filter-out $(firstword $(PROGOBJ)),$(PROGOBJ))) endif diff --git a/Makefile b/Makefile index e9143facc..09785e254 100644 --- a/Makefile +++ b/Makefile @@ -103,39 +103,29 @@ $(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),depend)) $(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),clean))) $(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),distclean))) +# In the KERNEL build, we must build and install all of the modules. No +# symbol table is needed + ifeq ($(CONFIG_BUILD_KERNEL),y) .install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install) install: $(BIN_DIR) .install -$(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all) - $(Q) $(MAKE) install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" - $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(EXE_DIR)$(DELIM)system $(SYMTABSRC) - -$(SYMTABOBJ): %$(OBJEXT): %.c -ifeq ($(WINTOOL),y) - $(call COMPILE, -fno-lto "${shell cygpath -w $<}", "${shell cygpath -w $@}") -else - $(call COMPILE, -fno-lto $<, $@) -endif - -$(BIN): $(SYMTABOBJ) -ifeq ($(WINTOOL),y) - $(call ARCHIVE, $(BIN), "${shell cygpath -w $^}") -else - $(call ARCHIVE, $(BIN), $^) -endif - $(BIN_DIR): $(Q) mkdir -p $(BIN_DIR) -.import: $(BIN_DIR) $(SYMTABSRC) $(BIN) +.import: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all) + $(Q) $(MAKE) install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -import: +import: $(BIN_DIR) $(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import" else + +# In FLAT and protected modes, the modules have already been created. A +# symbol table is required. + ifeq ($(CONFIG_BUILD_LOADABLE),) $(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all) @@ -204,6 +194,7 @@ clean_context: clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean) $(call DELFILE, $(SYMTABSRC)) + $(call DELFILE, $(SYMTABOBJ)) $(call DELFILE, $(BIN)) $(call DELFILE, Kconfig) $(call DELDIR, $(BIN_DIR)) @@ -227,6 +218,7 @@ else endif $(call DELFILE, .depend) $(call DELFILE, $(SYMTABSRC)) + $(call DELFILE, $(SYMTABOBJ)) $(call DELFILE, $(BIN)) $(call DELFILE, Kconfig) $(call DELDIR, $(BIN_DIR)) diff --git a/tools/mksymtab.sh b/tools/mksymtab.sh index fa6249ad8..54262f5d3 100755 --- a/tools/mksymtab.sh +++ b/tools/mksymtab.sh @@ -69,7 +69,7 @@ rm -f $outfile # list of sorted, unique undefined variable names. execlist=`find ${dir} -type f` -if [ ! -z "${execlist}"]; then +if [ ! -z "${execlist}" ]; then for exec in ${execlist}; do nm $exec | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 >>_tmplist done