From 75cd1dfd748226a86e52ae345e469aa3795e5f08 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 17 Oct 2019 11:40:39 -0600 Subject: [PATCH] apps/: Move the common variable definitions from other build-related files into apps/Make.defs. --- Application.mk | 8 -------- Make.defs | 41 ++++++++++++++++++++++++++++++++++++++--- Makefile | 46 +++++++++------------------------------------- 3 files changed, 47 insertions(+), 48 deletions(-) diff --git a/Application.mk b/Application.mk index 6c13f1ee9..bc0c67ab5 100644 --- a/Application.mk +++ b/Application.mk @@ -51,10 +51,6 @@ ifneq ($(MAINSRC),) endif endif -# File extensions - -CXXEXT ?= .cxx - # Object files AOBJS = $(ASRCS:.S=$(OBJEXT)) @@ -74,10 +70,6 @@ ifneq ($(BUILD_MODULE),y) OBJS += $(MAINOBJ) endif -# Library file - -BIN ?= $(APPDIR)$(DELIM)libapps$(LIBEXT) - ROOTDEPPATH += --dep-path . VPATH += :. diff --git a/Make.defs b/Make.defs index 3d5c2a792..674eb4559 100644 --- a/Make.defs +++ b/Make.defs @@ -34,6 +34,43 @@ # ############################################################################ +# Application Directories + +# BUILDIRS is the list of top-level directories containing Make.defs files +# CLEANDIRS is the list of all top-level directories containing Makefiles. +# It is used only for cleaning. + +BUILDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Make.defs)) +BUILDIRS := $(filter-out $(APPDIR)$(DELIM)import$(DELIM),$(BUILDIRS)) +CLEANDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Makefile)) + +# CONFIGURED_APPS is the application directories that should be built in +# the current configuration. + +CONFIGURED_APPS := + +define Add_Application + include $(1)Make.defs +endef + +$(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR)))) + +# File extensions + +CXXEXT ?= .cxx + +# Library path + +LIBPATH ?= $(TOPDIR)$(DELIM)staging + +# The install path + +BINDIR ?= $(APPDIR)$(DELIM)bin + +# The final build target + +BIN ?= $(APPDIR)$(DELIM)libapps$(LIBEXT) + # Builtin Registration BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry @@ -62,8 +99,6 @@ endif # Tools -DELIM ?= $(strip /) - ifeq ($(DIRLINK),) ifeq ($(CONFIG_WINDOWS_NATIVE),y) DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.bat @@ -113,5 +148,5 @@ CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"} CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(APPDIR)$(DELIM)include"} ifneq ($(CONFIG_BUILD_KERNEL),y) - LDLIBS ?= $(APPDIR)/libapps.a + LDLIBS ?= $(BIN) endif diff --git a/Makefile b/Makefile index 92075f465..3d3a301e3 100644 --- a/Makefile +++ b/Makefile @@ -40,38 +40,6 @@ TOPDIR ?= $(APPDIR)/import -include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs -# Application Directories - -# BUILDIRS is the list of top-level directories containing Make.defs files -# CLEANDIRS is the list of all top-level directories containing Makefiles. -# It is used only for cleaning. - -BUILDIRS := $(dir $(filter-out import/Make.defs,$(wildcard */Make.defs))) -CLEANDIRS := $(dir $(wildcard */Makefile)) - -# CONFIGURED_APPS is the application directories that should be built in -# the current configuration. - -CONFIGURED_APPS = - -define Add_Application - include $(1)Make.defs -endef - -$(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR)))) - -# Library path - -LIBPATH ?= $(TOPDIR)$(DELIM)staging - -# The install path - -BINDIR = $(APPDIR)$(DELIM)bin - -# The final build target - -BIN ?= libapps$(LIBEXT) - # Symbol table for loadable apps. SYMTABSRC = symtab_apps.c @@ -84,13 +52,13 @@ all: $(BIN) .PRECIOUS: $(BIN) define MAKE_template - $(Q) cd $(1) && $(MAKE) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BINDIR="$(BINDIR)" + $(Q) cd $(1) && $(MAKE) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" endef define SDIR_template $(1)_$(2): - $(Q) cd $(1) && $(MAKE) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BINDIR="$(BINDIR)" + $(Q) cd $(1) && $(MAKE) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" endef @@ -138,7 +106,11 @@ $(SYMTABOBJ): %$(OBJEXT): %.c $(call COMPILE, -fno-lto $<, $@) $(BIN): $(SYMTABOBJ) +ifeq ($(WINTOOL),y) + $(call ARCHIVE, "${shell cygpath -w $(BIN)}", $^) +else $(call ARCHIVE, $(BIN), $^) +endif endif # !CONFIG_BUILD_LOADABLE @@ -157,12 +129,12 @@ import: endif # CONFIG_BUILD_KERNEL dirlinks: - $(Q) $(MAKE) -C platform dirlinks TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BINDIR="$(BINDIR)" + $(Q) $(MAKE) -C platform dirlinks TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context_rest: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_context) context_serialize: - $(Q) $(MAKE) -C builtin context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BINDIR="$(BINDIR)" + $(Q) $(MAKE) -C builtin context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" $(Q) $(MAKE) context_rest TOPDIR="$(TOPDIR)" context: context_serialize @@ -191,7 +163,7 @@ endif depend: .depend clean_context: - $(Q) $(MAKE) -C platform clean_context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BINDIR="$(BINDIR)" + $(Q) $(MAKE) -C platform clean_context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean) $(call DELFILE, $(SYMTABSRC))