apps Makesystem: Fix an error when building apps/ withtout nuttx/, using only the NuttX export package only and assuming that the nuttx/ directory in not even present. In this case, the problem fixed where the apps/Make.defs file was selecting tools from the /tools directory which does not exist because TOPDIR=apps/import. Instead, for this build case, I have not thought of any option but to duplicate scripts as necessary in the apps/tools directory. Also added a top-level target to compile the symbol table. Misc fixes: quoting in scripts, some errors in script syntax.
This commit is contained in:
parent
9240ef5536
commit
272bdc0d6e
40
Make.defs
40
Make.defs
@ -57,28 +57,49 @@ endef
|
||||
endif
|
||||
|
||||
# Tools
|
||||
#
|
||||
# In a normal build, tools will reside in the nuttx/tools sub-directory and
|
||||
# TOPDIR will refer to that nuttx/ directory. This, however, is not the
|
||||
# case when building apps/ with a NuttX export directory; there is no
|
||||
# apps/import/tools directory. In that case copies of the NuttX tools in
|
||||
# the apps/tools directory are used.
|
||||
|
||||
DELIM ?= $(strip /)
|
||||
ifneq (,$(wildcard $(TOPDIR)$(DELIM)tools))
|
||||
TOOLDIR = $(TOPDIR)$(DELIM)tools
|
||||
else
|
||||
TOOLDIR = $(APPDIR)$(DELIM)tools
|
||||
endif
|
||||
|
||||
ifeq ($(DIRLINK),)
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
DIRLINK = $(TOPDIR)\tools\link.bat
|
||||
DIRUNLINK = $(TOPDIR)\tools\unlink.bat
|
||||
DIRLINK = $(TOOLDIR)$(DELIM)link.bat
|
||||
DIRUNLINK = $(TOOLDIR)$(DELIM)unlink.bat
|
||||
else ifeq ($(CONFIG_WINDOWS_MSYS),y)
|
||||
DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
|
||||
DIRLINK = $(TOOLDIR)$(DELIM)copydir.sh
|
||||
DIRUNLINK = $(TOOLDIR)$(DELIM)unlink.sh
|
||||
else
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
DIRUNLINK = $(TOOLDIR)$(DELIM)unlink.sh
|
||||
ifeq ($(WINTOOL),y)
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRLINK = $(TOOLDIR)$(DELIM)copydir.sh
|
||||
else
|
||||
DIRLINK = $(TOPDIR)/tools/link.sh
|
||||
DIRLINK = $(TOOLDIR)$(DELIM)link.sh
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
MKKCONFIG = $(APPDIR)\tools\mkkconfig.bat
|
||||
MKKCONFIG = $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.bat
|
||||
else
|
||||
MKKCONFIG = $(APPDIR)/tools/mkkconfig.sh
|
||||
MKKCONFIG = $(APPDIR)$(DELIM)tools$(DELIM)mkkconfig.sh
|
||||
endif
|
||||
|
||||
ifeq ($(INCDIR),)
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
INCDIR = $(TOOLDIR)$(DELIM)incdir.bat
|
||||
else
|
||||
INCDIR = $(TOOLDIR)$(DELIM)incdir.sh
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
@ -89,4 +110,3 @@ endif
|
||||
|
||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"}
|
||||
CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"}
|
||||
|
||||
|
5
Makefile
5
Makefile
@ -76,7 +76,7 @@ BIN = libapps$(LIBEXT)
|
||||
# Build targets
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: import install dirlinks context context_serialize clean_context context_rest .depdirs preconfig depend clean distclean
|
||||
.PHONY: import symtab install dirlinks context context_serialize clean_context context_rest .depdirs preconfig depend clean distclean
|
||||
.PRECIOUS: libapps$(LIBEXT)
|
||||
|
||||
define MAKE_template
|
||||
@ -108,6 +108,9 @@ install: $(BIN_DIR) .install
|
||||
|
||||
.import: $(BIN) install
|
||||
|
||||
symtab:
|
||||
$(call MAKE_template,import,symtab)
|
||||
|
||||
import:
|
||||
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
|
||||
|
||||
|
@ -186,10 +186,10 @@ AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
LDLIBPATH = -L "${shell cygpath -w $(APPDIR)}" -L "${shell cygpath -w $(TOPDIR)$(DELIM)staging}"
|
||||
LDLIBPATH = -L "${shell cygpath -w $(APPDIR)}" -L "${shell cygpath -w $(TOPDIR)$(DELIM)libs}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
LDLIBPATH = -L $(APPDIR) -L $(TOPDIR)$(DELIM)staging
|
||||
LDLIBPATH = -L $(APPDIR) -L $(TOPDIR)$(DELIM)libs
|
||||
endif
|
||||
|
||||
LDLIBS = -lapps -lnuttx
|
||||
@ -199,7 +199,7 @@ LDLIBS = -lapps -lnuttx
|
||||
|
||||
LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name 2>/dev/null}"
|
||||
ifneq ($(LIBGCC),)
|
||||
LDLIBPATH += -L ${shell dirname $(LIBGCC)}
|
||||
LDLIBPATH += -L "${shell dirname $(LIBGCC)}"
|
||||
LDLIBS += -lgcc
|
||||
endif
|
||||
|
||||
@ -211,3 +211,4 @@ ifeq ($(WINTOOL),y)
|
||||
else
|
||||
LDELFFLAGS += -T $(TOPDIR)/scripts/gnu-elf.ld
|
||||
endif
|
||||
|
||||
|
@ -41,9 +41,9 @@
|
||||
SUBDIRS = arch build include libs startup tmp
|
||||
FILES = .config System.map User.map
|
||||
|
||||
ifeq (,$(wildcard ./symtab.c))
|
||||
ifneq (,$(wildcard ./symtab.c))
|
||||
define MKSYMTAB
|
||||
$(Q) $(MAKE) -f Makefile.symtab $1
|
||||
$(Q) $(MAKE) -f Makefile.symtab $1 TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"
|
||||
endef
|
||||
else
|
||||
define MKSYMTAB
|
||||
@ -51,7 +51,7 @@ endef
|
||||
endif
|
||||
|
||||
all: symtab
|
||||
.PHONY: context depend clean distclean
|
||||
.PHONY: symtab context depend clean distclean
|
||||
.PRECIOUS: ../libapps$(LIBEXT)
|
||||
|
||||
symtab:
|
||||
|
@ -78,7 +78,13 @@ rm -f $outfile
|
||||
# Extract all of the undefined symbols from the ELF files and create a
|
||||
# list of sorted, unique undefined variable names.
|
||||
|
||||
varlist=`find ${dir} -executable -type f | xargs nm | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq`
|
||||
execlist=`find ${dir} -executable -type f`
|
||||
for exec in ${execlist}; do
|
||||
nm $exec | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 >>_tmplist.dat
|
||||
done
|
||||
|
||||
varlist `cat _tmplist | sort - | uniq -`
|
||||
rm -f _tmplist
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
# undefined symbols are declared as void* types. If the toolchain does
|
||||
|
Loading…
x
Reference in New Issue
Block a user