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