xref: /titanic_50/usr/src/lib/libc/amd64/Makefile (revision 0373a3df1f0034861e6d4551f43396675f5784f2)
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	mmapobjsys.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	rename.o		\
251	resolvepath.o		\
252	rmdir.o			\
253	seteguid.o		\
254	setgid.o		\
255	setgroups.o		\
256	setitimer.o		\
257	setreid.o		\
258	setrlimit.o		\
259	setuid.o		\
260	sigaltstk.o		\
261	sigprocmsk.o		\
262	sigsendset.o		\
263	sigsuspend.o		\
264	stat.o			\
265	statfs.o		\
266	statvfs.o		\
267	stty.o			\
268	symlink.o		\
269	sync.o			\
270	sysconfig.o		\
271	sysfs.o			\
272	sysinfo.o		\
273	syslwp.o		\
274	times.o			\
275	ulimit.o		\
276	umask.o			\
277	umount2.o		\
278	unlink.o		\
279	utime.o			\
280	utimes.o		\
281	utssys.o		\
282	uucopy.o		\
283	vhangup.o		\
284	waitid.o		\
285	write.o			\
286	writev.o		\
287	yield.o
288
289SYSOBJS=			\
290	__clock_gettime.o	\
291	__getcontext.o		\
292	__uadmin.o		\
293	_lwp_mutex_unlock.o	\
294	_stack_grow.o		\
295	door.o			\
296	forkx.o			\
297	forkallx.o		\
298	fxstat.o		\
299	getcontext.o		\
300	gettimeofday.o		\
301	lwp_private.o		\
302	lxstat.o		\
303	nuname.o		\
304	pipe.o			\
305	syscall.o		\
306	sysi86.o		\
307	tls_get_addr.o		\
308	uadmin.o		\
309	umount.o		\
310	uname.o			\
311	vforkx.o		\
312	xmknod.o		\
313	xstat.o
314
315# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
316# This macro should ALWAYS be empty; native APIs are already 'large file'.
317PORTGEN64=
318
319# objects from source under ../port
320PORTFP=				\
321	__flt_decim.o		\
322	__flt_rounds.o		\
323	__tbl_10_b.o		\
324	__tbl_10_h.o		\
325	__tbl_10_s.o		\
326	__tbl_2_b.o		\
327	__tbl_2_h.o		\
328	__tbl_2_s.o		\
329	__tbl_fdq.o		\
330	__tbl_tens.o		\
331	__x_power.o		\
332	_base_sup.o		\
333	aconvert.o		\
334	decimal_bin.o		\
335	double_decim.o		\
336	econvert.o		\
337	fconvert.o		\
338	file_decim.o		\
339	finite.o		\
340	fp_data.o		\
341	func_decim.o		\
342	gconvert.o		\
343	hex_bin.o		\
344	ieee_globals.o		\
345	pack_float.o		\
346	sigfpe.o		\
347	string_decim.o
348
349PORTGEN=			\
350	_env_data.o		\
351	_xftw.o			\
352	a64l.o			\
353	abort.o			\
354	addsev.o		\
355	assert.o		\
356	atof.o			\
357	atoi.o			\
358	atol.o			\
359	atoll.o			\
360	attropen.o		\
361	atexit.o		\
362	atfork.o		\
363	basename.o		\
364	calloc.o		\
365	catgets.o		\
366	catopen.o		\
367	cfgetispeed.o		\
368	cfgetospeed.o		\
369	cfree.o			\
370	cfsetispeed.o		\
371	cfsetospeed.o		\
372	cftime.o		\
373	clock.o			\
374	closedir.o		\
375	closefrom.o		\
376	confstr.o		\
377	crypt.o			\
378	csetlen.o		\
379	ctime.o			\
380	ctime_r.o		\
381	deflt.o			\
382	directio.o		\
383	dirname.o		\
384	div.o			\
385	drand48.o		\
386	dup2.o			\
387	env_data.o		\
388	err.o			\
389	errno.o			\
390	euclen.o		\
391	event_port.o		\
392	execvp.o		\
393	fattach.o		\
394	fdetach.o		\
395	fdopendir.o		\
396	fmtmsg.o		\
397	ftime.o			\
398	ftok.o			\
399	ftw.o			\
400	gcvt.o			\
401	getauxv.o		\
402	getcwd.o		\
403	getdate_err.o		\
404	getdtblsize.o		\
405	getenv.o		\
406	getexecname.o		\
407	getgrnam.o		\
408	getgrnam_r.o		\
409	gethostid.o		\
410	gethostname.o		\
411	gethz.o			\
412	getisax.o		\
413	getloadavg.o		\
414	getlogin.o		\
415	getmntent.o		\
416	getnetgrent.o		\
417	getopt.o		\
418	getopt_long.o		\
419	getpagesize.o		\
420	getpw.o			\
421	getpwnam.o		\
422	getpwnam_r.o		\
423	getrusage.o		\
424	getspent.o		\
425	getspent_r.o		\
426	getsubopt.o		\
427	gettxt.o		\
428	getusershell.o		\
429	getut.o			\
430	getutx.o		\
431	getvfsent.o		\
432	getwd.o			\
433	getwidth.o		\
434	getxby_door.o		\
435	gtxt.o			\
436	hsearch.o		\
437	iconv.o			\
438	imaxabs.o		\
439	imaxdiv.o		\
440	index.o			\
441	initgroups.o		\
442	insque.o		\
443	isaexec.o		\
444	isastream.o		\
445	isatty.o		\
446	killpg.o		\
447	klpdlib.o		\
448	l64a.o			\
449	lckpwdf.o		\
450	lconstants.o		\
451	lexp10.o		\
452	lfind.o			\
453	lfmt.o			\
454	lfmt_log.o		\
455	lldiv.o			\
456	llog10.o		\
457	lltostr.o		\
458	lmath.o			\
459	localtime.o		\
460	lsearch.o		\
461	madvise.o		\
462	malloc.o		\
463	memalign.o		\
464	mkdev.o			\
465	mkdtemp.o		\
466	mkfifo.o		\
467	mkstemp.o		\
468	mktemp.o		\
469	mlock.o			\
470	mlockall.o		\
471	mon.o			\
472	msync.o			\
473	munlock.o		\
474	munlockall.o		\
475	ndbm.o			\
476	nftw.o			\
477	nlspath_checks.o	\
478	nsparse.o		\
479	nss_common.o		\
480	nss_dbdefs.o		\
481	nss_deffinder.o		\
482	opendir.o		\
483	opt_data.o		\
484	perror.o		\
485	pfmt.o			\
486	pfmt_data.o		\
487	pfmt_print.o		\
488	plock.o			\
489	poll.o			\
490	posix_fadvise.o		\
491	posix_fallocate.o	\
492	posix_madvise.o		\
493	posix_memalign.o	\
494	priocntl.o		\
495	privlib.o		\
496	priv_str_xlate.o	\
497	psiginfo.o		\
498	psignal.o		\
499	pt.o			\
500	putpwent.o		\
501	putspent.o		\
502	raise.o			\
503	rand.o			\
504	random.o		\
505	rctlops.o		\
506	readdir.o		\
507	readdir_r.o		\
508	realpath.o		\
509	reboot.o		\
510	regexpr.o		\
511	remove.o		\
512	rewinddir.o		\
513	rindex.o		\
514	scandir.o		\
515	seekdir.o		\
516	select.o		\
517	setlabel.o		\
518	setpriority.o		\
519	settimeofday.o		\
520	sh_locks.o		\
521	sigflag.o		\
522	siglist.o		\
523	sigsend.o		\
524	sigsetops.o		\
525	ssignal.o		\
526	stack.o			\
527	str2sig.o		\
528	strcase_charmap.o	\
529	strcasecmp.o		\
530	strcat.o		\
531	strchr.o		\
532	strcspn.o		\
533	strdup.o		\
534	strerror.o		\
535	strlcat.o		\
536	strlcpy.o		\
537	strncasecmp.o		\
538	strncat.o		\
539	strpbrk.o		\
540	strrchr.o		\
541	strsep.o		\
542	strsignal.o		\
543	strspn.o		\
544	strstr.o		\
545	strtod.o		\
546	strtoimax.o		\
547	strtok.o		\
548	strtok_r.o		\
549	strtoll.o		\
550	strtoull.o		\
551	strtoumax.o		\
552	swab.o			\
553	swapctl.o		\
554	sysconf.o		\
555	syslog.o		\
556	tcdrain.o		\
557	tcflow.o		\
558	tcflush.o		\
559	tcgetattr.o		\
560	tcgetpgrp.o		\
561	tcgetsid.o		\
562	tcsendbreak.o		\
563	tcsetattr.o		\
564	tcsetpgrp.o		\
565	tell.o			\
566	telldir.o		\
567	tfind.o			\
568	time_data.o		\
569	time_gdata.o		\
570	truncate.o		\
571	tsdalloc.o		\
572	tsearch.o		\
573	ttyname.o		\
574	ttyslot.o		\
575	ualarm.o		\
576	ucred.o			\
577	valloc.o		\
578	vlfmt.o			\
579	vpfmt.o			\
580	waitpid.o		\
581	walkstack.o		\
582	wdata.o			\
583	xgetwidth.o		\
584	xpg4.o			\
585	xpg6.o
586
587PORTPRINT_W=			\
588	doprnt_w.o
589
590PORTPRINT=			\
591	doprnt.o		\
592	fprintf.o		\
593	printf.o		\
594	snprintf.o		\
595	sprintf.o		\
596	vfprintf.o		\
597	vprintf.o		\
598	vsnprintf.o		\
599	vsprintf.o		\
600	vwprintf.o		\
601	wprintf.o
602
603# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
604# This macro should ALWAYS be empty; native APIs are already 'large file'.
605PORTSTDIO64=
606
607PORTSTDIO_W=			\
608	doscan_w.o
609
610PORTSTDIO=			\
611	__extensions.o		\
612	_endopen.o		\
613	_filbuf.o		\
614	_findbuf.o		\
615	_flsbuf.o		\
616	_wrtchk.o		\
617	clearerr.o		\
618	ctermid.o		\
619	ctermid_r.o		\
620	cuserid.o		\
621	data.o			\
622	doscan.o		\
623	fdopen.o		\
624	feof.o			\
625	ferror.o		\
626	fgetc.o			\
627	fgets.o			\
628	fileno.o		\
629	flockf.o		\
630	flush.o			\
631	fopen.o			\
632	fpos.o			\
633	fputc.o			\
634	fputs.o			\
635	fread.o			\
636	fseek.o			\
637	fseeko.o		\
638	ftell.o			\
639	ftello.o		\
640	fwrite.o		\
641	getc.o			\
642	getchar.o		\
643	getpass.o		\
644	gets.o			\
645	getw.o			\
646	mse.o			\
647	popen.o			\
648	putc.o			\
649	putchar.o		\
650	puts.o			\
651	putw.o			\
652	rewind.o		\
653	scanf.o			\
654	setbuf.o		\
655	setbuffer.o		\
656	setvbuf.o		\
657	system.o		\
658	tempnam.o		\
659	tmpfile.o		\
660	tmpnam_r.o		\
661	ungetc.o		\
662	vscanf.o		\
663	vwscanf.o		\
664	wscanf.o
665
666PORTI18N=			\
667	__fgetwc_xpg5.o		\
668	__fgetws_xpg5.o		\
669	__fputwc_xpg5.o		\
670	__fputws_xpg5.o		\
671	__ungetwc_xpg5.o	\
672	getwchar.o		\
673	putwchar.o		\
674	putws.o			\
675	strtows.o		\
676	wcsstr.o		\
677	wcstoimax.o		\
678	wcstol.o		\
679	wcstoul.o		\
680	wcswcs.o		\
681	wmemchr.o		\
682	wmemcmp.o		\
683	wmemcpy.o		\
684	wmemmove.o		\
685	wmemset.o		\
686	wscasecmp.o		\
687	wscat.o			\
688	wschr.o			\
689	wscmp.o			\
690	wscpy.o			\
691	wscspn.o		\
692	wsdup.o			\
693	wslen.o			\
694	wsncasecmp.o		\
695	wsncat.o		\
696	wsncmp.o		\
697	wsncpy.o		\
698	wspbrk.o		\
699	wsprintf.o		\
700	wsrchr.o		\
701	wsscanf.o		\
702	wsspn.o			\
703	wstod.o			\
704	wstok.o			\
705	wstol.o			\
706	wstoll.o		\
707	wsxfrm.o		\
708	gettext.o		\
709	gettext_gnu.o		\
710	gettext_real.o		\
711	gettext_util.o		\
712	plural_parser.o		\
713	wdresolve.o		\
714	_ctype.o		\
715	isascii.o		\
716	toascii.o
717
718PORTI18N_COND=			\
719	wcstol_longlong.o	\
720	wcstoul_longlong.o
721
722AIOOBJS=			\
723	aio.o			\
724	aio_alloc.o		\
725	posix_aio.o
726
727RTOBJS=				\
728	clock_timer.o		\
729	mqueue.o		\
730	pos4obj.o		\
731	sched.o			\
732	sem.o			\
733	shm.o			\
734	sigev_thread.o
735
736TPOOLOBJS=			\
737	thread_pool.o
738
739THREADSOBJS=			\
740	alloc.o			\
741	assfail.o		\
742	cancel.o		\
743	door_calls.o		\
744	pthr_attr.o		\
745	pthr_barrier.o		\
746	pthr_cond.o		\
747	pthr_mutex.o		\
748	pthr_rwlock.o		\
749	pthread.o		\
750	rwlock.o		\
751	scalls.o		\
752	sema.o			\
753	sigaction.o		\
754	spawn.o			\
755	synch.o			\
756	tdb_agent.o		\
757	thr.o			\
758	thread_interface.o	\
759	tls.o			\
760	tsd.o
761
762THREADSMACHOBJS=		\
763	machdep.o
764
765THREADSASMOBJS=			\
766	asm_subr.o
767
768UNICODEOBJS=			\
769	u8_textprep.o		\
770	uconv.o
771
772UNWINDMACHOBJS=			\
773	call_frame_inst.o	\
774	eh_frame.o		\
775	thrp_unwind.o		\
776	unwind.o
777
778pics/unwind.o:= COPTFLAG64 =
779
780UNWINDASMOBJS=			\
781	unwind_frame.o
782
783# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
784# This macro should ALWAYS be empty; native APIs are already 'large file'.
785PORTSYS64=
786
787PORTSYS=			\
788	_autofssys.o		\
789	acctctl.o		\
790	bsd_signal.o		\
791	corectl.o		\
792	exacctsys.o		\
793	execl.o			\
794	execle.o		\
795	execv.o			\
796	faccessat.o		\
797	fsmisc.o		\
798	fstatat.o		\
799	getpagesizes.o		\
800	getpeerucred.o		\
801	inst_sync.o		\
802	issetugid.o		\
803	label.o			\
804	libc_fcntl.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
923ALTPICS= $(TRACEOBJS:%=pics/%)
924
925$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
926$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
927
928MAPFILES =	../port/mapfile-vers mapfile-vers
929
930CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
931		-I. -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) -I/usr/include
932ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
933		$(amd64_AS_XARCH)
934
935# Conditionally add support for making |wordexp()| check whether
936# /usr/bin/ksh is ksh93 or not
937include ../../../Makefile.ksh93switch
938CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
939
940# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
941pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
942
943# Inform the run-time linker about libc specialized initialization
944RTLDINFO =	-z rtldinfo=tls_rtldinfo
945DYNFLAGS +=	$(RTLDINFO)
946
947BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
948
949# Override this top level flag so the compiler builds in its native
950# C99 mode.  This has been enabled to support the complex arithmetic
951# added to libc.
952C99MODE=	$(C99_ENABLE)
953
954# libc method of building an archive
955BUILD.AR= $(RM) $@ ; \
956	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
957
958# extra files for the clean target
959CLEANFILES=			\
960	../port/gen/errlst.c	\
961	../port/gen/new_list.c	\
962	assym.h			\
963	genassym		\
964	crt/_rtld.s		\
965	pics/crti.o		\
966	pics/crtn.o		\
967	$(ALTPICS)
968
969CLOBBERFILES +=	$(LIB_PIC)
970
971# list of C source for lint
972SRCS=							\
973	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
974	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
975	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
976	$(PORTFP:%.o=../port/fp/%.c)			\
977	$(PORTGEN:%.o=../port/gen/%.c)			\
978	$(PORTI18N:%.o=../port/i18n/%.c)		\
979	$(PORTPRINT:%.o=../port/print/%.c)		\
980	$(PORTREGEX:%.o=../port/regex/%.c)		\
981	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
982	$(PORTSYS:%.o=../port/sys/%.c)			\
983	$(AIOOBJS:%.o=../port/aio/%.c)			\
984	$(RTOBJS:%.o=../port/rt/%.c)			\
985	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
986	$(THREADSOBJS:%.o=../port/threads/%.c)		\
987	$(THREADSMACHOBJS:%.o=threads/%.c)		\
988	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
989	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
990	$(FPOBJS:%.o=fp/%.c)				\
991	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
992	$(LIBCBASE)/gen/ecvt.c				\
993	$(LIBCBASE)/gen/makectxt.c			\
994	$(LIBCBASE)/gen/siginfolst.c			\
995	$(LIBCBASE)/gen/siglongjmp.c			\
996	$(LIBCBASE)/gen/sync_instruction_memory.c	\
997	$(LIBCBASE)/sys/uadmin.c
998
999# conditional assignments
1000# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1001$(DYNLIB) := CRTI = crti.o
1002$(DYNLIB) := CRTN = crtn.o
1003
1004# Files which need the threads .il inline template
1005TIL=				\
1006	aio.o			\
1007	alloc.o			\
1008	assfail.o		\
1009	atexit.o		\
1010	atfork.o		\
1011	cancel.o		\
1012	door_calls.o		\
1013	errno.o			\
1014	lwp.o			\
1015	ma.o			\
1016	machdep.o		\
1017	posix_aio.o		\
1018	pthr_attr.o		\
1019	pthr_barrier.o		\
1020	pthr_cond.o		\
1021	pthr_mutex.o		\
1022	pthr_rwlock.o		\
1023	pthread.o		\
1024	rand.o			\
1025	rwlock.o		\
1026	scalls.o		\
1027	sched.o			\
1028	sema.o			\
1029	sigaction.o		\
1030	sigev_thread.o		\
1031	spawn.o			\
1032	stack.o			\
1033	synch.o			\
1034	tdb_agent.o		\
1035	thr.o			\
1036	thread_interface.o	\
1037	thread_pool.o		\
1038	thrp_unwind.o		\
1039	tls.o			\
1040	tsd.o
1041
1042$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1043
1044# pics/mul64.o := CFLAGS64 += crt/mul64.il
1045
1046# large-file-aware components that should be built large
1047
1048#$(COMSYSOBJS64:%=pics/%) := \
1049#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1050
1051#$(SYSOBJS64:%=pics/%) := \
1052#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1053
1054#$(PORTGEN64:%=pics/%) := \
1055#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1056
1057#$(PORTSTDIO64:%=pics/%) := \
1058#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1059
1060#$(PORTSYS64:%=pics/%) := \
1061#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1062
1063$(PORTSTDIO_W:%=pics/%) := \
1064	CPPFLAGS += -D_WIDE
1065
1066$(PORTPRINT_W:%=pics/%) := \
1067	CPPFLAGS += -D_WIDE
1068
1069$(PORTPRINT_C89:%=pics/%) := \
1070	CPPFLAGS += -D_C89_INTMAX32
1071
1072$(PORTSTDIO_C89:%=pics/%) := \
1073	CPPFLAGS += -D_C89_INTMAX32
1074
1075$(PORTI18N_COND:%=pics/%) := \
1076	CPPFLAGS += -D_WCS_LONGLONG
1077
1078.KEEP_STATE:
1079
1080all: $(LIBS) $(LIB_PIC)
1081
1082lint	:=	CPPFLAGS += -I../$(MACH)/fp
1083lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1084lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1085
1086lint:
1087	@echo $(LINT.c) ... $(LDLIBS)
1088	@$(LINT.c) $(SRCS) $(LDLIBS)
1089
1090$(LINTLIB):= SRCS=../port/llib-lc
1091$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1092$(LINTLIB):= LINTFLAGS64=-nvx -m64
1093
1094# object files that depend on inline template
1095$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1096# pics/mul64.o: crt/mul64.il
1097
1098# include common libc targets
1099include ../Makefile.targ
1100
1101# We need to strip out all CTF data from the static library
1102$(LIB_PIC) := DIR = pics
1103$(LIB_PIC): pics $$(PICS)
1104	$(BUILD.AR)
1105	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1106	$(AR) -ts $@ > /dev/null
1107	$(POST_PROCESS_A)
1108
1109ASSYMDEP_OBJS=			\
1110	_lwp_mutex_unlock.o	\
1111	_stack_grow.o		\
1112	asm_subr.o		\
1113	getcontext.o		\
1114	tls_get_addr.o		\
1115	vforkx.o
1116
1117$(ASSYMDEP_OBJS:%=pics/%): assym.h
1118
1119# assym.h build rules
1120
1121GENASSYM_C = genassym.c
1122
1123# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1124#	live in Makefile.master
1125
1126CPPFLAGS.genassym = \
1127	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1128
1129genassym: $(GENASSYM_C)
1130	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1131
1132OFFSETS = ../$(MACH)/offsets.in
1133
1134assym.h: $(OFFSETS) genassym
1135	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1136	./genassym >>$@
1137
1138# derived C source and related explicit dependencies
1139../port/gen/errlst.c + \
1140../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1141	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1142
1143pics/errlst.o: ../port/gen/errlst.c
1144
1145pics/new_list.o: ../port/gen/new_list.c
1146