2007-02-18 00:21:28 +01:00
|
|
|
############################################################
|
|
|
|
# Makefile
|
|
|
|
#
|
|
|
|
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
|
|
|
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
|
|
|
# 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
|
|
|
# used to endorse or promote products derived from this software
|
|
|
|
# without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
TOPDIR = ${shell pwd}
|
|
|
|
-include ${TOPDIR}/.config
|
|
|
|
-include ${TOPDIR}/Make.defs
|
|
|
|
|
|
|
|
ARCH_DIR = arch/$(CONFIG_ARCH)
|
|
|
|
ARCH_SRC = $(ARCH_DIR)/src
|
|
|
|
|
|
|
|
SUBDIRS = sched lib $(ARCH_SRC) mm fs drivers examples/$(CONFIG_EXAMPLE)
|
|
|
|
|
2007-02-28 00:59:20 +01:00
|
|
|
LINKLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) mm/libmm$(LIBEXT) \
|
2007-02-21 22:55:16 +01:00
|
|
|
fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) lib/liblib$(LIBEXT) \
|
|
|
|
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-03-01 00:45:56 +01:00
|
|
|
BIN = nuttx$(EXEEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
all: $(BIN)
|
|
|
|
.PHONY: clean context clean_context distclean
|
|
|
|
|
|
|
|
tools/mkconfig:
|
|
|
|
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) mkconfig
|
|
|
|
|
|
|
|
include/nuttx/config.h: $(ARCH_DIR)/defconfig tools/mkconfig
|
|
|
|
tools/mkconfig $(ARCH_DIR) > include/nuttx/config.h
|
|
|
|
|
|
|
|
include/arch: include/nuttx/config.h
|
|
|
|
ln -sf $(TOPDIR)/$(ARCH_DIR)/include include/arch
|
|
|
|
|
|
|
|
context: check_context include/nuttx/config.h include/arch
|
|
|
|
|
|
|
|
clean_context:
|
|
|
|
rm -f include/nuttx/config.h
|
|
|
|
rm -f include/arch
|
|
|
|
|
|
|
|
check_context:
|
|
|
|
@if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \
|
|
|
|
echo "" ; echo "Nuttx has not been configured:" ; \
|
|
|
|
echo " cd tools; ./configure.sh <target>\n" ; echo "" ;\
|
|
|
|
exit 1 ; \
|
|
|
|
fi
|
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
sched/libsched$(LIBEXT): context
|
|
|
|
$(MAKE) -C sched TOPDIR=$(TOPDIR) libsched$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
lib/liblib$(LIBEXT): context
|
|
|
|
$(MAKE) -C lib TOPDIR=$(TOPDIR) liblib$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
$(ARCH_SRC)/libarch$(LIBEXT): context
|
|
|
|
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) libarch$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
mm/libmm$(LIBEXT): context
|
|
|
|
$(MAKE) -C mm TOPDIR=$(TOPDIR) libmm$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
fs/libfs$(LIBEXT): context
|
|
|
|
$(MAKE) -C fs TOPDIR=$(TOPDIR) libfs$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
drivers/libdrivers$(LIBEXT): context
|
|
|
|
$(MAKE) -C drivers TOPDIR=$(TOPDIR) libdrivers$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT): context
|
|
|
|
$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) lib$(CONFIG_EXAMPLE)$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-03-01 00:45:56 +01:00
|
|
|
$(BIN): context depend $(LINKLIBS)
|
|
|
|
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKLIBS="$(LINKLIBS)" $(BIN)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
depend:
|
|
|
|
@for dir in $(SUBDIRS) ; do \
|
|
|
|
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@for dir in $(SUBDIRS) ; do \
|
|
|
|
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \
|
|
|
|
done
|
|
|
|
$(MAKE) -C tools -f Makefile.mkconfig TOPDIR=$(TOPDIR) clean
|
|
|
|
$(MAKE) -C mm -f Makefile.test TOPDIR=$(TOPDIR) clean
|
2007-03-01 22:05:55 +01:00
|
|
|
rm -f $(BIN) $(BIN).* mm_test *.map *~
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
distclean: clean clean_context
|
|
|
|
@for dir in $(SUBDIRS) ; do \
|
|
|
|
$(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \
|
|
|
|
done
|
|
|
|
$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) distclean
|
|
|
|
rm -f Make.defs setenv.sh .config
|
|
|
|
|
|
|
|
|