Makefile revision d2a70789f056fc6c9ce3ab047b52126d80b0e3da
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater# CDDL HEADER START
18920d790825d96ca3943aa2dcb6eb80dc611c5fTinderbox User# The contents of this file are subject to the terms of the
ab496cc3df1648e9ad992a87c35c2c0870fdc69dTinderbox User# Common Development and Distribution License (the "License").
7c1468ed500356839a4a222517364e6ce18cb1a2Tinderbox User# You may not use this file except in compliance with the License.
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# See the License for the specific language governing permissions
8de3f14f1c300c3e1ed99084cc03485b42c92bf1Tinderbox User# and limitations under the License.
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User# When distributing Covered Code, include this CDDL HEADER in each
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# If applicable, add the following below this CDDL HEADER, with the
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews# CDDL HEADER END
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# Copyright 2016 Joyent, Inc.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# Copyright 2013 Garrett D'Amore <garrett@damore.org>
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# Use is subject to license terms.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# objects are grouped by source directory
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# local objects
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# This macro should ALWAYS be empty; native APIs are already 'large file'.
4fe0411487e8e4401477684c0a2bac041ca7c2d5Tinderbox User# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
dc238a06bffa79de141ee7655765e2df91498a8aTinderbox User# This macro should ALWAYS be empty; native APIs are already 'large file'.
3857cb6fcabeb79d85de4b3e3e4ab99912b701f8Mark Andrews# objects from source under $(LIBCDIR)/port
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# This macro should ALWAYS be empty; native APIs are already 'large file'.
8aa098c6334de11c8fd117d30851cc457813c410Mark Andrews# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
4fe0411487e8e4401477684c0a2bac041ca7c2d5Tinderbox User# This macro should ALWAYS be empty; native APIs are already 'large file'.
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# modules whose source is provided in the $(SRC)/lib/common directory.
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# This must be done because otherwise the Sun C compiler would insert
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# its own versions of these modules and those versions contain code
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# to call out to C++ initialization functions. Such C++ initialization
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# functions can call back into libc before thread initialization is
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# complete and this leads to segmentation violations and other problems.
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# Since libc contains no C++ code, linking with the minimal crti.o and
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# crtn.o modules is safe and avoids the problems described above.
b30ec46fec40a1b246f7965fbcd341fc6cfd1cc1Mark Andrews# include common library definitions
95c3a5e116c1da135f669c3f15398172fac6279dMark Andrews# This is necessary to avoid problems with calling _ex_unwind().
95c3a5e116c1da135f669c3f15398172fac6279dMark Andrews# We probably don't want any inlining anyway.
3f38b58ba4f674afd883eef5d976a7d4e0502673Tinderbox User# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
3f38b58ba4f674afd883eef5d976a7d4e0502673Tinderbox User# enables ASSERT() checking in the threads portion of the library.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# This is automatically enabled for DEBUG builds, not for non-debug builds.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Make string literals read-only to save memory
fa0326cc2cf428f67575b6ba3b97b528a31b0010Tinderbox User$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic UpdaterCPPFLAGS= -D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
3040b455151b1e1173193933664b2891b6159f24Mark Andrews -I. -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
88d58d79c5bc7ce3c20a42461a5070116c736836Automatic UpdaterASFLAGS= $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
3040b455151b1e1173193933664b2891b6159f24Mark Andrews# As a favor to the dtrace syscall provider, libc still calls the
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# old syscall traps that have been obsoleted by the *at() interfaces.
48b36fa08b2b5bc0d552dc2a4425b3f7007b3d59Automatic Updater# Delete this to compile libc using only the new *at() system call traps
7f814b8b164ae04916a8487cdc5e88ee3ff51a58Automatic Updater# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
3040b455151b1e1173193933664b2891b6159f24Mark Andrewspics/proc64_id.o := CFLAGS64 += -I$(SRC)/uts/intel
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Inform the run-time linker about libc specialized initialization
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# Force libc's internal references to be resolved immediately upon loading
48b36fa08b2b5bc0d552dc2a4425b3f7007b3d59Automatic Updater# in order to avoid critical region problems. Since almost all libc symbols
9fa39c73fc1d8bc44fdbbb79a1d26b837e7dd555Mark Andrews# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User# Override this top level flag so the compiler builds in its native
3040b455151b1e1173193933664b2891b6159f24Mark Andrews# C99 mode. This has been enabled to support the complex arithmetic
1959fd489a8832e4e3d311670f64ae18e5d08156Automatic Updater# added to libc.
3040b455151b1e1173193933664b2891b6159f24Mark Andrews# libc method of building an archive
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# The "$(GREP) -v ' L '" part is necessary only until
d58e33bfabfee19a035031dac633d36659738d56Evan Hunt# lorder is fixed to ignore thread-local variables.
dc238a06bffa79de141ee7655765e2df91498a8aTinderbox User $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User# extra files for the clean target
b6561016dc8a813bfd91cef5b876b3dfc3f08ffaTinderbox User# list of C source for lint
e5bf83fe0bbca838a0749e9071bd76d9ee0fb59bFrancis Dupont $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
4dca64bb8991502db368028aeeba2f832d3b971dAutomatic Updater $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
ead8aa3182c5805fccb6c7c1636cede6a24a5fc1Automatic Updater $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
ead8aa3182c5805fccb6c7c1636cede6a24a5fc1Automatic Updater $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
ead8aa3182c5805fccb6c7c1636cede6a24a5fc1Automatic Updater $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
ead8aa3182c5805fccb6c7c1636cede6a24a5fc1Automatic Updater $(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
ead8aa3182c5805fccb6c7c1636cede6a24a5fc1Automatic Updater $(LIBCBASE)/gen/sync_instruction_memory.c \
ead8aa3182c5805fccb6c7c1636cede6a24a5fc1Automatic Updater# conditional assignments
3040b455151b1e1173193933664b2891b6159f24Mark Andrews# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
3040b455151b1e1173193933664b2891b6159f24Mark Andrews# Files which need the threads .il inline template
7fdbd6fc9df8728852ccaecb2d66241ab96a4084Tinderbox User$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# pics/mul64.o := CFLAGS64 += crt/mul64.il
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# large-file-aware components that should be built large
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater#$(COMSYSOBJS64:%=pics/%) := \
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater#$(SYSOBJS64:%=pics/%) := \
99c231a3bd27893583204cd0a3e3103dc78dbc28Tinderbox User# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4104e236f71eb5108fcfda6711878a97f6f4a8e7Automatic Updater#$(PORTGEN64:%=pics/%) := \
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater#$(PORTSTDIO64:%=pics/%) := \
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
28a5dd720187fddb16055a0f64b63a7b66f29f64Mark Andrews#$(PORTSYS64:%=pics/%) := \
28a5dd720187fddb16055a0f64b63a7b66f29f64Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
39cad8fb7d7ff3436bb24ce761354afcb80d295aMark Andrewspics/arc4random.o := CPPFLAGS += -I$(SRC)/common/crypto/chacha
9d80d23172c30fd63e5046a7e69b8445e564ff31Automatic Updaterlint := CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1f4c645185bd8fc70048e0a69eee46193a284e5cTinderbox Userlint := LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# object files that depend on inline template
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# include common libc targets
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# We need to strip out all CTF data from the static library
e80c7005e3d59dfeb04dad186d36f3c15622954cTinderbox User $(NATIVECC) $(NATIVE_CFLAGS) -Iinc -I$(LIBCDIR)/inc $(CPPFLAGS.native) \
08190bd4d89153cee463b34f9233ad6dd88965fcMark Andrews# derived C source and related explicit dependencies
08190bd4d89153cee463b34f9233ad6dd88965fcMark Andrews$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
08190bd4d89153cee463b34f9233ad6dd88965fcMark Andrews cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist