Makefile revision 7014882c6a3672fd0e5d60200af8643ae53c5928
885f47576842cf3c569315b9a48bd9f0ca03f203Automatic Updater# CDDL HEADER START
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# The contents of this file are subject to the terms of the
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# Common Development and Distribution License (the "License").
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater# You may not use this file except in compliance with the License.
75b70a68aefaa17ac4e768d5ed85d2f50d471490Automatic Updater# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater# or http://www.opensolaris.org/os/licensing.
ea854b585041ad19f70f7af15e08144ef2c2bd1bMark Andrews# See the License for the specific language governing permissions
78cb74fab4665da2e2641ba909c6f59f74cc4193Automatic Updater# and limitations under the License.
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updater# When distributing Covered Code, include this CDDL HEADER in each
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# fields enclosed by brackets "[]" replaced with your own identifying
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# information: Portions Copyright [yyyy] [name of copyright owner]
bc0a53583d92309bebcf93c408e2f3247ebd3d3cAutomatic Updater# CDDL HEADER END
96713299d08c0735c18ebe8772dd2cc1ecd4356aAutomatic Updater# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Use is subject to license terms.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# objects are grouped by source directory
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# local objects
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater# This macro should ALWAYS be empty; native APIs are already 'large file'.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# This macro should ALWAYS be empty; native APIs are already 'large file'.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# objects from source under $(LIBCDIR)/port
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# This macro should ALWAYS be empty; native APIs are already 'large file'.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# This macro should ALWAYS be empty; native APIs are already 'large file'.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# modules whose source is provided in the $(SRC)/lib/common directory.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# This must be done because otherwise the Sun C compiler would insert
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# its own versions of these modules and those versions contain code
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# to call out to C++ initialization functions. Such C++ initialization
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# functions can call back into libc before thread initialization is
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# complete and this leads to segmentation violations and other problems.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Since libc contains no C++ code, linking with the minimal crti.o and
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# crtn.o modules is safe and avoids the problems described above.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# include common library definitions
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# This is necessary to avoid problems with calling _ex_unwind().
b4cebdb6ccde66a8f3e397a1b90b0cf788519d69Automatic Updater# We probably don't want any inlining anyway.
cab3e375b77a980a5d4b7e5e4ee90167439e7934Mark Andrews# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# enables ASSERT() checking in the threads portion of the library.
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# This is automatically enabled for DEBUG builds, not for non-debug builds.
cab3e375b77a980a5d4b7e5e4ee90167439e7934Mark Andrews$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater# Make string literals read-only to save memory
7f79131f9a8e804b93c57f3c679065cce878b726Automatic Updater$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(EXTPICS)
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonCPPFLAGS= -D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater -I. -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic UpdaterASFLAGS= $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
3a9593055ead76cbbb417aee2d2e656c2c92cf46Automatic Updater# 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.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Delete this to compile libc using only the new *at() system call traps
7932a7637170550bc53b38c35db9a0187dcb3d3bAutomatic Updater# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonpics/proc64_id.o := CFLAGS64 += -I$(SRC)/uts/intel
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# Inform the run-time linker about libc specialized initialization
2fd97723b2ec7fc1975672780ab0c1c9a8c369d6Automatic Updater# Force libc's internal references to be resolved immediately upon loading
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# in order to avoid critical region problems. Since almost all libc symbols
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# Override this top level flag so the compiler builds in its native
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# C99 mode. This has been enabled to support the complex arithmetic
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# added to libc.
8fca573ba41a1669fff64f234275e956551eb6e5Mark Andrews# libc method of building an archive
8fca573ba41a1669fff64f234275e956551eb6e5Mark Andrews# The "$(GREP) -v ' L '" part is necessary only until
0ca8fddd5b5e26d8a05f0936fc4b2666a025b9c0Mark Andrews# lorder is fixed to ignore thread-local variables.
8fca573ba41a1669fff64f234275e956551eb6e5Mark Andrews $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%) | $(GREP) -v ' L ' | $(TSORT)`
8fca573ba41a1669fff64f234275e956551eb6e5Mark Andrews# extra files for the clean target
b795291f8ea5bc2c8470cc34f82e8c570337308aAutomatic Updater# list of C source for lint
21f8d40dbd9be951555f46b0bfa23571c5a9b913Automatic Updater $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
821d2613356f81e5bb5c107288d6d5cf35c2a1e8Mark Andrews $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
821d2613356f81e5bb5c107288d6d5cf35c2a1e8Mark Andrews $(FPOBJS:%.o=fp/%.c) \
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# conditional assignments
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# Files which need the threads .il inline template
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# pics/mul64.o := CFLAGS64 += crt/mul64.il
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# large-file-aware components that should be built large
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews#$(COMSYSOBJS64:%=pics/%) := \
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews#$(SYSOBJS64:%=pics/%) := \
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews#$(PORTGEN64:%=pics/%) := \
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews#$(PORTSTDIO64:%=pics/%) := \
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews#$(PORTSYS64:%=pics/%) := \
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrewslint := LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# object files that depend on inline template
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# include common libc targets
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# We need to strip out all CTF data from the static library
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews $(NATIVECC) -Iinc -I$(LIBCDIR)/inc $(CPPFLAGS.native) \
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews# derived C source and related explicit dependencies
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews$(LIBCDIR)/port/gen/new_list.c: $(LIBCDIR)/port/gen/errlist $(LIBCDIR)/port/gen/errlist.awk
4f087942583014b241adca1bc78c6db89ed96e94Mark Andrews cd $(LIBCDIR)/port/gen; pwd; $(AWK) -f errlist.awk < errlist