2012-11-10 17:06:01 +01:00
|
|
|
############################################################################
|
2012-11-10 17:34:46 +01:00
|
|
|
# libc/Makefile
|
2012-11-10 17:06:01 +01:00
|
|
|
#
|
2017-01-19 16:37:33 +01:00
|
|
|
# Copyright (C) 2007-2014, 2016-2017 Gregory Nutt. All rights reserved.
|
2012-11-10 17:06:01 +01:00
|
|
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
#
|
|
|
|
# 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 NuttX 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.
|
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
-include $(TOPDIR)/Make.defs
|
|
|
|
|
2013-09-29 23:03:10 +02:00
|
|
|
# CFLAGS
|
|
|
|
|
2017-11-15 14:09:16 +01:00
|
|
|
ifneq ($(CONFIG_BUILD_FLAT),y)
|
2014-08-29 22:47:22 +02:00
|
|
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|
|
|
KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__}
|
|
|
|
else
|
|
|
|
KDEFINE = ${shell $(TOPDIR)/tools/define.sh "$(CC)" __KERNEL__}
|
|
|
|
endif
|
|
|
|
endif
|
2013-09-29 23:03:10 +02:00
|
|
|
|
|
|
|
# Sources and paths
|
|
|
|
|
2012-11-10 17:06:01 +01:00
|
|
|
ASRCS =
|
|
|
|
CSRCS =
|
|
|
|
|
|
|
|
DEPPATH := --dep-path .
|
|
|
|
VPATH := .
|
|
|
|
|
2014-10-04 18:31:11 +02:00
|
|
|
include aio/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include audio/Make.defs
|
|
|
|
include dirent/Make.defs
|
2017-01-22 16:14:18 +01:00
|
|
|
include dllfcn/Make.defs
|
2012-11-10 17:06:01 +01:00
|
|
|
include fixedmath/Make.defs
|
2016-06-27 19:22:38 +02:00
|
|
|
include hex2bin/Make.defs
|
2017-02-16 21:54:35 +01:00
|
|
|
include inttypes/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include libgen/Make.defs
|
2016-10-17 17:45:12 +02:00
|
|
|
include locale/Make.defs
|
2017-01-19 16:37:33 +01:00
|
|
|
include machine/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include math/Make.defs
|
|
|
|
include misc/Make.defs
|
2017-01-29 15:55:27 +01:00
|
|
|
include modlib/Make.defs
|
2012-11-10 17:06:01 +01:00
|
|
|
include net/Make.defs
|
2015-07-10 20:11:40 +02:00
|
|
|
include netdb/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include pthread/Make.defs
|
2012-11-10 17:06:01 +01:00
|
|
|
include queue/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include sched/Make.defs
|
|
|
|
include semaphore/Make.defs
|
|
|
|
include signal/Make.defs
|
|
|
|
include spawn/Make.defs
|
|
|
|
include stdio/Make.defs
|
|
|
|
include stdlib/Make.defs
|
|
|
|
include string/Make.defs
|
2015-12-13 15:10:01 +01:00
|
|
|
include symtab/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include syslog/Make.defs
|
|
|
|
include termios/Make.defs
|
|
|
|
include time/Make.defs
|
|
|
|
include tls/Make.defs
|
2017-11-11 18:44:14 +01:00
|
|
|
include uio/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include unistd/Make.defs
|
2017-11-11 18:44:14 +01:00
|
|
|
include userfs/Make.defs
|
2016-10-18 00:02:08 +02:00
|
|
|
include wchar/Make.defs
|
2016-10-19 02:24:58 +02:00
|
|
|
include wctype/Make.defs
|
2013-03-05 19:57:51 +01:00
|
|
|
include wqueue/Make.defs
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2014-02-07 17:14:11 +01:00
|
|
|
# REVISIT: Backslash causes problems in $(COBJS) target
|
|
|
|
DELIM := $(strip /)
|
2013-03-20 00:40:07 +01:00
|
|
|
BINDIR ?= bin
|
|
|
|
|
|
|
|
AOBJS = $(patsubst %.S, $(BINDIR)$(DELIM)%$(OBJEXT), $(ASRCS))
|
|
|
|
COBJS = $(patsubst %.c, $(BINDIR)$(DELIM)%$(OBJEXT), $(CSRCS))
|
2012-11-10 17:06:01 +01:00
|
|
|
|
|
|
|
SRCS = $(ASRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
|
|
|
|
2012-11-10 17:34:46 +01:00
|
|
|
UBIN = libuc$(LIBEXT)
|
|
|
|
KBIN = libkc$(LIBEXT)
|
2013-03-20 00:40:07 +01:00
|
|
|
BIN ?= libc$(LIBEXT)
|
2012-11-10 17:06:01 +01:00
|
|
|
|
|
|
|
all: $(BIN)
|
2013-03-20 00:40:07 +01:00
|
|
|
.PHONY: clean distclean
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
$(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
|
2012-11-10 17:06:01 +01:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2013-11-29 00:47:03 +01:00
|
|
|
$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
$(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
|
2012-11-10 17:06:01 +01:00
|
|
|
$(call COMPILE, $<, $@)
|
2013-11-29 00:47:03 +01:00
|
|
|
$(call MOVEOBJ,$(patsubst $(BINDIR)$(DELIM)%$(OBJEXT),%,$@),$(BINDIR))
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# C library for the flat build
|
|
|
|
|
2012-11-11 01:57:22 +01:00
|
|
|
$(BIN): $(OBJS)
|
2012-11-15 18:43:29 +01:00
|
|
|
$(call ARCHIVE, $@, $(OBJS))
|
2016-07-01 00:20:43 +02:00
|
|
|
ifeq ($(CONFIG_LIB_ZONEINFO_ROMFS),y)
|
|
|
|
$(Q) $(MAKE) -C zoneinfo all TOPDIR=$(TOPDIR) BIN=$(BIN)
|
|
|
|
endif
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# C library for the user phase of the two-pass kernel build
|
|
|
|
|
2012-11-10 17:06:01 +01:00
|
|
|
ifneq ($(BIN),$(UBIN))
|
2013-03-20 00:40:07 +01:00
|
|
|
$(UBIN):
|
|
|
|
$(Q) $(MAKE) $(UBIN) BIN=$(UBIN) BINDIR=ubin TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
|
2012-11-10 17:06:01 +01:00
|
|
|
endif
|
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# C library for the kernel phase of the two-pass kernel build
|
|
|
|
|
2012-11-10 17:06:01 +01:00
|
|
|
ifneq ($(BIN),$(KBIN))
|
2013-03-20 00:40:07 +01:00
|
|
|
$(KBIN):
|
|
|
|
$(Q) $(MAKE) $(KBIN) BIN=$(KBIN) BINDIR=kbin TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
|
2012-11-10 17:06:01 +01:00
|
|
|
endif
|
|
|
|
|
2016-07-01 00:20:43 +02:00
|
|
|
# Context
|
|
|
|
|
|
|
|
context:
|
|
|
|
ifeq ($(CONFIG_LIB_ZONEINFO_ROMFS),y)
|
|
|
|
$(Q) $(MAKE) -C zoneinfo context TOPDIR=$(TOPDIR) BIN=$(BIN)
|
|
|
|
endif
|
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# Dependencies
|
|
|
|
|
2012-11-10 17:06:01 +01:00
|
|
|
.depend: Makefile $(SRCS)
|
2017-11-15 14:09:16 +01:00
|
|
|
ifeq ($(CONFIG_BUILD_FLAT),y)
|
|
|
|
$(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_bin.dep
|
|
|
|
else
|
2013-09-29 19:46:10 +02:00
|
|
|
$(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep
|
2013-09-29 23:03:10 +02:00
|
|
|
$(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep
|
2016-07-01 00:20:43 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(CONFIG_LIB_ZONEINFO_ROMFS),y)
|
|
|
|
$(Q) $(MAKE) -C zoneinfo depend TOPDIR=$(TOPDIR) BIN=$(BIN)
|
2013-09-29 19:46:10 +02:00
|
|
|
endif
|
2012-11-11 19:36:28 +01:00
|
|
|
$(Q) touch $@
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-03-21 22:51:15 +01:00
|
|
|
depend: .depend
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
# Clean most derived files, retaining the configuration
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-03-20 00:40:07 +01:00
|
|
|
clean:
|
|
|
|
$(Q) $(MAKE) -C bin clean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C ubin clean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C kbin clean TOPDIR=$(TOPDIR)
|
2016-07-01 00:20:43 +02:00
|
|
|
$(Q) $(MAKE) -C zoneinfo clean TOPDIR=$(TOPDIR) BIN=$(BIN)
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, $(BIN))
|
|
|
|
$(call DELFILE, $(UBIN))
|
|
|
|
$(call DELFILE, $(KBIN))
|
2012-11-10 17:06:01 +01:00
|
|
|
$(call CLEAN)
|
|
|
|
|
|
|
|
# Deep clean -- removes all traces of the configuration
|
|
|
|
|
|
|
|
distclean: clean
|
2013-03-20 00:40:07 +01:00
|
|
|
$(Q) $(MAKE) -C bin distclean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C ubin distclean TOPDIR=$(TOPDIR)
|
|
|
|
$(Q) $(MAKE) -C kbin distclean TOPDIR=$(TOPDIR)
|
2016-07-01 00:20:43 +02:00
|
|
|
$(Q) $(MAKE) -C zoneinfo distclean TOPDIR=$(TOPDIR) BIN=$(BIN)
|
2013-09-29 19:46:10 +02:00
|
|
|
$(call DELFILE, Make_bin.dep)
|
|
|
|
$(call DELFILE, Make_ubin.dep)
|
|
|
|
$(call DELFILE, Make_kbin.dep)
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, .depend)
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2013-09-29 19:46:10 +02:00
|
|
|
-include Make_bin.dep
|
|
|
|
-include Make_ubin.dep
|
|
|
|
-include Make_kbin.dep
|