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