xref: /illumos-gate/usr/src/lib/libc/amd64/Makefile (revision c3a558e7c77127215b010652905be7916ec5a080)
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# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
928pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
929
930# Inform the run-time linker about libc specialized initialization
931RTLDINFO =	-z rtldinfo=tls_rtldinfo
932DYNFLAGS +=	$(RTLDINFO)
933
934# Force libc's internal references to be resolved immediately upon loading
935# in order to avoid critical region problems.  Since almost all libc symbols
936# are marked 'protected' in the mapfiles, this is a minimal set (15 to 20).
937DYNFLAGS +=	-znow
938
939BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
940
941# Override this top level flag so the compiler builds in its native
942# C99 mode.  This has been enabled to support the complex arithmetic
943# added to libc.
944C99MODE=	$(C99_ENABLE)
945
946# libc method of building an archive
947BUILD.AR= $(RM) $@ ; \
948	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
949
950# extra files for the clean target
951CLEANFILES=			\
952	../port/gen/errlst.c	\
953	../port/gen/new_list.c	\
954	assym.h			\
955	genassym		\
956	crt/_rtld.s		\
957	pics/crti.o		\
958	pics/crtn.o		\
959	$(ALTPICS)
960
961CLOBBERFILES +=	$(LIB_PIC)
962
963# list of C source for lint
964SRCS=							\
965	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
966	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
967	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
968	$(PORTFP:%.o=../port/fp/%.c)			\
969	$(PORTGEN:%.o=../port/gen/%.c)			\
970	$(PORTI18N:%.o=../port/i18n/%.c)		\
971	$(PORTPRINT:%.o=../port/print/%.c)		\
972	$(PORTREGEX:%.o=../port/regex/%.c)		\
973	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
974	$(PORTSYS:%.o=../port/sys/%.c)			\
975	$(AIOOBJS:%.o=../port/aio/%.c)			\
976	$(RTOBJS:%.o=../port/rt/%.c)			\
977	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
978	$(THREADSOBJS:%.o=../port/threads/%.c)		\
979	$(THREADSMACHOBJS:%.o=threads/%.c)		\
980	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
981	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
982	$(FPOBJS:%.o=fp/%.c)				\
983	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
984	$(LIBCBASE)/gen/ecvt.c				\
985	$(LIBCBASE)/gen/makectxt.c			\
986	$(LIBCBASE)/gen/siginfolst.c			\
987	$(LIBCBASE)/gen/siglongjmp.c			\
988	$(LIBCBASE)/gen/sync_instruction_memory.c	\
989	$(LIBCBASE)/sys/uadmin.c
990
991# conditional assignments
992# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
993$(DYNLIB) := CRTI = crti.o
994$(DYNLIB) := CRTN = crtn.o
995
996# Files which need the threads .il inline template
997TIL=				\
998	aio.o			\
999	alloc.o			\
1000	assfail.o		\
1001	atexit.o		\
1002	atfork.o		\
1003	cancel.o		\
1004	door_calls.o		\
1005	errno.o			\
1006	lwp.o			\
1007	ma.o			\
1008	machdep.o		\
1009	posix_aio.o		\
1010	pthr_attr.o		\
1011	pthr_barrier.o		\
1012	pthr_cond.o		\
1013	pthr_mutex.o		\
1014	pthr_rwlock.o		\
1015	pthread.o		\
1016	rand.o			\
1017	rwlock.o		\
1018	scalls.o		\
1019	sched.o			\
1020	sema.o			\
1021	sigaction.o		\
1022	sigev_thread.o		\
1023	spawn.o			\
1024	stack.o			\
1025	synch.o			\
1026	tdb_agent.o		\
1027	thr.o			\
1028	thread_interface.o	\
1029	thread_pool.o		\
1030	thrp_unwind.o		\
1031	tls.o			\
1032	tsd.o
1033
1034$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1035
1036# pics/mul64.o := CFLAGS64 += crt/mul64.il
1037
1038# large-file-aware components that should be built large
1039
1040#$(COMSYSOBJS64:%=pics/%) := \
1041#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1042
1043#$(SYSOBJS64:%=pics/%) := \
1044#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1045
1046#$(PORTGEN64:%=pics/%) := \
1047#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1048
1049#$(PORTSTDIO64:%=pics/%) := \
1050#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1051
1052#$(PORTSYS64:%=pics/%) := \
1053#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1054
1055$(PORTSTDIO_W:%=pics/%) := \
1056	CPPFLAGS += -D_WIDE
1057
1058$(PORTPRINT_W:%=pics/%) := \
1059	CPPFLAGS += -D_WIDE
1060
1061$(PORTPRINT_C89:%=pics/%) := \
1062	CPPFLAGS += -D_C89_INTMAX32
1063
1064$(PORTSTDIO_C89:%=pics/%) := \
1065	CPPFLAGS += -D_C89_INTMAX32
1066
1067$(PORTI18N_COND:%=pics/%) := \
1068	CPPFLAGS += -D_WCS_LONGLONG
1069
1070.KEEP_STATE:
1071
1072all: $(LIBS) $(LIB_PIC)
1073
1074lint	:=	CPPFLAGS += -I../$(MACH)/fp
1075lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1076lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1077
1078lint:
1079	@echo $(LINT.c) ... $(LDLIBS)
1080	@$(LINT.c) $(SRCS) $(LDLIBS)
1081
1082$(LINTLIB):= SRCS=../port/llib-lc
1083$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1084$(LINTLIB):= LINTFLAGS64=-nvx -m64
1085
1086# object files that depend on inline template
1087$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1088# pics/mul64.o: crt/mul64.il
1089
1090# include common libc targets
1091include ../Makefile.targ
1092
1093# We need to strip out all CTF data from the static library
1094$(LIB_PIC) := DIR = pics
1095$(LIB_PIC): pics $$(PICS)
1096	$(BUILD.AR)
1097	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1098	$(AR) -ts $@ > /dev/null
1099	$(POST_PROCESS_A)
1100
1101ASSYMDEP_OBJS=			\
1102	_lwp_mutex_unlock.o	\
1103	_stack_grow.o		\
1104	asm_subr.o		\
1105	getcontext.o		\
1106	setjmp.o		\
1107	tls_get_addr.o		\
1108	vforkx.o
1109
1110$(ASSYMDEP_OBJS:%=pics/%): assym.h
1111
1112# assym.h build rules
1113
1114GENASSYM_C = genassym.c
1115
1116# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1117#	live in Makefile.master
1118
1119CPPFLAGS.genassym = \
1120	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1121
1122genassym: $(GENASSYM_C)
1123	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1124
1125OFFSETS = ../$(MACH)/offsets.in
1126
1127assym.h: $(OFFSETS) genassym
1128	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1129	./genassym >>$@
1130
1131# derived C source and related explicit dependencies
1132../port/gen/errlst.c + \
1133../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1134	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1135
1136pics/errlst.o: ../port/gen/errlst.c
1137
1138pics/new_list.o: ../port/gen/new_list.c
1139