apps/ make-related fixes. Now builds kernel mode file system

This commit is contained in:
Gregory Nutt 2014-09-06 12:28:30 -06:00
parent 1c279a2c0b
commit b9a650ae8c
4 changed files with 49 additions and 34 deletions

View File

@ -101,11 +101,11 @@ SUBDIRS += $(EXTERNAL_DIR)
# Library path # Library path
LIBPATH ?= $(TOPDIR)/libs LIBPATH ?= $(TOPDIR)$(DELIM)libs
# The install path # The install path
INSTALL_DIR = $(APPDIR)/bin BIN_DIR = $(APPDIR)$(DELIM)bin
# The final build target # The final build target
@ -118,7 +118,7 @@ all: $(BIN)
define SDIR_template define SDIR_template
$(1)_$(2): $(1)_$(2):
$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" INSTALL_DIR="$(INSTALL_DIR)" $(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" BIN_DIR="$(BIN_DIR)"
endef endef
$(foreach SDIR, $(INSTALLED_APPS), $(eval $(call SDIR_template,$(SDIR),all))) $(foreach SDIR, $(INSTALLED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
@ -132,15 +132,15 @@ $(BIN): $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_all)
.install: $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_install) .install: $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_install)
$(INSTALL_DIR): $(BIN_DIR):
mkdir -p $(INSTALL_DIR) mkdir -p $(BIN_DIR)
install: $(INSTALL_DIR) .install install: $(BIN_DIR) .install
.import: $(BIN) install .import: $(BIN) install
import: import:
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)/import" $(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
context: $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_context) context: $(foreach SDIR, $(INSTALLED_APPS), $(SDIR)_context)
@ -171,6 +171,6 @@ else
) )
endif endif
$(call DELFILE, .depend) $(call DELFILE, .depend)
$(call DELDIR, $(INSTALL_DIR)) $(call DELDIR, $(BIN_DIR))

View File

@ -39,36 +39,45 @@ include $(APPDIR)/Make.defs
# Hello, World! built-in application info # Hello, World! built-in application info
APPNAME = hello APPNAME = hello
PRIORITY = SCHED_PRIORITY_DEFAULT PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048 STACKSIZE = 2048
# Hello, World! Example # Hello, World! Example
ASRCS = ASRCS =
CSRCS = hello_main.c CSRCS = hello_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT)) AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS) OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT) BIN = ..\..\libapps$(LIBEXT)
else else
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
BIN = ..\\..\\libapps$(LIBEXT) BIN = ..\\..\\libapps$(LIBEXT)
else else
BIN = ../../libapps$(LIBEXT) BIN = ../../libapps$(LIBEXT)
endif endif
endif endif
ROOTDEPPATH = --dep-path . ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_EXAMPLES_HELLO_PROGNAME ?= hello$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_HELLO_PROGNAME)
ROOTDEPPATH = --dep-path .
# Common build # Common build
VPATH = VPATH =
all: .built all: .built
.PHONY: clean depend distclean .PHONY: clean depend distclean
@ -84,11 +93,11 @@ $(COBJS): %$(OBJEXT): %.c
@touch .built @touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y) ifeq ($(CONFIG_BUILD_KERNEL),y)
$(INSTALL_DIR)/$(PROGNAME): $(OBJS) $(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS)
@echo "LD: $<" @echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(LDLIBS)
install: $(INSTALL_DIR)/$(PROGNAME) install: $(BIN_DIR)/$(PROGNAME)
else else
install: install:

View File

@ -58,6 +58,12 @@ else
endif endif
endif endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_EXAMPLES_NSH_PROGNAME ?= nsh$(EXEEXT) CONFIG_EXAMPLES_NSH_PROGNAME ?= nsh$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_NSH_PROGNAME) PROGNAME = $(CONFIG_EXAMPLES_NSH_PROGNAME)
@ -81,11 +87,11 @@ $(COBJS): %$(OBJEXT): %.c
@touch .built @touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y) ifeq ($(CONFIG_BUILD_KERNEL),y)
$(INSTALL_DIR)/$(PROGNAME): $(OBJS) $(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS)
@echo "LD: $<" @echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS) $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(LDLIBS)
install: $(INSTALL_DIR)/$(PROGNAME) install: $(BIN_DIR)/$(PROGNAME)
else else
install: install:

View File

@ -33,8 +33,8 @@
# #
############################################################################ ############################################################################
include ${TOPDIR}/.config include $(TOPDIR)/.config
include ${TOPDIR}/build/Make.defs include $(TOPDIR)/build/Make.defs
# Control build verbosity # Control build verbosity
# #
@ -183,10 +183,10 @@ AFLAGS = $(CFLAGS) -D__ASSEMBLY__
ifeq ($(WINTOOL),y) ifeq ($(WINTOOL),y)
# Windows-native toolchains # Windows-native toolchains
LDLIBPATH = -L "${shell cygpath -w ${APPDIR}}" -L "${shell cygpath -w $(TOPDIR)$(DELIM)libs}" LDLIBPATH = -L "${shell cygpath -w $(APPDIR)}" -L "${shell cygpath -w $(TOPDIR)$(DELIM)libs}"
else else
# Linux/Cygwin-native toolchain # Linux/Cygwin-native toolchain
LDLIBPATH = -L ${APPDIR} -L $(TOPDIR)$(DELIM)libs LDLIBPATH = -L $(APPDIR) -L $(TOPDIR)$(DELIM)libs
endif endif
LDLIBS = -lnuttx LDLIBS = -lnuttx