xref: /titanic_44/usr/src/lib/libc/amd64/Makefile (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# lib/libc/amd64/Makefile
28#
29LIBCBASE=.
30
31LIBRARY= libc.a
32LIB_PIC= libc_pic.a
33VERS=	.1
34CPP=	/usr/lib/cpp
35TARGET_ARCH=	amd64
36
37# objects are grouped by source directory
38
39# local objects
40STRETS=
41
42CRTOBJS=			\
43	cerror.o
44
45DYNOBJS=
46
47FPOBJS=				\
48	_base_il.o		\
49	fpgetmask.o		\
50	fpgetround.o		\
51	fpsetmask.o		\
52	fpsetround.o		\
53	fpstart.o
54
55I386FPOBJS=			\
56	_D_cplx_div.o		\
57	_D_cplx_div_ix.o	\
58	_D_cplx_div_rx.o	\
59	_D_cplx_lr_div.o	\
60	_D_cplx_lr_div_ix.o	\
61	_D_cplx_lr_div_rx.o	\
62	_D_cplx_mul.o		\
63	_F_cplx_div.o		\
64	_F_cplx_div_ix.o	\
65	_F_cplx_div_rx.o	\
66	_F_cplx_lr_div.o	\
67	_F_cplx_lr_div_ix.o	\
68	_F_cplx_lr_div_rx.o	\
69	_F_cplx_mul.o		\
70	_X_cplx_div.o		\
71	_X_cplx_div_ix.o	\
72	_X_cplx_div_rx.o	\
73	_X_cplx_lr_div.o	\
74	_X_cplx_lr_div_ix.o	\
75	_X_cplx_lr_div_rx.o	\
76	_X_cplx_mul.o
77
78FPASMOBJS=			\
79	__xgetRD.o		\
80	_xtoll.o		\
81	_xtoull.o		\
82	fpcw.o			\
83	fpgetsticky.o		\
84	fpsetsticky.o
85
86ATOMICOBJS=			\
87	atomic.o
88
89COMOBJS=			\
90	bcmp.o			\
91	bcopy.o			\
92	bsearch.o		\
93	bzero.o			\
94	qsort.o			\
95	strtol.o		\
96	strtoul.o
97
98GENOBJS=			\
99	_getsp.o		\
100	abs.o			\
101	alloca.o		\
102	byteorder.o		\
103	cache.o			\
104	cuexit.o		\
105	ecvt.o			\
106	errlst.o		\
107	amd64_data.o		\
108	ldivide.o		\
109	lexp10.o		\
110	llog10.o		\
111	lock.o			\
112	ltostr.o		\
113	makectxt.o		\
114	memccpy.o		\
115	memchr.o		\
116	memcmp.o		\
117	memcpy.o		\
118	memset.o		\
119	new_list.o		\
120	setjmp.o		\
121	siginfolst.o		\
122	siglongjmp.o		\
123	strcmp.o		\
124	strcpy.o		\
125	strlen.o		\
126	strncmp.o		\
127	strncpy.o		\
128	sync_instruction_memory.o
129
130# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
131# This macro should ALWAYS be empty; native APIs are already 'large file'.
132COMSYSOBJS64=
133
134SYSOBJS64=
135
136COMSYSOBJS=			\
137	__clock_timer.o		\
138	__fcntl.o		\
139	__getloadavg.o		\
140	__rusagesys.o		\
141	__signotify.o		\
142	__sigrt.o		\
143	__time.o		\
144	_lgrp_home_fast.o	\
145	_lgrpsys.o		\
146	_nfssys.o		\
147	_portfs.o		\
148	_pset.o			\
149	_rename.o		\
150	_rpcsys.o		\
151	_sigaction.o		\
152	_so_accept.o		\
153	_so_bind.o		\
154	_so_connect.o		\
155	_so_getpeername.o	\
156	_so_getsockname.o	\
157	_so_getsockopt.o	\
158	_so_listen.o		\
159	_so_recv.o		\
160	_so_recvfrom.o		\
161	_so_recvmsg.o		\
162	_so_send.o		\
163	_so_sendmsg.o		\
164	_so_sendto.o		\
165	_so_setsockopt.o	\
166	_so_shutdown.o		\
167	_so_socket.o		\
168	_so_socketpair.o	\
169	_sockconfig.o		\
170	access.o		\
171	acct.o			\
172	acl.o			\
173	adjtime.o		\
174	alarm.o			\
175	brk.o			\
176	chdir.o			\
177	chmod.o			\
178	chown.o			\
179	chroot.o		\
180	cladm.o			\
181	close.o			\
182	creat.o			\
183	dup.o			\
184	execve.o		\
185	exit.o			\
186	facl.o			\
187	fchdir.o		\
188	fchmod.o		\
189	fchown.o		\
190	fchroot.o		\
191	fdsync.o		\
192	fpathconf.o		\
193	fstat.o			\
194	fstatfs.o		\
195	fstatvfs.o		\
196	getcpuid.o		\
197	getdents.o		\
198	getegid.o		\
199	geteuid.o		\
200	getgid.o		\
201	getgroups.o		\
202	gethrtime.o		\
203	getitimer.o		\
204	getmsg.o		\
205	getpagesizes.o		\
206	getpid.o		\
207	getpmsg.o		\
208	getppid.o		\
209	getrlimit.o		\
210	getuid.o		\
211	gtty.o			\
212	install_utrap.o		\
213	ioctl.o			\
214	kaio.o			\
215	kill.o			\
216	lchown.o		\
217	link.o			\
218	llseek.o		\
219	lseek.o			\
220	lstat.o			\
221	memcntl.o		\
222	mincore.o		\
223	mkdir.o			\
224	mknod.o			\
225	mmap.o			\
226	modctl.o		\
227	mount.o			\
228	mprotect.o		\
229	munmap.o		\
230	nice.o			\
231	ntp_adjtime.o		\
232	ntp_gettime.o		\
233	open.o			\
234	p_online.o		\
235	pathconf.o		\
236	pause.o			\
237	pcsample.o		\
238	pollsys.o		\
239	pread.o			\
240	priocntlset.o		\
241	processor_bind.o	\
242	processor_info.o	\
243	profil.o		\
244	putmsg.o		\
245	putpmsg.o		\
246	pwrite.o		\
247	read.o			\
248	readlink.o		\
249	readv.o			\
250	resolvepath.o		\
251	rmdir.o			\
252	seteguid.o		\
253	setgid.o		\
254	setgroups.o		\
255	setitimer.o		\
256	setreid.o		\
257	setrlimit.o		\
258	setuid.o		\
259	sigaltstk.o		\
260	sigprocmsk.o		\
261	sigsendset.o		\
262	sigsuspend.o		\
263	stat.o			\
264	statfs.o		\
265	statvfs.o		\
266	stty.o			\
267	symlink.o		\
268	sync.o			\
269	sysconfig.o		\
270	sysfs.o			\
271	sysinfo.o		\
272	syslwp.o		\
273	times.o			\
274	ulimit.o		\
275	umask.o			\
276	umount2.o		\
277	unlink.o		\
278	utime.o			\
279	utimes.o		\
280	utssys.o		\
281	vhangup.o		\
282	waitid.o		\
283	write.o			\
284	writev.o		\
285	yield.o
286
287SYSOBJS=			\
288	__clock_gettime.o	\
289	__getcontext.o		\
290	__uadmin.o		\
291	_lwp_mutex_unlock.o	\
292	_stack_grow.o		\
293	door.o			\
294	fork1.o			\
295	forkall.o		\
296	fxstat.o		\
297	getcontext.o		\
298	gettimeofday.o		\
299	lwp_private.o		\
300	lxstat.o		\
301	nuname.o		\
302	pipe.o			\
303	syscall.o		\
304	sysi86.o		\
305	tls_get_addr.o		\
306	uadmin.o		\
307	umount.o		\
308	uname.o			\
309	vfork.o			\
310	xmknod.o		\
311	xstat.o
312
313# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
314# This macro should ALWAYS be empty; native APIs are already 'large file'.
315PORTGEN64=
316
317# objects from source under ../port
318PORTFP=				\
319	__flt_decim.o		\
320	__flt_rounds.o		\
321	__tbl_10_b.o		\
322	__tbl_10_h.o		\
323	__tbl_10_s.o		\
324	__tbl_2_b.o		\
325	__tbl_2_h.o		\
326	__tbl_2_s.o		\
327	__tbl_fdq.o		\
328	__tbl_tens.o		\
329	__x_power.o		\
330	_base_sup.o		\
331	aconvert.o		\
332	decimal_bin.o		\
333	double_decim.o		\
334	econvert.o		\
335	fconvert.o		\
336	file_decim.o		\
337	finite.o		\
338	fp_data.o		\
339	func_decim.o		\
340	gconvert.o		\
341	hex_bin.o		\
342	ieee_globals.o		\
343	pack_float.o		\
344	sigfpe.o		\
345	string_decim.o
346
347PORTGEN=			\
348	_env_data.o		\
349	_xftw.o			\
350	a64l.o			\
351	abort.o			\
352	addsev.o		\
353	assert.o		\
354	atof.o			\
355	atoi.o			\
356	atol.o			\
357	atoll.o			\
358	attropen.o		\
359	atexit.o		\
360	atfork.o		\
361	basename.o		\
362	calloc.o		\
363	catgets.o		\
364	catopen.o		\
365	cfgetispeed.o		\
366	cfgetospeed.o		\
367	cfree.o			\
368	cfsetispeed.o		\
369	cfsetospeed.o		\
370	cftime.o		\
371	clock.o			\
372	closedir.o		\
373	closefrom.o		\
374	confstr.o		\
375	crypt.o			\
376	csetlen.o		\
377	ctime.o			\
378	ctime_r.o		\
379	directio.o		\
380	dirname.o		\
381	div.o			\
382	drand48.o		\
383	dup2.o			\
384	env_data.o		\
385	errno.o			\
386	euclen.o		\
387	event_port.o		\
388	execvp.o		\
389	fattach.o		\
390	fdetach.o		\
391	fdopendir.o		\
392	ffs.o			\
393	fmtmsg.o		\
394	ftime.o			\
395	ftok.o			\
396	ftw.o			\
397	gcvt.o			\
398	getauxv.o		\
399	getcwd.o		\
400	getdate_err.o		\
401	getdtblsize.o		\
402	getenv.o		\
403	getexecname.o		\
404	getgrnam.o		\
405	getgrnam_r.o		\
406	gethostid.o		\
407	gethostname.o		\
408	gethz.o			\
409	getisax.o		\
410	getloadavg.o		\
411	getlogin.o		\
412	getmntent.o		\
413	getnetgrent.o		\
414	getopt.o		\
415	getopt_long.o		\
416	getpagesize.o		\
417	getpw.o			\
418	getpwnam.o		\
419	getpwnam_r.o		\
420	getrusage.o		\
421	getspent.o		\
422	getspent_r.o		\
423	getsubopt.o		\
424	gettxt.o		\
425	getusershell.o		\
426	getut.o			\
427	getutx.o		\
428	getvfsent.o		\
429	getwd.o			\
430	getwidth.o		\
431	getxby_door.o		\
432	gtxt.o			\
433	hsearch.o		\
434	iconv.o			\
435	imaxabs.o		\
436	imaxdiv.o		\
437	index.o			\
438	initgroups.o		\
439	insque.o		\
440	isaexec.o		\
441	isastream.o		\
442	isatty.o		\
443	killpg.o		\
444	l64a.o			\
445	lckpwdf.o		\
446	lconstants.o		\
447	lfind.o			\
448	lfmt.o			\
449	lfmt_log.o		\
450	lldiv.o			\
451	lltostr.o		\
452	lmath.o			\
453	localtime.o		\
454	lsearch.o		\
455	madvise.o		\
456	malloc.o		\
457	memalign.o		\
458	mkdev.o			\
459	mkdtemp.o		\
460	mkfifo.o		\
461	mkstemp.o		\
462	mktemp.o		\
463	mlock.o			\
464	mlockall.o		\
465	mon.o			\
466	msync.o			\
467	munlock.o		\
468	munlockall.o		\
469	ndbm.o			\
470	nftw.o			\
471	nlspath_checks.o	\
472	nsparse.o		\
473	nss_common.o		\
474	nss_dbdefs.o		\
475	nss_deffinder.o		\
476	opendir.o		\
477	opt_data.o		\
478	perror.o		\
479	pfmt.o			\
480	pfmt_data.o		\
481	pfmt_print.o		\
482	plock.o			\
483	poll.o			\
484	priocntl.o		\
485	privlib.o		\
486	priv_str_xlate.o	\
487	psiginfo.o		\
488	psignal.o		\
489	pt.o			\
490	putpwent.o		\
491	putspent.o		\
492	raise.o			\
493	rand.o			\
494	random.o		\
495	rctlops.o		\
496	readdir.o		\
497	readdir_r.o		\
498	realpath.o		\
499	reboot.o		\
500	regexpr.o		\
501	rename.o		\
502	rewinddir.o		\
503	rindex.o		\
504	scandir.o		\
505	seekdir.o		\
506	select.o		\
507	select_large_fdset.o	\
508	setlabel.o		\
509	setpriority.o		\
510	settimeofday.o		\
511	sh_locks.o		\
512	sigflag.o		\
513	siglist.o		\
514	sigsend.o		\
515	sigsetops.o		\
516	ssignal.o		\
517	stack.o			\
518	str2sig.o		\
519	strcase_charmap.o	\
520	strcasecmp.o		\
521	strcat.o		\
522	strchr.o		\
523	strcspn.o		\
524	strdup.o		\
525	strerror.o		\
526	strlcat.o		\
527	strlcpy.o		\
528	strncasecmp.o		\
529	strncat.o		\
530	strpbrk.o		\
531	strrchr.o		\
532	strsignal.o		\
533	strspn.o		\
534	strstr.o		\
535	strtod.o		\
536	strtoimax.o		\
537	strtok.o		\
538	strtok_r.o		\
539	strtoll.o		\
540	strtoull.o		\
541	strtoumax.o		\
542	swab.o			\
543	swapctl.o		\
544	sysconf.o		\
545	syslog.o		\
546	tcdrain.o		\
547	tcflow.o		\
548	tcflush.o		\
549	tcgetattr.o		\
550	tcgetpgrp.o		\
551	tcgetsid.o		\
552	tcsendbreak.o		\
553	tcsetattr.o		\
554	tcsetpgrp.o		\
555	tell.o			\
556	telldir.o		\
557	tfind.o			\
558	time_data.o		\
559	time_gdata.o		\
560	truncate.o		\
561	tsdalloc.o		\
562	tsearch.o		\
563	ttyname.o		\
564	ttyslot.o		\
565	ualarm.o		\
566	ucred.o			\
567	valloc.o		\
568	vlfmt.o			\
569	vpfmt.o			\
570	wait3.o			\
571	wait4.o			\
572	waitpid.o		\
573	walkstack.o		\
574	wdata.o			\
575	xgetwidth.o		\
576	xpg4.o			\
577	xpg6.o
578
579PORTPRINT_W=			\
580	doprnt_w.o
581
582PORTPRINT=			\
583	doprnt.o		\
584	fprintf.o		\
585	printf.o		\
586	snprintf.o		\
587	sprintf.o		\
588	vfprintf.o		\
589	vprintf.o		\
590	vsnprintf.o		\
591	vsprintf.o		\
592	vwprintf.o		\
593	wprintf.o
594
595# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
596# This macro should ALWAYS be empty; native APIs are already 'large file'.
597PORTSTDIO64=
598
599PORTSTDIO_W=			\
600	doscan_w.o
601
602PORTSTDIO=			\
603	__extensions.o		\
604	_endopen.o		\
605	_filbuf.o		\
606	_findbuf.o		\
607	_flsbuf.o		\
608	_wrtchk.o		\
609	clearerr.o		\
610	ctermid.o		\
611	ctermid_r.o		\
612	cuserid.o		\
613	data.o			\
614	doscan.o		\
615	fdopen.o		\
616	feof.o			\
617	ferror.o		\
618	fgetc.o			\
619	fgets.o			\
620	fileno.o		\
621	flockf.o		\
622	flush.o			\
623	fopen.o			\
624	fpos.o			\
625	fputc.o			\
626	fputs.o			\
627	fread.o			\
628	fseek.o			\
629	fseeko.o		\
630	ftell.o			\
631	ftello.o		\
632	fwrite.o		\
633	getc.o			\
634	getchar.o		\
635	getpass.o		\
636	gets.o			\
637	getw.o			\
638	mse.o			\
639	popen.o			\
640	putc.o			\
641	putchar.o		\
642	puts.o			\
643	putw.o			\
644	rewind.o		\
645	scanf.o			\
646	setbuf.o		\
647	setbuffer.o		\
648	setvbuf.o		\
649	system.o		\
650	tempnam.o		\
651	tmpfile.o		\
652	tmpnam_r.o		\
653	ungetc.o		\
654	vscanf.o		\
655	vwscanf.o		\
656	wscanf.o
657
658PORTI18N=			\
659	__fgetwc_xpg5.o		\
660	__fgetws_xpg5.o		\
661	__fputwc_xpg5.o		\
662	__fputws_xpg5.o		\
663	__ungetwc_xpg5.o	\
664	getwchar.o		\
665	putwchar.o		\
666	putws.o			\
667	strtows.o		\
668	wcsstr.o		\
669	wcstoimax.o		\
670	wcstol.o		\
671	wcstoul.o		\
672	wcswcs.o		\
673	wmemchr.o		\
674	wmemcmp.o		\
675	wmemcpy.o		\
676	wmemmove.o		\
677	wmemset.o		\
678	wscasecmp.o		\
679	wscat.o			\
680	wschr.o			\
681	wscmp.o			\
682	wscpy.o			\
683	wscspn.o		\
684	wsdup.o			\
685	wslen.o			\
686	wsncasecmp.o		\
687	wsncat.o		\
688	wsncmp.o		\
689	wsncpy.o		\
690	wspbrk.o		\
691	wsprintf.o		\
692	wsrchr.o		\
693	wsscanf.o		\
694	wsspn.o			\
695	wstod.o			\
696	wstok.o			\
697	wstol.o			\
698	wstoll.o		\
699	wsxfrm.o		\
700	gettext.o		\
701	gettext_gnu.o		\
702	gettext_real.o		\
703	gettext_util.o		\
704	plural_parser.o		\
705	wdresolve.o		\
706	_ctype.o		\
707	isascii.o		\
708	toascii.o
709
710PORTI18N_COND=			\
711	wcstol_longlong.o	\
712	wcstoul_longlong.o
713
714THREADSOBJS=			\
715	alloc.o			\
716	assfail.o		\
717	cancel.o		\
718	door_calls.o		\
719	pthr_attr.o		\
720	pthr_barrier.o		\
721	pthr_cond.o		\
722	pthr_mutex.o		\
723	pthr_rwlock.o		\
724	pthread.o		\
725	rtsched.o		\
726	rwlock.o		\
727	scalls.o		\
728	sema.o			\
729	sigaction.o		\
730	spawn.o			\
731	synch.o			\
732	tdb_agent.o		\
733	thr.o			\
734	thread_interface.o	\
735	tls.o			\
736	tsd.o
737
738THREADSMACHOBJS=		\
739	machdep.o
740
741THREADSASMOBJS=			\
742	asm_subr.o
743
744UNWINDMACHOBJS=			\
745	call_frame_inst.o	\
746	eh_frame.o		\
747	thrp_unwind.o		\
748	unwind.o
749
750pics/unwind.o:= COPTFLAG64 =
751
752UNWINDASMOBJS=			\
753	unwind_frame.o
754
755# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
756# This macro should ALWAYS be empty; native APIs are already 'large file'.
757PORTSYS64=
758
759PORTSYS=			\
760	_autofssys.o		\
761	acctctl.o		\
762	bsd_signal.o		\
763	corectl.o		\
764	exacctsys.o		\
765	execl.o			\
766	execle.o		\
767	execv.o			\
768	fcntl.o			\
769	fsmisc.o		\
770	fstatat.o		\
771	fsync.o			\
772	getpeerucred.o		\
773	inst_sync.o		\
774	issetugid.o		\
775	label.o			\
776	libc_link.o		\
777	libc_open.o		\
778	lockf.o			\
779	lwp.o			\
780	lwp_cond.o		\
781	lwp_rwlock.o		\
782	lwp_sigmask.o		\
783	meminfosys.o		\
784	msgsys.o		\
785	nfssys.o		\
786	openat.o		\
787	pgrpsys.o		\
788	posix_sigwait.o		\
789	ppriv.o			\
790	psetsys.o		\
791	rctlsys.o		\
792	sbrk.o			\
793	semsys.o		\
794	set_errno.o		\
795	shmsys.o		\
796	siginterrupt.o		\
797	signal.o		\
798	sigpending.o		\
799	sigstack.o		\
800	tasksys.o		\
801	time.o			\
802	time_util.o		\
803	ucontext.o		\
804	ustat.o			\
805	zone.o
806
807PORTREGEX=			\
808	glob.o			\
809	regcmp.o		\
810	regex.o			\
811	wordexp.o
812
813MOSTOBJS=			\
814	$(STRETS)		\
815	$(CRTOBJS)		\
816	$(DYNOBJS)		\
817	$(FPOBJS)		\
818	$(I386FPOBJS)		\
819	$(FPASMOBJS)		\
820	$(ATOMICOBJS)		\
821	$(COMOBJS)		\
822	$(GENOBJS)		\
823	$(PORTFP)		\
824	$(PORTGEN)		\
825	$(PORTGEN64)		\
826	$(PORTI18N)		\
827	$(PORTI18N_COND)	\
828	$(PORTPRINT)		\
829	$(PORTPRINT_W)		\
830	$(PORTREGEX)		\
831	$(PORTSTDIO)		\
832	$(PORTSTDIO64)		\
833	$(PORTSTDIO_W)		\
834	$(PORTSYS)		\
835	$(PORTSYS64)		\
836	$(THREADSOBJS)		\
837	$(THREADSMACHOBJS)	\
838	$(THREADSASMOBJS)	\
839	$(UNWINDMACHOBJS)	\
840	$(UNWINDASMOBJS)	\
841	$(COMSYSOBJS)		\
842	$(SYSOBJS)		\
843	$(COMSYSOBJS64)		\
844	$(SYSOBJS64)
845
846TRACEOBJS=			\
847	plockstat.o
848
849# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
850# modules whose source is provided in the $(SRC)/lib/common directory.
851# This must be done because otherwise the Sun C compiler would insert
852# its own versions of these modules and those versions contain code
853# to call out to C++ initialization functions.  Such C++ initialization
854# functions can call back into libc before thread initialization is
855# complete and this leads to segmentation violations and other problems.
856# Since libc contains no C++ code, linking with the minimal crti.o and
857# crtn.o modules is safe and avoids the problems described above.
858OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
859CRTSRCS= ../../common/amd64
860
861# these aren't listed as $(PICS), so we need to force CTF
862pics/values-Xa.o := POST_PROCESS_O = $(CTFCONVERT_O)
863
864# include common library definitions
865include ../../Makefile.lib
866include ../../Makefile.lib.64
867
868# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
869# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
870# need to be compatible with the ones for the libc stuff.  Whenever the changes
871# that affect the compilation conditions of libc happened, those for libc_i18n
872# also need to be updated.
873
874CFLAGS64 += $(CTF_FLAGS)
875
876# This is necessary to avoid problems with calling _ex_unwind().
877# We probably don't want any inlining anyway.
878CFLAGS64 += -xinline=
879
880# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
881# enables ASSERT() checking in the threads portion of the library.
882# This is automatically enabled for DEBUG builds, not for non-debug builds.
883THREAD_DEBUG =
884$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
885
886CFLAGS64 += $(THREAD_DEBUG)
887
888ALTPICS= $(TRACEOBJS:%=pics/%)
889
890$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
891$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
892
893MAPDIR=		../spec/amd64
894MAPFILE=	$(MAPDIR)/mapfile
895
896CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) \
897		-I. -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) -I/usr/include
898ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
899		-xarch=generic64
900
901# Inform the run-time linker about libc specialized initialization
902RTLDINFO =	-z rtldinfo=tls_rtldinfo
903
904DYNFLAGS +=	-M $(MAPFILE) $(RTLDINFO)
905
906BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
907
908# Override this top level flag so the compiler builds in its native
909# C99 mode.  This has been enabled to support the complex arithmetic
910# added to libc.
911C99MODE=	$(C99_ENABLE)
912
913# libc method of building an archive
914BUILD.AR= $(RM) $@ ; \
915	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
916
917# extra files for the clean target
918CLEANFILES=			\
919	../port/gen/errlst.c	\
920	../port/gen/new_list.c	\
921	assym.h			\
922	genassym		\
923	crt/_rtld.s		\
924	pics/crti.o		\
925	pics/crtn.o		\
926	pics/values-Xa.o	\
927	$(ALTPICS)
928
929CLOBBERFILES +=	$(MAPFILE) $(LIB_PIC)
930
931# list of C source for lint
932SRCS=							\
933	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
934	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
935	$(PORTFP:%.o=../port/fp/%.c)			\
936	$(PORTGEN:%.o=../port/gen/%.c)			\
937	$(PORTI18N:%.o=../port/i18n/%.c)		\
938	$(PORTPRINT:%.o=../port/print/%.c)		\
939	$(PORTREGEX:%.o=../port/regex/%.c)		\
940	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
941	$(PORTSYS:%.o=../port/sys/%.c)			\
942	$(THREADSOBJS:%.o=../port/threads/%.c)		\
943	$(THREADSMACHOBJS:%.o=threads/%.c)		\
944	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
945	$(FPOBJS:%.o=fp/%.c)				\
946	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
947	$(LIBCBASE)/gen/ecvt.c				\
948	$(LIBCBASE)/gen/lexp10.c			\
949	$(LIBCBASE)/gen/llog10.c			\
950	$(LIBCBASE)/gen/ltostr.c			\
951	$(LIBCBASE)/gen/makectxt.c			\
952	$(LIBCBASE)/gen/siginfolst.c			\
953	$(LIBCBASE)/gen/siglongjmp.c			\
954	$(LIBCBASE)/gen/sync_instruction_memory.c	\
955	$(LIBCBASE)/sys/uadmin.c
956
957# conditional assignments
958# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
959$(DYNLIB) := CRTI = crti.o values-Xa.o
960$(DYNLIB) := CRTN = crtn.o
961
962$(DYNLIB):	$(MAPFILE)
963
964$(MAPFILE):
965	@cd $(MAPDIR); $(MAKE) mapfile
966
967# Files which need the threads .il inline template
968TIL=				\
969	alloc.o			\
970	assfail.o		\
971	atexit.o		\
972	atfork.o		\
973	cancel.o		\
974	door_calls.o		\
975	errno.o			\
976	lwp.o			\
977	machdep.o		\
978	pthr_attr.o		\
979	pthr_barrier.o		\
980	pthr_cond.o		\
981	pthr_mutex.o		\
982	pthr_rwlock.o		\
983	pthread.o		\
984	rand.o			\
985	rtsched.o		\
986	rwlock.o		\
987	scalls.o		\
988	sema.o			\
989	sigaction.o		\
990	spawn.o			\
991	stack.o			\
992	synch.o			\
993	tdb_agent.o		\
994	thr.o			\
995	thread_interface.o	\
996	thrp_unwind.o		\
997	tls.o			\
998	tsd.o
999
1000$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1001
1002# pics/mul64.o := CFLAGS64 += crt/mul64.il
1003
1004# large-file-aware components that should be built large
1005
1006#$(COMSYSOBJS64:%=pics/%) := \
1007#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1008
1009#$(SYSOBJS64:%=pics/%) := \
1010#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1011
1012#$(PORTGEN64:%=pics/%) := \
1013#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1014
1015#$(PORTSTDIO64:%=pics/%) := \
1016#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1017
1018#$(PORTSYS64:%=pics/%) := \
1019#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1020
1021$(PORTSTDIO_W:%=pics/%) := \
1022	CPPFLAGS += -D_WIDE
1023
1024$(PORTPRINT_W:%=pics/%) := \
1025	CPPFLAGS += -D_WIDE
1026
1027$(PORTPRINT_C89:%=pics/%) := \
1028	CPPFLAGS += -D_C89_INTMAX32
1029
1030$(PORTSTDIO_C89:%=pics/%) := \
1031	CPPFLAGS += -D_C89_INTMAX32
1032
1033$(PORTI18N_COND:%=pics/%) := \
1034	CPPFLAGS += -D_WCS_LONGLONG
1035
1036.KEEP_STATE:
1037
1038all: $(LIBS) $(LIB_PIC)
1039
1040lint	:=	CPPFLAGS += -I../$(MACH)/fp
1041lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1042lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1043
1044lint:
1045	@echo $(LINT.c) ... $(LDLIBS)
1046	@$(LINT.c) $(SRCS) $(LDLIBS)
1047
1048$(LINTLIB):= SRCS=../port/llib-lc
1049$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1050$(LINTLIB):= LINTFLAGS64=-nvx -Xarch=amd64
1051
1052# object files that depend on inline template
1053$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1054# pics/mul64.o: crt/mul64.il
1055
1056# include common libc targets
1057include ../Makefile.targ
1058
1059# We need to strip out all CTF data from the static library
1060$(LIB_PIC) := DIR = pics
1061$(LIB_PIC): pics $$(PICS)
1062	$(BUILD.AR)
1063	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1064	$(AR) -ts $@ > /dev/null
1065	$(POST_PROCESS_A)
1066
1067ASSYMDEP_OBJS=			\
1068	_lwp_mutex_unlock.o	\
1069	_stack_grow.o		\
1070	asm_subr.o		\
1071	getcontext.o		\
1072	tls_get_addr.o		\
1073	vfork.o
1074
1075$(ASSYMDEP_OBJS:%=pics/%): assym.h
1076
1077# assym.h build rules
1078
1079GENASSYM_C = genassym.c
1080
1081# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1082#	live in Makefile.master
1083
1084CPPFLAGS.genassym = \
1085	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1086
1087genassym: $(GENASSYM_C)
1088	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1089
1090OFFSETS = ../$(MACH)/offsets.in
1091
1092assym.h: $(OFFSETS) genassym
1093	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1094	./genassym >>$@
1095
1096# derived C source and related explicit dependencies
1097../port/gen/errlst.c + \
1098../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1099	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1100
1101pics/errlst.o: ../port/gen/errlst.c
1102
1103pics/new_list.o: ../port/gen/new_list.c
1104