Makefile revision 0ec5755428223b8105e488e8fddc19de4db26521
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# CDDL HEADER START
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# The contents of this file are subject to the terms of the
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Common Development and Distribution License, Version 1.0 only
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# (the "License"). You may not use this file except in compliance
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# with the License.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# See the License for the specific language governing permissions
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# and limitations under the License.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# When distributing Covered Code, include this CDDL HEADER in each
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# If applicable, add the following below this CDDL HEADER, with the
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# CDDL HEADER END
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Use is subject to license terms.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# ident "%Z%%M% %I% %E% SMI"
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# objects are grouped by source directory
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# local objects
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This macro should ALWAYS be empty; native APIs are already 'large file'.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# This macro should ALWAYS be empty; native APIs are already 'large file'.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# objects from source under ../port
12bf5d4796505b4c20680531da96a31e6c2c1144Evan Hunt# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# This macro should ALWAYS be empty; native APIs are already 'large file'.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This macro should ALWAYS be empty; native APIs are already 'large file'.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# modules whose source is provided in the $(SRC)/lib/common directory.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This must be done because otherwise the Sun C compiler would insert
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# its own versions of these modules and those versions contain code
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# to call out to C++ initialization functions. Such C++ initialization
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# functions can call back into libc before thread initialization is
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# complete and this leads to segmentation violations and other problems.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Since libc contains no C++ code, linking with the minimal crti.o and
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# crtn.o modules is safe and avoids the problems described above.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# these aren't listed as $(PICS), so we need to force CTF
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewspics/values-Xa.o := POST_PROCESS_O = $(CTFCONVERT_O)
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# include common library definitions
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# NOTE: libc_i18n.a will be part of libc.so.1. Therefore, the compilation
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# need to be compatible with the ones for the libc stuff. Whenever the changes
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# that affect the compilation conditions of libc happened, those for libc_i18n
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# also need to be updated.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This is necessary to avoid problems with calling _ex_unwind().
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# We probably don't want any inlining anyway.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# enables ASSERT() checking in the threads portion of the library.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# This is automatically enabled for DEBUG builds, not for non-debug builds.
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
98091cb21da79b0c7fd329fd64497dcb03402467Evan Hunt -I. -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) -I/usr/include
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark AndrewsASFLAGS= $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Inform the run-time linker about libc specialized initialization
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# Override this top level flag so the compiler builds in its native
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# C99 mode. This has been enabled to support the complex arithmetic
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# added to libc.
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# libc method of building an archive
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# extra files for the clean target
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# list of C source for lint
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(PORTFP:%.o=../port/fp/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(PORTGEN:%.o=../port/gen/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(PORTI18N:%.o=../port/i18n/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(PORTPRINT:%.o=../port/print/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(PORTREGEX:%.o=../port/regex/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(PORTSTDIO:%.o=../port/stdio/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(PORTSYS:%.o=../port/sys/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(THREADSOBJS:%.o=../port/threads/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(FPOBJS:%.o=fp/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(I386FPOBJS:%.o=../i386/fp/%.c) \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# conditional assignments
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# Files which need the threads .il inline template
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# pics/mul64.o := CFLAGS64 += crt/mul64.il
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# large-file-aware components that should be built large
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews#$(COMSYSOBJS64:%=pics/%) := \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt#$(SYSOBJS64:%=pics/%) := \
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt#$(PORTGEN64:%=pics/%) := \
98922b2b2b024dcca25be7c220cf3b16b1e6c4b5Evan Hunt# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews#$(PORTSTDIO64:%=pics/%) := \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews#$(PORTSYS64:%=pics/%) := \
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrewslint := LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# object files that depend on inline template
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# include common libc targets
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# We need to strip out all CTF data from the static library
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews# XXX A hack. Perhaps this should be 'CPPFLAGS.native' and
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840eMark Andrews $(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Hunt# derived C source and related explicit dependencies
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Hunt../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Hunt cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist