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