Makefile revision 4703203d9b3e06246d73931f07359a7ef70f47bf
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens# The contents of this file are subject to the terms of the
441d80aa4f613b6298fc8bd3151f4be02dbf84fclling# Common Development and Distribution License (the "License").
441d80aa4f613b6298fc8bd3151f4be02dbf84fclling# You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens# See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens# and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens# If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens# fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens# information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens# CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
3f9d6ad73e45c6823b409f93b0c8d4f62861d2d5Lin Ling# Use is subject to license terms.
e9103aaee0c546d4644791198c54abb03c89969eGarrett D'Amore# ident "%Z%%M% %I% %E% SMI"
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# objects are grouped by source directory
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# local objects
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens# sysobjs that contain large-file interfaces
9e6eda553d3d6d77b83da5c596c89990d82bd485marks# objects under ../port which contain transitional large file interfaces
503ad85c168c7992ccc310af845a581cff3c72b5Matthew Ahrens# objects from source under ../port
92241e0b80813d0b83c08e730a29b9d1831794fcTom Erickson# c89 variants to support 32-bit size of c89 u/intmax_t (32-bit libc only)
fa9e4066f08beec538e775443c5be79dd423fcabahrens# portable stdio objects that contain large file interfaces.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# Note: fopen64 is a special case, as we build it small.
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens# objects that implement the transitional large file API
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# modules whose source is provided in the $(SRC)/lib/common directory.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# This must be done because otherwise the Sun C compiler would insert
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# its own versions of these modules and those versions contain code
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# to call out to C++ initialization functions. Such C++ initialization
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# functions can call back into libc before thread initialization is
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# complete and this leads to segmentation violations and other problems.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# Since libc contains no C++ code, linking with the minimal crti.o and
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# crtn.o modules is safe and avoids the problems described above.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# include common library definitions
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# NOTE: libc_i18n.a will be part of libc.so.1. Therefore, the compilation
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# need to be compatible with the ones for the libc stuff. Whenever the changes
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# that affect the compilation conditions of libc happened, those for libc_i18n
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# also need to be updated.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# This is necessary to avoid problems with calling _ex_unwind().
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# We probably don't want any inlining anyway.
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# enables ASSERT() checking in the threads portion of the library.
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# This is automatically enabled for DEBUG builds, not for non-debug builds.
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens$(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
be6fd75a69ae679453d9cda5bff3326111e6d1caMatthew AhrensCPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) \
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master)
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew AhrensASFLAGS= -K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) $(sparc_AS_XARCH)
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# Conditionally add support for making |wordexp()| check whether
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# /usr/bin/ksh is ksh93 or not
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew AhrensCPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# Inform the run-time linker about libc specialized initialization
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# Inform the kernel about the initial DTrace area (in case
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# libc is being used as the interpreter / runtime linker).
be6fd75a69ae679453d9cda5bff3326111e6d1caMatthew Ahrens# DTrace needs an executable data segment.
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# Override this top level flag so the compiler builds in its native
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# C99 mode. This has been enabled to support the complex arithmetic
92241e0b80813d0b83c08e730a29b9d1831794fcTom Erickson# added to libc.
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks# libc method of building an archive
ecd6cf800b63704be73fb264c3f5b6e0dafc068dmarks $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
fa9e4066f08beec538e775443c5be79dd423fcabahrens# extra files for the clean target
fa9e4066f08beec538e775443c5be79dd423fcabahrens# list of C source for lint
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens $(PORTFP:%.o=../port/fp/%.c) \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $(PORTGEN:%.o=../port/gen/%.c) \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $(PORTI18N:%.o=../port/i18n/%.c) \
be6fd75a69ae679453d9cda5bff3326111e6d1caMatthew Ahrens $(PORTPRINT:%.o=../port/print/%.c) \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $(PORTREGEX:%.o=../port/regex/%.c) \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $(PORTSTDIO:%.o=../port/stdio/%.c) \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $(PORTSYS:%.o=../port/sys/%.c) \
fa9e4066f08beec538e775443c5be79dd423fcabahrens $(AIOOBJS:%.o=../port/aio/%.c) \
99d5e173470cf967aa87653364ed614299e7b511Tim Haley $(RTOBJS:%.o=../port/rt/%.c) \
99d5e173470cf967aa87653364ed614299e7b511Tim Haley $(TPOOLOBJS:%.o=../port/tpool/%.c) \
99d5e173470cf967aa87653364ed614299e7b511Tim Haley $(THREADSOBJS:%.o=../port/threads/%.c) \
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# conditional assignments
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# Files which need the threads .il inline template
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# special kludge for inlines with 'cas':
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrenspics/rwlock.o pics/synch.o pics/lwp.o := sparc_CFLAGS += -_gcc=-Wa,-xarch=v8plus
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# Files in port/fp subdirectory that need base.il inline template
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens$(IL:%=pics/%) := CFLAGS += $(LIBCBASE)/fp/base.il
148434217c040ea38dc844384f6ba68d9b325906Matthew Ahrens# Files in fp subdirectory which need __quad.il inline template
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby$(QIL:%=pics/%) := CFLAGS += ../$(MACH)/fp/__quad.il
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens# large-file-aware components that should be built large
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# printf/scanf functions to support c89-sized intmax_t variables
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens# Files which need extra optimization
99d5e173470cf967aa87653364ed614299e7b511Tim Haley# object files that depend on inline template
99d5e173470cf967aa87653364ed614299e7b511Tim Haley# include common libc targets
3b2aab18808792cbd248a12f1edf139b89833c13Matthew Ahrens# We need to strip out all CTF and DOF data from the static library
fa9e4066f08beec538e775443c5be79dd423fcabahrens# special cases
fa9e4066f08beec538e775443c5be79dd423fcabahrens $(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
e9dbad6f263d5570ed7ff5443ec5b958af8c24d7eschrock# partially built from C source
fa9e4066f08beec538e775443c5be79dd423fcabahrens# assym.h build rules
fa9e4066f08beec538e775443c5be79dd423fcabahrens# XXX A hack. Perhaps this should be 'CPPFLAGS.native' and
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
4445fffbbb1ea25fd0e9ea68b9380dd7a6709025Matthew Ahrens# derived C source and related explicit dependencies
92241e0b80813d0b83c08e730a29b9d1831794fcTom Erickson../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
92241e0b80813d0b83c08e730a29b9d1831794fcTom Erickson cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist