From c81a1f9711faf7fe2667a14daba74b0b6ec173f7 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Wed, 24 Jun 2020 11:14:02 +0800 Subject: [PATCH] make/import: support install nuttx binary in flat build Change-Id: Iaffa86ee9ebd77380424e6d4a0777262685c989f Signed-off-by: chao.an --- Makefile | 1 + import/Make.defs | 2 +- import/Makefile | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7d9713558..29d5e0952 100644 --- a/Makefile +++ b/Makefile @@ -120,6 +120,7 @@ install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install) import: $(MKDEP) context $(Q) $(MAKE) depend TOPDIR="$(APPDIR)$(DELIM)import" $(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import" + $(Q) $(MAKE) -C import install TOPDIR="$(APPDIR)$(DELIM)import" endif # CONFIG_BUILD_KERNEL diff --git a/import/Make.defs b/import/Make.defs index 3f99b32c8..41833fa3a 100644 --- a/import/Make.defs +++ b/import/Make.defs @@ -77,7 +77,7 @@ ifeq ($(CONFIG_CYGWIN_WINTOOL),y) LDLIBPATH = -L "${shell cygpath -w $(APPDIR)}" -L "${shell cygpath -w $(TOPDIR)$(DELIM)libs}" else # Linux/Cygwin-native toolchain - LDLIBPATH = -L $(APPDIR) -L $(TOPDIR)$(DELIM)libs + LDLIBPATH = -L $(TOPDIR)$(DELIM)libs endif # Try to get the path to libgcc.a. Of course, this only works for GCC diff --git a/import/Makefile b/import/Makefile index 63eb4bec1..d2b18ac60 100644 --- a/import/Makefile +++ b/import/Makefile @@ -43,7 +43,17 @@ FILES = .config System.map User.map all: .PHONY: context depend clean distclean -install: +APPDIR = $(realpath $(CURDIR)$(DELIM)..) +HEAD_OBJ += $(wildcard $(TOPDIR)$(DELIM)startup$(DELIM)*$(OBJEXT)) +HEAD_OBJ += $(wildcard $(APPDIR)$(DELIM)builtin$(DELIM)*$(OBJEXT)) + +$(APPDIR)$(DELIM)nuttx$(EXEEXT): $(wildcard $(APPDIR)$(DELIM)*$(LIBEXT)) + $(Q) echo "LD: nuttx" + $(Q) $(LD) --entry=__start $(LDFLAGS) -T$(LDSCRIPT) $(LIBPATHS) \ + $(LDLIBPATH) -L$(CURDIR)$(DELIM)scripts -o $@ $(HEAD_OBJ) \ + $(EXTRA_OBJS) $(LDSTARTGROUP) $^ $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP) + +install: $(APPDIR)$(DELIM)nuttx$(EXEEXT) context: