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