|
|
@ -81,7 +81,9 @@ |
|
|
|
# Work out who included us so we can report decent errors
|
|
|
|
# Work out who included us so we can report decent errors
|
|
|
|
#
|
|
|
|
#
|
|
|
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
|
|
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
|
|
|
PARENT_MAKEFILE := $(lastword $(filter-out $(THIS_MAKEFILE),$(MAKEFILE_LIST)))
|
|
|
|
ifeq ($(APP_MAKEFILE),) |
|
|
|
|
|
|
|
APP_MAKEFILE := $(lastword $(filter-out $(THIS_MAKEFILE),$(MAKEFILE_LIST)))
|
|
|
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
############################################################################
|
|
|
|
# Get configuration
|
|
|
|
# Get configuration
|
|
|
@ -93,7 +95,7 @@ include $(APPDIR)/Make.defs |
|
|
|
############################################################################
|
|
|
|
############################################################################
|
|
|
|
# Sanity-check the information we've been given and set any defaults
|
|
|
|
# Sanity-check the information we've been given and set any defaults
|
|
|
|
#
|
|
|
|
#
|
|
|
|
SRCDIR ?= $(dir $(PARENT_MAKEFILE))
|
|
|
|
SRCDIR ?= $(dir $(APP_MAKEFILE))
|
|
|
|
PRIORITY ?= SCHED_PRIORITY_DEFAULT
|
|
|
|
PRIORITY ?= SCHED_PRIORITY_DEFAULT
|
|
|
|
STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT
|
|
|
|
STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT
|
|
|
|
|
|
|
|
|
|
|
@ -112,14 +114,14 @@ endif |
|
|
|
|
|
|
|
|
|
|
|
# there has to be a source file
|
|
|
|
# there has to be a source file
|
|
|
|
ifeq ($(ASRCS)$(CSRCS)$(CXXSRCS),) |
|
|
|
ifeq ($(ASRCS)$(CSRCS)$(CXXSRCS),) |
|
|
|
$(error $(realpath $(PARENT_MAKEFILE)): at least one of ASRCS, CSRCS or CXXSRCS must be set) |
|
|
|
$(error $(realpath $(APP_MAKEFILE)): at least one of ASRCS, CSRCS or CXXSRCS must be set) |
|
|
|
endif |
|
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
# check that C++ is configured if we have C++ source files and we are building
|
|
|
|
# check that C++ is configured if we have C++ source files and we are building
|
|
|
|
ifneq ($(CXXSRCS),) |
|
|
|
ifneq ($(CXXSRCS),) |
|
|
|
ifneq ($(CONFIG_HAVE_CXX),y) |
|
|
|
ifneq ($(CONFIG_HAVE_CXX),y) |
|
|
|
ifeq ($(MAKECMDGOALS),build) |
|
|
|
ifeq ($(MAKECMDGOALS),build) |
|
|
|
$(error $(realpath $(PARENT_MAKEFILE)): cannot set CXXSRCS if CONFIG_HAVE_CXX not set in configuration) |
|
|
|
$(error $(realpath $(APP_MAKEFILE)): cannot set CXXSRCS if CONFIG_HAVE_CXX not set in configuration) |
|
|
|
endif |
|
|
|
endif |
|
|
|
endif |
|
|
|
endif |
|
|
|
endif |
|
|
|
endif |
|
|
@ -153,6 +155,11 @@ COBJS = $(patsubst %.c,%.o,$(CSRCS)) |
|
|
|
CXXOBJS = $(patsubst %.cpp,%.o,$(CXXSRCS))
|
|
|
|
CXXOBJS = $(patsubst %.cpp,%.o,$(CXXSRCS))
|
|
|
|
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Automatic depdendency generation
|
|
|
|
|
|
|
|
DEPS = $(OBJS:$(OBJEXT)=.d)
|
|
|
|
|
|
|
|
CFLAGS += -MD
|
|
|
|
|
|
|
|
CXXFLAGS += -MD
|
|
|
|
|
|
|
|
|
|
|
|
# The prelinked object that we are ultimately going to build
|
|
|
|
# The prelinked object that we are ultimately going to build
|
|
|
|
ifneq ($(APPNAME),) |
|
|
|
ifneq ($(APPNAME),) |
|
|
|
PRELINKOBJ = $(APPNAME).pre.o
|
|
|
|
PRELINKOBJ = $(APPNAME).pre.o
|
|
|
@ -186,11 +193,8 @@ all: .built |
|
|
|
#
|
|
|
|
#
|
|
|
|
# Source dependencies
|
|
|
|
# Source dependencies
|
|
|
|
#
|
|
|
|
#
|
|
|
|
depend: .depend |
|
|
|
depend: |
|
|
|
.depend: $(MAKEFILE_LIST) $(SRCS) |
|
|
|
@exit 0
|
|
|
|
@$(MKDEP) --dep-path . $(CC) -- $(CFLAGS) -- $(CSRCS) $(CHDRS) >Make.dep
|
|
|
|
|
|
|
|
@$(MKDEP) --dep-path . $(CXX) -- $(CXXFLAGS) -- $(CXXSRCS) $(CXXHDRS) >>Make.dep
|
|
|
|
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifneq ($(APPNAME),) |
|
|
|
ifneq ($(APPNAME),) |
|
|
|
#
|
|
|
|
#
|
|
|
@ -223,10 +227,10 @@ $(CXXOBJS): %.o : %.cpp |
|
|
|
# Tidying up
|
|
|
|
# Tidying up
|
|
|
|
#
|
|
|
|
#
|
|
|
|
clean: |
|
|
|
clean: |
|
|
|
@rm -f $(OBJS) $(PRELINKOBJ) Make.dep .built
|
|
|
|
@rm -f $(OBJS) $(DEPS) $(PRELINKOBJ) .built
|
|
|
|
$(call CLEAN)
|
|
|
|
$(call CLEAN)
|
|
|
|
|
|
|
|
|
|
|
|
distclean: clean |
|
|
|
distclean: clean |
|
|
|
@rm -f Make.dep .depend
|
|
|
|
@rm -f Make.dep .depend
|
|
|
|
|
|
|
|
|
|
|
|
-include Make.dep |
|
|
|
-include $(DEPS) |
|
|
|