2012-11-10 16:06:01 +00:00
|
|
|
############################################################################
|
2018-05-29 13:21:26 -06:00
|
|
|
# libs/libc/Makefile
|
2012-11-10 16:06:01 +00:00
|
|
|
#
|
2020-05-07 14:15:09 -06: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 16:06:01 +00:00
|
|
|
#
|
2020-05-07 14:15:09 -06:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2012-11-10 16:06:01 +00:00
|
|
|
#
|
2020-05-07 14:15:09 -06: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 16:06:01 +00:00
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
2020-05-19 03:42:11 +08:00
|
|
|
include $(TOPDIR)/Make.defs
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2014-10-04 10:31:11 -06:00
|
|
|
include aio/Make.defs
|
2020-06-07 14:51:54 +08:00
|
|
|
include assert/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include audio/Make.defs
|
2019-08-23 09:07:40 -06:00
|
|
|
include builtin/Make.defs
|
2020-06-26 14:40:13 +08:00
|
|
|
include ctype/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include dirent/Make.defs
|
2019-02-09 14:09:28 -06:00
|
|
|
include dlfcn/Make.defs
|
2018-08-19 07:44:04 -06:00
|
|
|
include endian/Make.defs
|
2020-05-07 14:15:09 -06:00
|
|
|
include errno/Make.defs
|
2020-07-28 13:08:48 +02:00
|
|
|
include eventfd/Make.defs
|
2012-11-10 16:06:01 +00:00
|
|
|
include fixedmath/Make.defs
|
2019-08-03 08:23:04 -06:00
|
|
|
include grp/Make.defs
|
2016-06-27 11:22:38 -06:00
|
|
|
include hex2bin/Make.defs
|
2017-02-16 14:54:35 -06:00
|
|
|
include inttypes/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include libgen/Make.defs
|
2016-10-17 09:45:12 -06:00
|
|
|
include locale/Make.defs
|
2018-03-14 14:48:53 -06:00
|
|
|
include lzf/Make.defs
|
2017-01-19 09:37:33 -06:00
|
|
|
include machine/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include math/Make.defs
|
|
|
|
include misc/Make.defs
|
2017-01-29 08:55:27 -06:00
|
|
|
include modlib/Make.defs
|
2012-11-10 16:06:01 +00:00
|
|
|
include net/Make.defs
|
2015-07-10 12:11:40 -06:00
|
|
|
include netdb/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include pthread/Make.defs
|
2019-08-04 07:18:58 -06:00
|
|
|
include pwd/Make.defs
|
2012-11-10 16:06:01 +00:00
|
|
|
include queue/Make.defs
|
2016-03-11 07:17:32 -06: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
|
2021-12-13 21:28:23 +08:00
|
|
|
include stream/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include string/Make.defs
|
2015-12-13 08:10:01 -06:00
|
|
|
include symtab/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include syslog/Make.defs
|
|
|
|
include termios/Make.defs
|
|
|
|
include time/Make.defs
|
|
|
|
include tls/Make.defs
|
2017-11-11 11:44:14 -06:00
|
|
|
include uio/Make.defs
|
2016-03-11 07:17:32 -06:00
|
|
|
include unistd/Make.defs
|
2017-11-11 11:44:14 -06:00
|
|
|
include userfs/Make.defs
|
2020-07-21 14:54:28 +08:00
|
|
|
include uuid/Make.defs
|
2016-10-17 16:02:08 -06:00
|
|
|
include wchar/Make.defs
|
2016-10-18 18:24:58 -06:00
|
|
|
include wctype/Make.defs
|
2013-03-05 18:57:51 +00:00
|
|
|
include wqueue/Make.defs
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2020-05-19 17:43:29 +08:00
|
|
|
CFLAGS += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)libs$(DELIM)libc}
|
|
|
|
|
2019-09-28 11:14:48 -06: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 11:17:01 -06:00
|
|
|
ifeq ($(CONFIG_MODLIB_SYSTEM_SYMTAB),y)
|
|
|
|
|
2020-04-04 00:49:08 +09:00
|
|
|
modlib_sys_symtab.c : $(CSVFILES) $(MKSYMTAB)
|
2019-09-28 11:17:01 -06: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-04 00:49:08 +09:00
|
|
|
CSRCS += modlib_sys_symtab.c
|
2019-09-28 11:17:01 -06:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2013-03-19 23:40:07 +00:00
|
|
|
BINDIR ?= bin
|
|
|
|
|
|
|
|
AOBJS = $(patsubst %.S, $(BINDIR)$(DELIM)%$(OBJEXT), $(ASRCS))
|
|
|
|
COBJS = $(patsubst %.c, $(BINDIR)$(DELIM)%$(OBJEXT), $(CSRCS))
|
2012-11-10 16:06:01 +00:00
|
|
|
|
|
|
|
SRCS = $(ASRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
|
|
|
|
2012-11-10 16:34:46 +00:00
|
|
|
KBIN = libkc$(LIBEXT)
|
2013-03-19 23:40:07 +00:00
|
|
|
BIN ?= libc$(LIBEXT)
|
2012-11-10 16:06:01 +00:00
|
|
|
|
|
|
|
all: $(BIN)
|
2013-03-19 23:40:07 +00:00
|
|
|
.PHONY: clean distclean
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2013-03-19 23:40:07 +00:00
|
|
|
$(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S
|
2012-11-10 16:06:01 +00:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
|
|
|
|
2013-03-19 23:40:07 +00:00
|
|
|
$(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c
|
2012-11-10 16:06:01 +00:00
|
|
|
$(call COMPILE, $<, $@)
|
|
|
|
|
2020-05-02 03:23:04 +08:00
|
|
|
# C library for the flat build and
|
|
|
|
# the user phase of the two-pass kernel build
|
2013-03-19 23:40:07 +00:00
|
|
|
|
2012-11-11 00:57:22 +00:00
|
|
|
$(BIN): $(OBJS)
|
2012-11-15 17:43:29 +00:00
|
|
|
$(call ARCHIVE, $@, $(OBJS))
|
2021-08-01 15:27:08 +08:00
|
|
|
ifeq ($(CONFIG_LIBC_ZONEINFO_ROMFS),y)
|
2020-09-14 13:53:37 -03:00
|
|
|
$(Q) $(MAKE) -C zoneinfo all BIN=$(BIN)
|
2016-06-30 16:20:43 -06:00
|
|
|
endif
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2013-03-19 23:40:07 +00:00
|
|
|
# C library for the kernel phase of the two-pass kernel build
|
|
|
|
|
2012-11-10 16:06:01 +00:00
|
|
|
ifneq ($(BIN),$(KBIN))
|
2013-03-19 23:40:07 +00:00
|
|
|
$(KBIN):
|
2020-09-14 13:53:37 -03:00
|
|
|
$(Q) $(MAKE) $(KBIN) BIN=$(KBIN) BINDIR=kbin EXTRAFLAGS="$(EXTRAFLAGS)"
|
2012-11-10 16:06:01 +00:00
|
|
|
endif
|
|
|
|
|
2016-06-30 16:20:43 -06:00
|
|
|
# Context
|
|
|
|
|
2020-11-16 11:53:09 +02:00
|
|
|
context::
|
2021-08-01 15:27:08 +08:00
|
|
|
ifeq ($(CONFIG_LIBC_ZONEINFO_ROMFS),y)
|
2020-09-14 13:53:37 -03:00
|
|
|
$(Q) $(MAKE) -C zoneinfo context BIN=$(BIN)
|
2016-06-30 16:20:43 -06:00
|
|
|
endif
|
|
|
|
|
2013-03-19 23:40:07 +00:00
|
|
|
# Dependencies
|
|
|
|
|
2020-11-18 13:44:58 -03:00
|
|
|
makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds)
|
|
|
|
$(call CATFILE, bin/Make.dep, $^)
|
|
|
|
$(call DELFILE, $^)
|
2020-11-28 11:43:30 +08:00
|
|
|
|
2020-11-18 13:44:58 -03:00
|
|
|
makekdepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds)
|
|
|
|
$(call CATFILE, kbin/Make.dep, $^)
|
|
|
|
$(call DELFILE, $^)
|
|
|
|
|
2020-07-22 16:54:29 +09:00
|
|
|
.depend: Makefile $(SRCS) $(TOPDIR)$(DELIM).config
|
2020-11-28 10:42:54 -03:00
|
|
|
$(Q) $(MAKE) makedepfile OBJPATH="bin"
|
2020-05-02 03:23:04 +08:00
|
|
|
ifneq ($(CONFIG_BUILD_FLAT),y)
|
2020-11-28 10:42:54 -03:00
|
|
|
$(Q) $(MAKE) makekdepfile CFLAGS="$(CFLAGS) $(KDEFINE)" OBJPATH="kbin"
|
2016-06-30 16:20:43 -06:00
|
|
|
endif
|
2021-08-01 15:27:08 +08:00
|
|
|
ifeq ($(CONFIG_LIBC_ZONEINFO_ROMFS),y)
|
2020-09-14 13:53:37 -03:00
|
|
|
$(Q) $(MAKE) -C zoneinfo depend BIN=$(BIN)
|
2013-09-29 11:46:10 -06:00
|
|
|
endif
|
2012-11-11 18:36:28 +00:00
|
|
|
$(Q) touch $@
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2020-11-16 11:53:09 +02:00
|
|
|
depend:: .depend
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2013-03-19 23:40:07 +00:00
|
|
|
# Clean most derived files, retaining the configuration
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2020-11-16 11:53:09 +02:00
|
|
|
clean::
|
2020-09-14 13:53:37 -03:00
|
|
|
$(Q) $(MAKE) -C bin clean
|
|
|
|
$(Q) $(MAKE) -C kbin clean
|
|
|
|
$(Q) $(MAKE) -C zoneinfo clean BIN=$(BIN)
|
2012-11-20 15:47:41 +00:00
|
|
|
$(call DELFILE, $(BIN))
|
|
|
|
$(call DELFILE, $(KBIN))
|
2012-11-10 16:06:01 +00:00
|
|
|
$(call CLEAN)
|
|
|
|
|
|
|
|
# Deep clean -- removes all traces of the configuration
|
|
|
|
|
2020-11-16 11:53:09 +02:00
|
|
|
distclean:: clean
|
2020-09-14 13:53:37 -03:00
|
|
|
$(Q) $(MAKE) -C bin distclean
|
|
|
|
$(Q) $(MAKE) -C kbin distclean
|
|
|
|
$(Q) $(MAKE) -C zoneinfo distclean BIN=$(BIN)
|
2020-05-01 09:51:56 +08:00
|
|
|
$(call DELFILE, exec_symtab.c)
|
2019-03-19 10:14:50 -06:00
|
|
|
$(call DELFILE, bin/Make.dep)
|
|
|
|
$(call DELFILE, kbin/Make.dep)
|
2012-11-20 15:47:41 +00:00
|
|
|
$(call DELFILE, .depend)
|
2012-11-10 16:06:01 +00:00
|
|
|
|
2019-03-19 10:14:50 -06:00
|
|
|
-include bin/Make.dep
|
|
|
|
-include kbin/Make.dep
|