apps/: Move the common variable definitions from other build-related files into apps/Make.defs.

This commit is contained in:
Xiang Xiao 2019-10-17 11:40:39 -06:00 committed by Gregory Nutt
parent 7808eb62d2
commit 75cd1dfd74
3 changed files with 47 additions and 48 deletions

View File

@ -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 += :.

View File

@ -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

View File

@ -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))