Makefile revision 69bb4bb45c98da60d21839c4dc3c01ea1be60585
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater# CDDL HEADER START
c7ef13f6c9ef4436bc804b150e0a93307b11fa27Tinderbox User# The contents of this file are subject to the terms of the
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# Common Development and Distribution License (the "License").
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# You may not use this file except in compliance with the License.
5e047890ac9b745db060d95f7d1b4f876511240dTinderbox User# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User# See the License for the specific language governing permissions
bed0874e1a09e810575328c4bfc346a47514b69fMark Andrews# and limitations under the License.
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User# When distributing Covered Code, include this CDDL HEADER in each
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e20309353e6246485c521278131d3fced73d7957Tinderbox User# If applicable, add the following below this CDDL HEADER, with the
e20309353e6246485c521278131d3fced73d7957Tinderbox User# fields enclosed by brackets "[]" replaced with your own identifying
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
3cc98b8ecedcbc8465f1cf2740b966b315662430Automatic Updater# CDDL HEADER END
e20309353e6246485c521278131d3fced73d7957Tinderbox User# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
e20309353e6246485c521278131d3fced73d7957Tinderbox User# Use is subject to license terms.
df4ebd8217d02dafc12145b55c4d93d0255d1ec7Tinderbox User# ident "%Z%%M% %I% %E% SMI"
e130ab53e992670e2a2ecf043976ac09f21358d1Automatic Updater# objects are grouped by source directory
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt# local objects
8711e5c73ca872d59810760af0332194cbdd619bAutomatic 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
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# This macro should ALWAYS be empty; native APIs are already 'large file'.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# objects from source under ../port
44e3b272904bfd85556771d30cf1bc6fa539dd03Automatic Updater# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
44e3b272904bfd85556771d30cf1bc6fa539dd03Automatic Updater# This macro should ALWAYS be empty; native APIs are already 'large file'.
48b36fa08b2b5bc0d552dc2a4425b3f7007b3d59Automatic 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'.
af9cf290cea6ada6ce27b51c724ab77ad5d73fa0Tinderbox User# NOTE: libc.so.1 must be linked with the minimal crti.o and crtn.o
e171a4137c6ba348957e61b7c4c3541493c0da02Automatic Updater# modules whose source is provided in the $(SRC)/lib/common directory.
c53a6f37deaa396660adb6a4ca600c4a58adfd3fAutomatic Updater# This must be done because otherwise the Sun C compiler would insert
c53a6f37deaa396660adb6a4ca600c4a58adfd3fAutomatic 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
19ad308d84cbf446a144e5a91f2032389a9d65c1Tinderbox User# complete and this leads to segmentation violations and other problems.
19ad308d84cbf446a144e5a91f2032389a9d65c1Tinderbox User# Since libc contains no C++ code, linking with the minimal crti.o and
b3386fba31414344f38f0c30849c056dceb22dceTinderbox User# crtn.o modules is safe and avoids the problems described above.
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# include common library definitions
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# NOTE: libc_i18n.a will be part of libc.so.1. Therefore, the compilation
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
6671e343b8c7e44ac10a7900fde59555fbc71571Automatic Updater# need to be compatible with the ones for the libc stuff. Whenever the changes
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# that affect the compilation conditions of libc happened, those for libc_i18n
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# also need to be updated.
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# This is necessary to avoid problems with calling _ex_unwind().
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater# We probably don't want any inlining anyway.
4104e236f71eb5108fcfda6711878a97f6f4a8e7Automatic Updater# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater# enables ASSERT() checking in the threads portion of the library.
409ba95e573b40cf36acf97dd62ee7e9c7775851Tinderbox User# This is automatically enabled for DEBUG builds, not for non-debug builds.
7af91d15b2ce1ce32f7320f6d5cc3b83621c241aAutomatic Updater$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
af9cf290cea6ada6ce27b51c724ab77ad5d73fa0Tinderbox User$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
e20309353e6246485c521278131d3fced73d7957Tinderbox UserCPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) \
e20309353e6246485c521278131d3fced73d7957Tinderbox User -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master)
e20309353e6246485c521278131d3fced73d7957Tinderbox UserASFLAGS= -K PIC -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \
e628576d3b3d91c8954679077f4c208f1e43b433Automatic Updater# Inform the run-time linker about libc specialized initialization
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# Override this top level flag so the compiler builds in its native
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# C99 mode. This has been enabled to support the complex arithmetic
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# added to libc.
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# libc method of building an archive
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews $(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
91d187ce035f39073f0732ff2a401a45c3c955fbMark Andrews# extra files for the clean target
a80993946f29ff39df38818ee9b2e58a4e46cb7eTinderbox User# list of C source for lint
a80993946f29ff39df38818ee9b2e58a4e46cb7eTinderbox User $(PORTFP:%.o=../port/fp/%.c) \
a80993946f29ff39df38818ee9b2e58a4e46cb7eTinderbox User $(PORTGEN:%.o=../port/gen/%.c) \
a80993946f29ff39df38818ee9b2e58a4e46cb7eTinderbox User $(PORTI18N:%.o=../port/i18n/%.c) \
a80993946f29ff39df38818ee9b2e58a4e46cb7eTinderbox User $(PORTPRINT:%.o=../port/print/%.c) \
a80993946f29ff39df38818ee9b2e58a4e46cb7eTinderbox User $(PORTREGEX:%.o=../port/regex/%.c) \
a80993946f29ff39df38818ee9b2e58a4e46cb7eTinderbox User $(PORTSTDIO:%.o=../port/stdio/%.c) \
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User $(PORTSYS:%.o=../port/sys/%.c) \
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User $(AIOOBJS:%.o=../port/aio/%.c) \
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User $(RTOBJS:%.o=../port/rt/%.c) \
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User $(TPOOLOBJS:%.o=../port/tpool/%.c) \
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User $(THREADSOBJS:%.o=../port/threads/%.c) \
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User $(THREADSMACHOBJS:%.o=../$(MACH)/threads/%.c) \
48dfee71508886d86fe8fb12f91961b5daf3141dMark Andrews# conditional assignments
48dfee71508886d86fe8fb12f91961b5daf3141dMark Andrews# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1368e4b34cef64604c874fcc40201c78e548714cTinderbox User# Files which need the threads .il inline template
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/sparcv9.il
e007e3e5b0316c6c05698a71101885743aca22bdAutomatic Updater# Files in fp, port/fp subdirectories that need base.il inline template
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews$(IL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/fp/base.il
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews# Files in fp subdirectory which need __quad.il inline template
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews$(QIL:%=pics/%) := CFLAGS64 += ../$(MACH)/fp/__quad.il
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrewspics/_Q%.o := sparcv9_COPTFLAG = -xO4 -xchip=ultra
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews# Files in crt subdirectory which need muldiv64.il inline template
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews#$(CIL:%=pics/%) := CFLAGS += $(LIBCBASE)/crt/mul64.il
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews# large-file-aware components that should be built large
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews#$(COMSYSOBJS64:%=pics/%) := \
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews#$(SYSOBJS64:%=pics/%) := \
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews#$(PORTGEN64:%=pics/%) := \
8e5fce1f9ceba17dd7e3ff0eb287e1e999c14249Mark Andrews# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User#$(PORTSTDIO64:%=pics/%) := \
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater#$(PORTSYS64:%=pics/%) := \
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater# CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
95cfad51a3f71246d263af79a7861a6821f7a0beAutomatic Updater# Files which need extra optimization
f132a836c4e386b1af045dd8fe7106ae61b90bffAutomatic Updaterlint := CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
f132a836c4e386b1af045dd8fe7106ae61b90bffAutomatic Updater# object files that depend on inline template
5ecad47f69b3fd945472ab2900a9ff826a7ce2f6Automatic Updater$(TIL:%=pics/%): $(LIBCBASE)/threads/sparcv9.il
07d9d0dbcc0c79deb3c34f4a8af05ac68a6800e4Mark Andrews#$(CIL:%=pics/%): $(LIBCBASE)/crt/muldiv64.il
f132a836c4e386b1af045dd8fe7106ae61b90bffAutomatic Updater# include common libc targets
e2e3f655d133f08056c9035412d4c013aab234e7Automatic Updater# We need to strip out all CTF and DOF data from the static library
2fd1e3918971180155c10d09454a277f015daecaAutomatic Updater $(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
2fd1e3918971180155c10d09454a277f015daecaAutomatic Updater $(MCS) -d -n .SUNW_dof $@ > /dev/null 2>&1
2fd1e3918971180155c10d09454a277f015daecaAutomatic Updater# special cases
b6561016dc8a813bfd91cef5b876b3dfc3f08ffaTinderbox User#$(STRETS:%=pics/%): crt/stret.s
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# $(AS) $(ASFLAGS) -DSTRET$(@F:stret%.o=%) crt/stret.s -o $@
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User# $(POST_PROCESS_O)
e2e3f655d133f08056c9035412d4c013aab234e7Automatic Updater#crt/_rtbootld.s: crt/_rtboot.s crt/_rtld.c
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User# $(CC) $(CPPFLAGS) -O -S -K pic crt/_rtld.c -o crt/_rtld.s
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# $(CAT) crt/_rtboot.s crt/_rtld.s > $@
85b52a5959291f5014442814488ccb267cdea369Tinderbox User# XXX A hack. Perhaps this should be 'CPPFLAGS.native' and
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
cc17f4a672fc4ce67327902dd797c4465f12c4c9Mark Andrews# derived C source and related explicit dependencies
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist