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