xref: /titanic_44/usr/src/lib/libc/amd64/Makefile (revision 4eaa471005973e11a6110b69fe990530b3b95a38)
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 2009 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	strtoll.o		\
99	strtoull.o
100
101GENOBJS=			\
102	_getsp.o		\
103	abs.o			\
104	alloca.o		\
105	attrat.o		\
106	byteorder.o		\
107	cuexit.o		\
108	ecvt.o			\
109	errlst.o		\
110	amd64_data.o		\
111	ldivide.o		\
112	lock.o			\
113	makectxt.o		\
114	memccpy.o		\
115	memchr.o		\
116	memcmp.o		\
117	memcpy.o		\
118	memset.o		\
119	new_list.o		\
120	proc64_id.o		\
121	proc64_support.o	\
122	setjmp.o		\
123	siginfolst.o		\
124	siglongjmp.o		\
125	strcmp.o		\
126	strcpy.o		\
127	strlen.o		\
128	strncmp.o		\
129	strncpy.o		\
130	strnlen.o		\
131	sync_instruction_memory.o
132
133# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
134# This macro should ALWAYS be empty; native APIs are already 'large file'.
135COMSYSOBJS64=
136
137SYSOBJS64=
138
139COMSYSOBJS=			\
140	__clock_timer.o		\
141	__getloadavg.o		\
142	__rusagesys.o		\
143	__signotify.o		\
144	__sigrt.o		\
145	__time.o		\
146	_lgrp_home_fast.o	\
147	_lgrpsys.o		\
148	_nfssys.o		\
149	_portfs.o		\
150	_pset.o			\
151	_rpcsys.o		\
152	_sigaction.o		\
153	_so_accept.o		\
154	_so_bind.o		\
155	_so_connect.o		\
156	_so_getpeername.o	\
157	_so_getsockname.o	\
158	_so_getsockopt.o	\
159	_so_listen.o		\
160	_so_recv.o		\
161	_so_recvfrom.o		\
162	_so_recvmsg.o		\
163	_so_send.o		\
164	_so_sendmsg.o		\
165	_so_sendto.o		\
166	_so_setsockopt.o	\
167	_so_shutdown.o		\
168	_so_socket.o		\
169	_so_socketpair.o	\
170	_sockconfig.o		\
171	access.o		\
172	acct.o			\
173	acl.o			\
174	adjtime.o		\
175	alarm.o			\
176	brk.o			\
177	chdir.o			\
178	chmod.o			\
179	chown.o			\
180	chroot.o		\
181	cladm.o			\
182	close.o			\
183	creat.o			\
184	dup.o			\
185	execve.o		\
186	exit.o			\
187	facl.o			\
188	fchdir.o		\
189	fchmod.o		\
190	fchown.o		\
191	fchroot.o		\
192	fcntl.o			\
193	fdsync.o		\
194	fpathconf.o		\
195	fstat.o			\
196	fstatfs.o		\
197	fstatvfs.o		\
198	getcpuid.o		\
199	getdents.o		\
200	getegid.o		\
201	geteuid.o		\
202	getgid.o		\
203	getgroups.o		\
204	gethrtime.o		\
205	getitimer.o		\
206	getmsg.o		\
207	getpid.o		\
208	getpmsg.o		\
209	getppid.o		\
210	getrlimit.o		\
211	getuid.o		\
212	gtty.o			\
213	install_utrap.o		\
214	ioctl.o			\
215	kaio.o			\
216	kill.o			\
217	lchown.o		\
218	link.o			\
219	llseek.o		\
220	lseek.o			\
221	lstat.o			\
222	mmapobjsys.o		\
223	memcntl.o		\
224	mincore.o		\
225	mkdir.o			\
226	mknod.o			\
227	mmap.o			\
228	modctl.o		\
229	mount.o			\
230	mprotect.o		\
231	munmap.o		\
232	nice.o			\
233	ntp_adjtime.o		\
234	ntp_gettime.o		\
235	open.o			\
236	p_online.o		\
237	pathconf.o		\
238	pause.o			\
239	pcsample.o		\
240	pollsys.o		\
241	pread.o			\
242	priocntlset.o		\
243	processor_bind.o	\
244	processor_info.o	\
245	profil.o		\
246	putmsg.o		\
247	putpmsg.o		\
248	pwrite.o		\
249	read.o			\
250	readlink.o		\
251	readv.o			\
252	rename.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	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	strtoumax.o		\
550	swab.o			\
551	swapctl.o		\
552	sysconf.o		\
553	syslog.o		\
554	tcdrain.o		\
555	tcflow.o		\
556	tcflush.o		\
557	tcgetattr.o		\
558	tcgetpgrp.o		\
559	tcgetsid.o		\
560	tcsendbreak.o		\
561	tcsetattr.o		\
562	tcsetpgrp.o		\
563	tell.o			\
564	telldir.o		\
565	tfind.o			\
566	time_data.o		\
567	time_gdata.o		\
568	truncate.o		\
569	tsdalloc.o		\
570	tsearch.o		\
571	ttyname.o		\
572	ttyslot.o		\
573	ualarm.o		\
574	ucred.o			\
575	valloc.o		\
576	vlfmt.o			\
577	vpfmt.o			\
578	waitpid.o		\
579	walkstack.o		\
580	wdata.o			\
581	xgetwidth.o		\
582	xpg4.o			\
583	xpg6.o
584
585PORTPRINT_W=			\
586	doprnt_w.o
587
588PORTPRINT=			\
589	asprintf.o		\
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	fsmisc.o		\
796	fstatat.o		\
797	getpagesizes.o		\
798	getpeerucred.o		\
799	inst_sync.o		\
800	issetugid.o		\
801	label.o			\
802	libc_fcntl.o		\
803	libc_link.o		\
804	libc_open.o		\
805	lockf.o			\
806	lwp.o			\
807	lwp_cond.o		\
808	lwp_rwlock.o		\
809	lwp_sigmask.o		\
810	meminfosys.o		\
811	msgsys.o		\
812	nfssys.o		\
813	openat.o		\
814	pgrpsys.o		\
815	posix_sigwait.o		\
816	ppriv.o			\
817	psetsys.o		\
818	rctlsys.o		\
819	sbrk.o			\
820	semsys.o		\
821	set_errno.o		\
822	sharefs.o		\
823	shmsys.o		\
824	sidsys.o		\
825	siginterrupt.o		\
826	signal.o		\
827	sigpending.o		\
828	sigstack.o		\
829	tasksys.o		\
830	time.o			\
831	time_util.o		\
832	ucontext.o		\
833	ustat.o			\
834	utimesys.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
922# Make string literals read-only to save memory
923CFLAGS64 += $(XSTRCONST)
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) $(THREAD_DEBUG) \
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# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
943pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
944
945# Inform the run-time linker about libc specialized initialization
946RTLDINFO =	-z rtldinfo=tls_rtldinfo
947DYNFLAGS +=	$(RTLDINFO)
948
949# Force libc's internal references to be resolved immediately upon loading
950# in order to avoid critical region problems.  Since almost all libc symbols
951# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
952DYNFLAGS +=	-znow
953
954BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
955
956# Override this top level flag so the compiler builds in its native
957# C99 mode.  This has been enabled to support the complex arithmetic
958# added to libc.
959C99MODE=	$(C99_ENABLE)
960
961# libc method of building an archive
962BUILD.AR= $(RM) $@ ; \
963	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
964
965# extra files for the clean target
966CLEANFILES=			\
967	../port/gen/errlst.c	\
968	../port/gen/new_list.c	\
969	assym.h			\
970	genassym		\
971	crt/_rtld.s		\
972	pics/crti.o		\
973	pics/crtn.o		\
974	$(ALTPICS)
975
976CLOBBERFILES +=	$(LIB_PIC)
977
978# list of C source for lint
979SRCS=							\
980	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
981	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
982	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
983	$(PORTFP:%.o=../port/fp/%.c)			\
984	$(PORTGEN:%.o=../port/gen/%.c)			\
985	$(PORTI18N:%.o=../port/i18n/%.c)		\
986	$(PORTPRINT:%.o=../port/print/%.c)		\
987	$(PORTREGEX:%.o=../port/regex/%.c)		\
988	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
989	$(PORTSYS:%.o=../port/sys/%.c)			\
990	$(AIOOBJS:%.o=../port/aio/%.c)			\
991	$(RTOBJS:%.o=../port/rt/%.c)			\
992	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
993	$(THREADSOBJS:%.o=../port/threads/%.c)		\
994	$(THREADSMACHOBJS:%.o=threads/%.c)		\
995	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
996	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
997	$(FPOBJS:%.o=fp/%.c)				\
998	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
999	$(LIBCBASE)/gen/ecvt.c				\
1000	$(LIBCBASE)/gen/makectxt.c			\
1001	$(LIBCBASE)/gen/siginfolst.c			\
1002	$(LIBCBASE)/gen/siglongjmp.c			\
1003	$(LIBCBASE)/gen/sync_instruction_memory.c	\
1004	$(LIBCBASE)/sys/uadmin.c
1005
1006# conditional assignments
1007# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1008$(DYNLIB) := CRTI = crti.o
1009$(DYNLIB) := CRTN = crtn.o
1010
1011# Files which need the threads .il inline template
1012TIL=				\
1013	aio.o			\
1014	alloc.o			\
1015	assfail.o		\
1016	atexit.o		\
1017	atfork.o		\
1018	cancel.o		\
1019	door_calls.o		\
1020	errno.o			\
1021	lwp.o			\
1022	ma.o			\
1023	machdep.o		\
1024	posix_aio.o		\
1025	pthr_attr.o		\
1026	pthr_barrier.o		\
1027	pthr_cond.o		\
1028	pthr_mutex.o		\
1029	pthr_rwlock.o		\
1030	pthread.o		\
1031	rand.o			\
1032	rwlock.o		\
1033	scalls.o		\
1034	sched.o			\
1035	sema.o			\
1036	sigaction.o		\
1037	sigev_thread.o		\
1038	spawn.o			\
1039	stack.o			\
1040	synch.o			\
1041	tdb_agent.o		\
1042	thr.o			\
1043	thread_interface.o	\
1044	thread_pool.o		\
1045	thrp_unwind.o		\
1046	tls.o			\
1047	tsd.o
1048
1049$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1050
1051# pics/mul64.o := CFLAGS64 += crt/mul64.il
1052
1053# large-file-aware components that should be built large
1054
1055#$(COMSYSOBJS64:%=pics/%) := \
1056#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1057
1058#$(SYSOBJS64:%=pics/%) := \
1059#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1060
1061#$(PORTGEN64:%=pics/%) := \
1062#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1063
1064#$(PORTSTDIO64:%=pics/%) := \
1065#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1066
1067#$(PORTSYS64:%=pics/%) := \
1068#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1069
1070$(PORTSTDIO_W:%=pics/%) := \
1071	CPPFLAGS += -D_WIDE
1072
1073$(PORTPRINT_W:%=pics/%) := \
1074	CPPFLAGS += -D_WIDE
1075
1076$(PORTPRINT_C89:%=pics/%) := \
1077	CPPFLAGS += -D_C89_INTMAX32
1078
1079$(PORTSTDIO_C89:%=pics/%) := \
1080	CPPFLAGS += -D_C89_INTMAX32
1081
1082$(PORTI18N_COND:%=pics/%) := \
1083	CPPFLAGS += -D_WCS_LONGLONG
1084
1085.KEEP_STATE:
1086
1087all: $(LIBS) $(LIB_PIC)
1088
1089lint	:=	CPPFLAGS += -I../$(MACH)/fp
1090lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1091lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1092
1093lint:
1094	@echo $(LINT.c) ... $(LDLIBS)
1095	@$(LINT.c) $(SRCS) $(LDLIBS)
1096
1097$(LINTLIB):= SRCS=../port/llib-lc
1098$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1099$(LINTLIB):= LINTFLAGS64=-nvx -m64
1100
1101# object files that depend on inline template
1102$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1103# pics/mul64.o: crt/mul64.il
1104
1105# include common libc targets
1106include ../Makefile.targ
1107
1108# We need to strip out all CTF data from the static library
1109$(LIB_PIC) := DIR = pics
1110$(LIB_PIC): pics $$(PICS)
1111	$(BUILD.AR)
1112	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1113	$(AR) -ts $@ > /dev/null
1114	$(POST_PROCESS_A)
1115
1116ASSYMDEP_OBJS=			\
1117	_lwp_mutex_unlock.o	\
1118	_stack_grow.o		\
1119	asm_subr.o		\
1120	getcontext.o		\
1121	tls_get_addr.o		\
1122	vforkx.o
1123
1124$(ASSYMDEP_OBJS:%=pics/%): assym.h
1125
1126# assym.h build rules
1127
1128GENASSYM_C = genassym.c
1129
1130# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1131#	live in Makefile.master
1132
1133CPPFLAGS.genassym = \
1134	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1135
1136genassym: $(GENASSYM_C)
1137	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1138
1139OFFSETS = ../$(MACH)/offsets.in
1140
1141assym.h: $(OFFSETS) genassym
1142	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1143	./genassym >>$@
1144
1145# derived C source and related explicit dependencies
1146../port/gen/errlst.c + \
1147../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1148	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1149
1150pics/errlst.o: ../port/gen/errlst.c
1151
1152pics/new_list.o: ../port/gen/new_list.c
1153