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