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