2008-01-08 01:19:24 +01:00
|
|
|
############################################################################
|
|
|
|
# mm/Makefile
|
2007-02-18 00:21:28 +01:00
|
|
|
#
|
2021-02-08 13:50:10 +01:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
2007-02-18 00:21:28 +01:00
|
|
|
#
|
2021-02-08 13:50:10 +01:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-18 00:21:28 +01:00
|
|
|
#
|
2021-02-08 13:50:10 +01:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2007-02-18 00:21:28 +01:00
|
|
|
#
|
2008-01-08 01:19:24 +01:00
|
|
|
############################################################################
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2020-05-18 21:42:11 +02:00
|
|
|
include $(TOPDIR)/Make.defs
|
2014-02-07 17:14:11 +01:00
|
|
|
|
2014-09-22 18:33:23 +02:00
|
|
|
# Sources and paths
|
2013-03-09 22:12:20 +01:00
|
|
|
|
2014-09-22 18:53:50 +02:00
|
|
|
include mm_heap/Make.defs
|
2014-09-22 18:48:58 +02:00
|
|
|
include umm_heap/Make.defs
|
2014-09-22 18:42:26 +02:00
|
|
|
include kmm_heap/Make.defs
|
2014-09-22 18:33:23 +02:00
|
|
|
include mm_gran/Make.defs
|
2014-09-22 18:58:27 +02:00
|
|
|
include shm/Make.defs
|
2017-05-09 15:34:59 +02:00
|
|
|
include iob/Make.defs
|
2020-11-12 11:40:06 +01:00
|
|
|
include circbuf/Make.defs
|
2022-07-20 15:37:26 +02:00
|
|
|
include mempool/Make.defs
|
2021-10-09 09:22:28 +02:00
|
|
|
include kasan/Make.defs
|
2022-08-19 10:09:59 +02:00
|
|
|
include ubsan/Make.defs
|
2021-03-08 10:21:23 +01:00
|
|
|
include tlsf/Make.defs
|
2022-04-07 14:17:21 +02:00
|
|
|
include map/Make.defs
|
2012-09-11 22:33:58 +02:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
BINDIR ?= bin
|
|
|
|
|
2023-04-23 15:37:52 +02:00
|
|
|
# Use double delim to fix windows native build and give an error:
|
|
|
|
# makefile:132: *** target mode do not include“%”. stop.
|
|
|
|
#
|
|
|
|
# In Windows environment DELIM := $(strip \) but \ has two role:
|
|
|
|
# first: \ as directory, and second \ as Escape character, Reference:
|
|
|
|
#
|
|
|
|
# https://github.com/apache/nuttx/pull/7572#discussion_r1028219229
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|
|
|
DELIMS = $(DELIM)$(DELIM)
|
|
|
|
else
|
|
|
|
DELIMS = $(DELIM)
|
|
|
|
endif
|
|
|
|
|
2022-11-01 14:47:53 +01:00
|
|
|
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)mm
|
2020-05-19 11:43:29 +02:00
|
|
|
|
2023-04-23 15:37:52 +02:00
|
|
|
AOBJS = $(patsubst %.S, $(BINDIR)$(DELIMS)%$(OBJEXT), $(ASRCS))
|
|
|
|
COBJS = $(patsubst %.c, $(BINDIR)$(DELIMS)%$(OBJEXT), $(CSRCS))
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2013-03-08 23:01:50 +01:00
|
|
|
SRCS = $(ASRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2013-03-08 23:01:50 +01:00
|
|
|
KBIN = libkmm$(LIBEXT)
|
2013-03-20 00:40:07 +01:00
|
|
|
BIN ?= libmm$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
all: $(BIN)
|
2021-03-08 10:21:23 +01:00
|
|
|
.PHONY: context depend clean distclean
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2023-04-23 15:37:52 +02:00
|
|
|
$(AOBJS): $(BINDIR)$(DELIMS)%$(OBJEXT): %.S
|
2023-02-01 09:46:00 +01:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2022-11-10 14:04:59 +01:00
|
|
|
# REVISIT: Backslash causes problems in $(COBJS) target
|
|
|
|
|
2023-04-23 15:37:52 +02:00
|
|
|
$(COBJS): $(BINDIR)$(DELIMS)%$(OBJEXT): %.c
|
2023-02-01 09:46:00 +01:00
|
|
|
$(call COMPILE, $<, $@)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2020-05-01 21:23:04 +02:00
|
|
|
# Memory manager for the flat build and
|
|
|
|
# the user phase of the two-pass kernel build
|
2013-03-20 00:40:07 +01:00
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
$(BIN): $(OBJS)
|
2023-02-01 09:46:00 +01:00
|
|
|
$(call ARCHIVE, $@, $(OBJS))
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# Memory manager for the kernel phase of the two-pass kernel build
|
|
|
|
|
2013-03-08 23:01:50 +01:00
|
|
|
ifneq ($(BIN),$(KBIN))
|
2022-05-23 21:43:05 +02:00
|
|
|
$(KBIN): $(OBJS)
|
|
|
|
$(Q) $(MAKE) $(KBIN) BIN=$(KBIN) EXTRAFLAGS="$(EXTRAFLAGS)"
|
2013-03-08 23:01:50 +01:00
|
|
|
endif
|
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# Dependencies
|
|
|
|
|
2021-03-08 10:21:23 +01:00
|
|
|
context::
|
|
|
|
|
2020-11-18 17:44:58 +01:00
|
|
|
makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds)
|
|
|
|
$(call CATFILE, bin/Make.dep, $^)
|
|
|
|
$(call DELFILE, $^)
|
2020-11-28 04:43:30 +01:00
|
|
|
|
2020-11-18 17:44:58 +01:00
|
|
|
makekdepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds)
|
|
|
|
$(call CATFILE, kbin/Make.dep, $^)
|
|
|
|
$(call DELFILE, $^)
|
|
|
|
|
2020-07-22 09:54:29 +02:00
|
|
|
.depend: Makefile $(SRCS) $(TOPDIR)$(DELIM).config
|
2020-11-28 14:42:54 +01:00
|
|
|
$(Q) $(MAKE) makedepfile OBJPATH="bin"
|
2020-05-01 21:23:04 +02:00
|
|
|
ifneq ($(CONFIG_BUILD_FLAT),y)
|
2020-11-28 14:42:54 +01:00
|
|
|
$(Q) $(MAKE) makekdepfile CFLAGS="$(CFLAGS) $(KDEFINE)" OBJPATH="kbin"
|
2013-09-29 19:46:10 +02:00
|
|
|
endif
|
2012-11-11 19:36:28 +01:00
|
|
|
$(Q) touch $@
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
depend: .depend
|
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# Clean most derived files, retaining the configuration
|
2013-03-08 23:01:50 +01:00
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
clean:
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) $(MAKE) -C bin clean
|
|
|
|
$(Q) $(MAKE) -C kbin clean
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, $(BIN))
|
2013-03-08 23:01:50 +01:00
|
|
|
$(call DELFILE, $(KBIN))
|
2008-01-10 19:23:08 +01:00
|
|
|
$(call CLEAN)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# Deep clean -- removes all traces of the configuration
|
|
|
|
|
2021-03-08 10:21:23 +01:00
|
|
|
distclean:: clean
|
2020-09-14 18:53:37 +02:00
|
|
|
$(Q) $(MAKE) -C bin distclean
|
|
|
|
$(Q) $(MAKE) -C kbin distclean
|
2022-11-10 14:04:59 +01:00
|
|
|
$(call DELFILE, bin$(DELIM)Make.dep)
|
|
|
|
$(call DELFILE, kbin$(DELIM)Make.dep)
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, .depend)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2022-11-10 14:04:59 +01:00
|
|
|
-include bin$(DELIM)Make.dep
|
|
|
|
-include kbin$(DELIM)Make.dep
|