2012-11-10 17:06:01 +01:00
|
|
|
############################################################################
|
2018-05-29 21:21:26 +02:00
|
|
|
# libs/libc/Makefile
|
2012-11-10 17:06:01 +01:00
|
|
|
#
|
2020-05-07 22:15:09 +02: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
|
2012-11-10 17:06:01 +01:00
|
|
|
#
|
2020-05-07 22:15:09 +02:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2012-11-10 17:06:01 +01:00
|
|
|
#
|
2020-05-07 22:15:09 +02: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.
|
2012-11-10 17:06:01 +01:00
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
2020-05-18 21:42:11 +02:00
|
|
|
include $(TOPDIR)/Make.defs
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2014-10-04 18:31:11 +02:00
|
|
|
include aio/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include audio/Make.defs
|
2019-08-23 17:07:40 +02:00
|
|
|
include builtin/Make.defs
|
2016-03-11 14:17:32 +01:00
|
|
|
include dirent/Make.defs
|
2019-02-09 21:09:28 +01:00
|
|
|
include dlfcn/Make.defs
|
2018-08-19 15:44:04 +02:00
|
|
|
include endian/Make.defs
|
2020-05-07 22:15:09 +02:00
|
|
|
include errno/Make.defs
|
2012-11-10 17:06:01 +01:00
|
|
|
include fixedmath/Make.defs
|
2019-08-03 16:23:04 +02:00
|
|
|
include grp/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
|
2018-03-14 21:48:53 +01:00
|
|
|
include lzf/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
|
2019-08-04 15:18:58 +02:00
|
|
|
include pwd/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
|
|
|
|
2019-09-28 19:14:48 +02:00
|
|
|
# Rule for the symbol table generation
|
|
|
|
|
|
|
|
MKSYMTAB = $(TOPDIR)$(DELIM)tools$(DELIM)mksymtab$(HOSTEXEEXT)
|
|
|
|
|
|
|
|
$(MKSYMTAB):
|
|
|
|
$(Q) $(MAKE) -C $(TOPDIR)$(DELIM)tools -f Makefile.host mksymtab
|
|
|
|
|
|
|
|
# C library and math library symbols should be available in the FLAT
|
|
|
|
# and PROTECTED builds. KERNEL builds are separately linked and so should
|
|
|
|
# not need symbol tables.
|
|
|
|
|
|
|
|
CSVFILES = $(TOPDIR)$(DELIM)libs$(DELIM)libc$(DELIM)libc.csv
|
|
|
|
CSVFILES += $(TOPDIR)$(DELIM)libs$(DELIM)libc$(DELIM)math.csv
|
|
|
|
|
|
|
|
# In the PROTECTED and KERNEL builds, the applications could link with
|
|
|
|
# libproxy which will provide symbol-compatible access to OS functions
|
|
|
|
# via a call gate, but the applications which link with these functions
|
|
|
|
# directly could remove the repeat proxy code to save the space.
|
|
|
|
|
|
|
|
CSVFILES += $(TOPDIR)$(DELIM)syscall$(DELIM)syscall.csv
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EXECFUNCS_SYSTEM_SYMTAB),y)
|
|
|
|
|
|
|
|
exec_symtab.c : $(CSVFILES) $(MKSYMTAB)
|
|
|
|
$(Q) cat $(CSVFILES) | LC_ALL=C sort >$@.csv
|
|
|
|
$(Q) $(MKSYMTAB) $@.csv $@ $(CONFIG_EXECFUNCS_SYMTAB_ARRAY) $(CONFIG_EXECFUNCS_NSYMBOLS_VAR)
|
|
|
|
$(Q) rm -f $@.csv
|
|
|
|
|
|
|
|
CSRCS += exec_symtab.c
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2019-09-28 19:17:01 +02:00
|
|
|
ifeq ($(CONFIG_MODLIB_SYSTEM_SYMTAB),y)
|
|
|
|
|
2020-04-03 17:49:08 +02:00
|
|
|
modlib_sys_symtab.c : $(CSVFILES) $(MKSYMTAB)
|
2019-09-28 19:17:01 +02:00
|
|
|
$(Q) cat $(CSVFILES) | LC_ALL=C sort >$@.csv
|
|
|
|
$(Q) $(MKSYMTAB) $@.csv $@ $(CONFIG_MODLIB_SYMTAB_ARRAY) $(CONFIG_MODLIB_NSYMBOLS_VAR)
|
|
|
|
$(Q) rm -f $@.csv
|
|
|
|
|
2020-04-03 17:49:08 +02:00
|
|
|
CSRCS += modlib_sys_symtab.c
|
2019-09-28 19:17:01 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
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
|
|
|
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-03-20 00:40:07 +01:00
|
|
|
$(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
|
2012-11-10 17:06:01 +01:00
|
|
|
$(call COMPILE, $<, $@)
|
|
|
|
|
2020-05-01 21:23:04 +02:00
|
|
|
# C library for the flat build and
|
|
|
|
# the user phase of the two-pass kernel build
|
2013-03-20 00:40:07 +01:00
|
|
|
|
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 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):
|
2020-04-10 04:37:54 +02:00
|
|
|
$(Q) $(MAKE) $(KBIN) BIN=$(KBIN) BINDIR=kbin TOPDIR=$(TOPDIR) EXTRAFLAGS="$(EXTRAFLAGS)"
|
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)
|
2020-01-21 15:01:09 +01:00
|
|
|
$(Q) $(MKDEP) --obj-path bin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >bin/Make.dep
|
2020-05-01 21:23:04 +02:00
|
|
|
ifneq ($(CONFIG_BUILD_FLAT),y)
|
2020-01-21 15:01:09 +01:00
|
|
|
$(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >kbin/Make.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 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, $(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 kbin distclean TOPDIR=$(TOPDIR)
|
2016-07-01 00:20:43 +02:00
|
|
|
$(Q) $(MAKE) -C zoneinfo distclean TOPDIR=$(TOPDIR) BIN=$(BIN)
|
2020-05-01 03:51:56 +02:00
|
|
|
$(call DELFILE, exec_symtab.c)
|
2019-03-19 17:14:50 +01:00
|
|
|
$(call DELFILE, bin/Make.dep)
|
|
|
|
$(call DELFILE, kbin/Make.dep)
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, .depend)
|
2012-11-10 17:06:01 +01:00
|
|
|
|
2019-03-19 17:14:50 +01:00
|
|
|
-include bin/Make.dep
|
|
|
|
-include kbin/Make.dep
|