apps/: Modification to build system: Unified application compilation rules

This commit is contained in:
anchao 2018-09-03 09:29:56 -06:00 committed by Gregory Nutt
parent 3e396d8e4e
commit b5cfd93444
606 changed files with 1208 additions and 9232 deletions

View file

@ -4,7 +4,7 @@
#
menuconfig SYSTEM_STACKMONITOR
bool "Stack Monitor"
tristate "Stack Monitor"
default n
depends on FS_PROCFS && !_FS_PROCFS_EXCLUDE_PROCESS && STACK_COLORATION
---help---

View file

@ -34,7 +34,7 @@
#
############################################################################
ifeq ($(CONFIG_SYSTEM_STACKMONITOR),y)
ifneq ($(CONFIG_SYSTEM_STACKMONITOR),)
CONFIGURED_APPS += system/stackmonitor
endif

View file

@ -33,113 +33,20 @@
#
############################################################################
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# Stack Monitor Application
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048
ASRCS =
CSRCS =
MAINSRC = stackmonitor.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifneq ($(CONFIG_BUILD_LOADABLE),y)
OBJS += $(MAINOBJ)
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT)
else
BIN = ../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_XYZ_PROGNAME ?= ramtest$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
ROOTDEPPATH = --dep-path .
APPNAME = stackmonitor_start stackmonitor_stop
# Common build
MODULE = CONFIG_SYSTEM_STACKMONITOR
VPATH =
all: .built
.PHONY: context depend clean distclean preconfig
.PRECIOUS: ../../libapps$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
$(Q) touch .built
ifeq ($(CONFIG_BUILD_LOADABLE),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
else
install:
endif
# Register application
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)stackmonitor_start.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,"stkmon_start",$(PRIORITY),$(STACKSIZE),$(if $(CONFIG_BUILD_LOADABLE),,stackmonitor_start))
$(BUILTIN_REGISTRY)$(DELIM)stackmonitor_stop.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,"stkmon_stop",$(PRIORITY),$(STACKSIZE),$(if $(CONFIG_BUILD_LOADABLE),,stackmonitor_stop))
context: $(BUILTIN_REGISTRY)$(DELIM)stackmonitor_start.bdat $(BUILTIN_REGISTRY)$(DELIM)stackmonitor_stop.bdat
else
context:
endif
# Create dependencies
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
preconfig:
-include Make.dep
include $(APPDIR)/Application.mk

View file

@ -418,7 +418,7 @@ static int stackmonitor_daemon(int argc, char **argv)
* Public Functions
****************************************************************************/
int stackmonitor_start(int argc, char **argv)
int stackmonitor_start_main(int argc, char **argv)
{
/* Has the monitor already started? */
@ -459,7 +459,7 @@ int stackmonitor_start(int argc, char **argv)
return 0;
}
int stackmonitor_stop(int argc, char **argv)
int stackmonitor_stop_main(int argc, char **argv)
{
/* Has the monitor already started? */