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