2008-01-08 08:19:24 +08:00
|
|
|
############################################################################
|
|
|
|
# mm/Makefile
|
2007-02-18 07:21:28 +08:00
|
|
|
#
|
2017-11-15 21:09:16 +08:00
|
|
|
# Copyright (C) 2007, 2012, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
2012-07-15 07:31:12 +08:00
|
|
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
2007-02-18 07:21:28 +08:00
|
|
|
#
|
|
|
|
# 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.
|
2008-01-08 08:19:24 +08:00
|
|
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
2007-02-18 07:21:28 +08:00
|
|
|
# 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.
|
|
|
|
#
|
2008-01-08 08:19:24 +08:00
|
|
|
############################################################################
|
2007-02-18 07:21:28 +08:00
|
|
|
|
|
|
|
-include $(TOPDIR)/Make.defs
|
|
|
|
|
2014-02-08 00:14:11 +08:00
|
|
|
# REVISIT: Backslash causes problems in $(COBJS) target
|
|
|
|
DELIM := $(strip /)
|
|
|
|
|
2013-09-30 05:03:10 +08:00
|
|
|
# CFLAGS
|
|
|
|
|
2017-11-15 21:09:16 +08:00
|
|
|
ifneq ($(CONFIG_BUILD_FLAT),y)
|
2018-05-13 17:22:25 +08:00
|
|
|
KDEFINE = ${shell $(DEFINE) "$(CC)" __KERNEL__}
|
2013-09-30 05:03:10 +08:00
|
|
|
endif
|
|
|
|
|
2014-09-23 00:33:23 +08:00
|
|
|
# Sources and paths
|
2013-03-10 05:12:20 +08:00
|
|
|
|
2014-04-14 04:32:20 +08:00
|
|
|
ASRCS =
|
2014-09-23 00:33:23 +08:00
|
|
|
CSRCS =
|
|
|
|
|
|
|
|
DEPPATH = --dep-path .
|
|
|
|
VPATH = .
|
|
|
|
|
2014-09-23 00:53:50 +08:00
|
|
|
include mm_heap/Make.defs
|
2014-09-23 00:48:58 +08:00
|
|
|
include umm_heap/Make.defs
|
2014-09-23 00:42:26 +08:00
|
|
|
include kmm_heap/Make.defs
|
2014-09-23 00:33:23 +08:00
|
|
|
include mm_gran/Make.defs
|
2014-09-23 00:58:27 +08:00
|
|
|
include shm/Make.defs
|
2017-05-09 21:34:59 +08:00
|
|
|
include iob/Make.defs
|
2012-09-12 04:33:58 +08:00
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
BINDIR ?= bin
|
|
|
|
|
|
|
|
AOBJS = $(patsubst %.S, $(BINDIR)$(DELIM)%$(OBJEXT), $(ASRCS))
|
|
|
|
COBJS = $(patsubst %.c, $(BINDIR)$(DELIM)%$(OBJEXT), $(CSRCS))
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-09 06:01:50 +08:00
|
|
|
SRCS = $(ASRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-09 06:01:50 +08:00
|
|
|
UBIN = libumm$(LIBEXT)
|
|
|
|
KBIN = libkmm$(LIBEXT)
|
2013-03-20 07:40:07 +08:00
|
|
|
BIN ?= libmm$(LIBEXT)
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
all: $(BIN)
|
2014-04-14 04:32:20 +08:00
|
|
|
.PHONY: clean distclean
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
$(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
|
2008-01-09 01:06:21 +08:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
$(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
|
2008-01-09 01:06:21 +08:00
|
|
|
$(call COMPILE, $<, $@)
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
# Memory manager for the flat build
|
|
|
|
|
2007-02-18 07:21:28 +08:00
|
|
|
$(BIN): $(OBJS)
|
2012-11-16 01:43:29 +08:00
|
|
|
$(call ARCHIVE, $@, $(OBJS))
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
# Memory manager for the user phase of the two-pass kernel build
|
|
|
|
|
2013-03-09 06:01:50 +08:00
|
|
|
ifneq ($(BIN),$(UBIN))
|
2013-03-20 07:40:07 +08:00
|
|
|
$(UBIN):
|
2020-04-10 10:37:54 +08:00
|
|
|
$(Q) $(MAKE) $(UBIN) BIN=$(UBIN) BINDIR=ubin TOPDIR=$(TOPDIR) EXTRAFLAGS="$(EXTRAFLAGS)"
|
2013-03-09 06:01:50 +08:00
|
|
|
endif
|
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
# Memory manager for the kernel phase of the two-pass kernel build
|
|
|
|
|
2013-03-09 06:01:50 +08:00
|
|
|
ifneq ($(BIN),$(KBIN))
|
2013-03-20 07:40:07 +08:00
|
|
|
$(KBIN):
|
2020-04-10 10:37:54 +08:00
|
|
|
$(Q) $(MAKE) $(KBIN) BIN=$(KBIN) BINDIR=kbin TOPDIR=$(TOPDIR) EXTRAFLAGS="$(EXTRAFLAGS)"
|
2013-03-09 06:01:50 +08:00
|
|
|
endif
|
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
# Dependencies
|
|
|
|
|
2007-02-18 07:21:28 +08:00
|
|
|
.depend: Makefile $(SRCS)
|
2017-11-15 21:09:16 +08:00
|
|
|
ifeq ($(CONFIG_BUILD_FLAT),y)
|
2020-01-21 22:01:09 +08:00
|
|
|
$(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >bin/Make.dep
|
2017-11-15 21:09:16 +08:00
|
|
|
else
|
2020-01-21 22:01:09 +08:00
|
|
|
$(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >ubin/Make.dep
|
|
|
|
$(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >kbin/Make.dep
|
2013-09-30 01:46:10 +08:00
|
|
|
endif
|
2012-11-12 02:36:28 +08:00
|
|
|
$(Q) touch $@
|
2007-02-18 07:21:28 +08:00
|
|
|
|
|
|
|
depend: .depend
|
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
# Clean most derived files, retaining the configuration
|
2013-03-09 06:01:50 +08:00
|
|
|
|
2007-02-18 07:21:28 +08:00
|
|
|
clean:
|
2013-03-20 07:40:07 +08:00
|
|
|
$(Q) $(MAKE) -C bin clean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C ubin clean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C kbin clean TOPDIR=$(TOPDIR)
|
2012-11-20 23:47:41 +08:00
|
|
|
$(call DELFILE, $(BIN))
|
2013-03-09 06:01:50 +08:00
|
|
|
$(call DELFILE, $(UBIN))
|
|
|
|
$(call DELFILE, $(KBIN))
|
2008-01-11 02:23:08 +08:00
|
|
|
$(call CLEAN)
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-03-20 07:40:07 +08:00
|
|
|
# Deep clean -- removes all traces of the configuration
|
|
|
|
|
2007-02-18 07:21:28 +08:00
|
|
|
distclean: clean
|
2013-03-20 07:40:07 +08:00
|
|
|
$(Q) $(MAKE) -C bin distclean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C ubin distclean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C kbin distclean TOPDIR=$(TOPDIR)
|
2019-03-20 00:14:50 +08:00
|
|
|
$(call DELFILE, bin/Make.dep)
|
|
|
|
$(call DELFILE, ubin/Make.dep)
|
|
|
|
$(call DELFILE, kbin/Make.dep)
|
2012-11-20 23:47:41 +08:00
|
|
|
$(call DELFILE, .depend)
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2019-03-20 00:14:50 +08:00
|
|
|
-include bin/Make.dep
|
|
|
|
-include ubin/Make.dep
|
|
|
|
-include kbin/Make.dep
|