xref: /titanic_41/usr/src/lib/libc/amd64/Makefile (revision b7d3956b92a285d8dac2c7f5f7e28d2ef5347ef8)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28LIBCBASE=.
29
30LIBRARY= libc.a
31LIB_PIC= libc_pic.a
32VERS=	.1
33CPP=	/usr/lib/cpp
34TARGET_ARCH=	amd64
35
36# objects are grouped by source directory
37
38# local objects
39STRETS=
40
41CRTOBJS=			\
42	cerror.o
43
44DYNOBJS=
45
46FPOBJS=				\
47	_base_il.o		\
48	fpgetmask.o		\
49	fpgetround.o		\
50	fpsetmask.o		\
51	fpsetround.o		\
52	fpstart.o
53
54I386FPOBJS=			\
55	_D_cplx_div.o		\
56	_D_cplx_div_ix.o	\
57	_D_cplx_div_rx.o	\
58	_D_cplx_lr_div.o	\
59	_D_cplx_lr_div_ix.o	\
60	_D_cplx_lr_div_rx.o	\
61	_D_cplx_mul.o		\
62	_F_cplx_div.o		\
63	_F_cplx_div_ix.o	\
64	_F_cplx_div_rx.o	\
65	_F_cplx_lr_div.o	\
66	_F_cplx_lr_div_ix.o	\
67	_F_cplx_lr_div_rx.o	\
68	_F_cplx_mul.o		\
69	_X_cplx_div.o		\
70	_X_cplx_div_ix.o	\
71	_X_cplx_div_rx.o	\
72	_X_cplx_lr_div.o	\
73	_X_cplx_lr_div_ix.o	\
74	_X_cplx_lr_div_rx.o	\
75	_X_cplx_mul.o
76
77FPASMOBJS=			\
78	__xgetRD.o		\
79	_xtoll.o		\
80	_xtoull.o		\
81	fpcw.o			\
82	fpgetsticky.o		\
83	fpsetsticky.o
84
85ATOMICOBJS=			\
86	atomic.o
87
88XATTROBJS=			\
89	xattr_common.o
90COMOBJS=			\
91	bcmp.o			\
92	bcopy.o			\
93	bsearch.o		\
94	bzero.o			\
95	ffs.o			\
96	qsort.o			\
97	strtol.o		\
98	strtoul.o
99
100GENOBJS=			\
101	_getsp.o		\
102	abs.o			\
103	alloca.o		\
104	attrat.o		\
105	byteorder.o		\
106	cache.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	memcntl.o		\
223	mincore.o		\
224	mkdir.o			\
225	mknod.o			\
226	mmap.o			\
227	modctl.o		\
228	mount.o			\
229	mprotect.o		\
230	munmap.o		\
231	nice.o			\
232	ntp_adjtime.o		\
233	ntp_gettime.o		\
234	open.o			\
235	p_online.o		\
236	pathconf.o		\
237	pause.o			\
238	pcsample.o		\
239	pollsys.o		\
240	pread.o			\
241	priocntlset.o		\
242	processor_bind.o	\
243	processor_info.o	\
244	profil.o		\
245	putmsg.o		\
246	putpmsg.o		\
247	pwrite.o		\
248	read.o			\
249	readlink.o		\
250	readv.o			\
251	rename.o		\
252	resolvepath.o		\
253	rmdir.o			\
254	seteguid.o		\
255	setgid.o		\
256	setgroups.o		\
257	setitimer.o		\
258	setreid.o		\
259	setrlimit.o		\
260	setuid.o		\
261	sigaltstk.o		\
262	sigprocmsk.o		\
263	sigsendset.o		\
264	sigsuspend.o		\
265	stat.o			\
266	statfs.o		\
267	statvfs.o		\
268	stty.o			\
269	symlink.o		\
270	sync.o			\
271	sysconfig.o		\
272	sysfs.o			\
273	sysinfo.o		\
274	syslwp.o		\
275	times.o			\
276	ulimit.o		\
277	umask.o			\
278	umount2.o		\
279	unlink.o		\
280	utime.o			\
281	utimes.o		\
282	utssys.o		\
283	uucopy.o		\
284	vhangup.o		\
285	waitid.o		\
286	write.o			\
287	writev.o		\
288	yield.o
289
290SYSOBJS=			\
291	__clock_gettime.o	\
292	__getcontext.o		\
293	__uadmin.o		\
294	_lwp_mutex_unlock.o	\
295	_stack_grow.o		\
296	door.o			\
297	forkx.o			\
298	forkallx.o		\
299	fxstat.o		\
300	getcontext.o		\
301	gettimeofday.o		\
302	lwp_private.o		\
303	lxstat.o		\
304	nuname.o		\
305	pipe.o			\
306	syscall.o		\
307	sysi86.o		\
308	tls_get_addr.o		\
309	uadmin.o		\
310	umount.o		\
311	uname.o			\
312	vforkx.o		\
313	xmknod.o		\
314	xstat.o
315
316# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
317# This macro should ALWAYS be empty; native APIs are already 'large file'.
318PORTGEN64=
319
320# objects from source under ../port
321PORTFP=				\
322	__flt_decim.o		\
323	__flt_rounds.o		\
324	__tbl_10_b.o		\
325	__tbl_10_h.o		\
326	__tbl_10_s.o		\
327	__tbl_2_b.o		\
328	__tbl_2_h.o		\
329	__tbl_2_s.o		\
330	__tbl_fdq.o		\
331	__tbl_tens.o		\
332	__x_power.o		\
333	_base_sup.o		\
334	aconvert.o		\
335	decimal_bin.o		\
336	double_decim.o		\
337	econvert.o		\
338	fconvert.o		\
339	file_decim.o		\
340	finite.o		\
341	fp_data.o		\
342	func_decim.o		\
343	gconvert.o		\
344	hex_bin.o		\
345	ieee_globals.o		\
346	pack_float.o		\
347	sigfpe.o		\
348	string_decim.o
349
350PORTGEN=			\
351	_env_data.o		\
352	_xftw.o			\
353	a64l.o			\
354	abort.o			\
355	addsev.o		\
356	assert.o		\
357	atof.o			\
358	atoi.o			\
359	atol.o			\
360	atoll.o			\
361	attropen.o		\
362	atexit.o		\
363	atfork.o		\
364	basename.o		\
365	calloc.o		\
366	catgets.o		\
367	catopen.o		\
368	cfgetispeed.o		\
369	cfgetospeed.o		\
370	cfree.o			\
371	cfsetispeed.o		\
372	cfsetospeed.o		\
373	cftime.o		\
374	clock.o			\
375	closedir.o		\
376	closefrom.o		\
377	confstr.o		\
378	crypt.o			\
379	csetlen.o		\
380	ctime.o			\
381	ctime_r.o		\
382	deflt.o			\
383	directio.o		\
384	dirname.o		\
385	div.o			\
386	drand48.o		\
387	dup2.o			\
388	env_data.o		\
389	err.o			\
390	errno.o			\
391	euclen.o		\
392	event_port.o		\
393	execvp.o		\
394	fattach.o		\
395	fdetach.o		\
396	fdopendir.o		\
397	fmtmsg.o		\
398	ftime.o			\
399	ftok.o			\
400	ftw.o			\
401	gcvt.o			\
402	getauxv.o		\
403	getcwd.o		\
404	getdate_err.o		\
405	getdtblsize.o		\
406	getenv.o		\
407	getexecname.o		\
408	getgrnam.o		\
409	getgrnam_r.o		\
410	gethostid.o		\
411	gethostname.o		\
412	gethz.o			\
413	getisax.o		\
414	getloadavg.o		\
415	getlogin.o		\
416	getmntent.o		\
417	getnetgrent.o		\
418	getopt.o		\
419	getopt_long.o		\
420	getpagesize.o		\
421	getpw.o			\
422	getpwnam.o		\
423	getpwnam_r.o		\
424	getrusage.o		\
425	getspent.o		\
426	getspent_r.o		\
427	getsubopt.o		\
428	gettxt.o		\
429	getusershell.o		\
430	getut.o			\
431	getutx.o		\
432	getvfsent.o		\
433	getwd.o			\
434	getwidth.o		\
435	getxby_door.o		\
436	gtxt.o			\
437	hsearch.o		\
438	iconv.o			\
439	imaxabs.o		\
440	imaxdiv.o		\
441	index.o			\
442	initgroups.o		\
443	insque.o		\
444	isaexec.o		\
445	isastream.o		\
446	isatty.o		\
447	killpg.o		\
448	klpdlib.o		\
449	l64a.o			\
450	lckpwdf.o		\
451	lconstants.o		\
452	lexp10.o		\
453	lfind.o			\
454	lfmt.o			\
455	lfmt_log.o		\
456	lldiv.o			\
457	llog10.o		\
458	lltostr.o		\
459	lmath.o			\
460	localtime.o		\
461	lsearch.o		\
462	madvise.o		\
463	malloc.o		\
464	memalign.o		\
465	mkdev.o			\
466	mkdtemp.o		\
467	mkfifo.o		\
468	mkstemp.o		\
469	mktemp.o		\
470	mlock.o			\
471	mlockall.o		\
472	mon.o			\
473	msync.o			\
474	munlock.o		\
475	munlockall.o		\
476	ndbm.o			\
477	nftw.o			\
478	nlspath_checks.o	\
479	nsparse.o		\
480	nss_common.o		\
481	nss_dbdefs.o		\
482	nss_deffinder.o		\
483	opendir.o		\
484	opt_data.o		\
485	perror.o		\
486	pfmt.o			\
487	pfmt_data.o		\
488	pfmt_print.o		\
489	plock.o			\
490	poll.o			\
491	posix_fadvise.o		\
492	posix_fallocate.o	\
493	posix_madvise.o		\
494	posix_memalign.o	\
495	priocntl.o		\
496	privlib.o		\
497	priv_str_xlate.o	\
498	psiginfo.o		\
499	psignal.o		\
500	pt.o			\
501	putpwent.o		\
502	putspent.o		\
503	raise.o			\
504	rand.o			\
505	random.o		\
506	rctlops.o		\
507	readdir.o		\
508	readdir_r.o		\
509	realpath.o		\
510	reboot.o		\
511	regexpr.o		\
512	remove.o		\
513	rewinddir.o		\
514	rindex.o		\
515	scandir.o		\
516	seekdir.o		\
517	select.o		\
518	setlabel.o		\
519	setpriority.o		\
520	settimeofday.o		\
521	sh_locks.o		\
522	sigflag.o		\
523	siglist.o		\
524	sigsend.o		\
525	sigsetops.o		\
526	ssignal.o		\
527	stack.o			\
528	str2sig.o		\
529	strcase_charmap.o	\
530	strcasecmp.o		\
531	strcat.o		\
532	strchr.o		\
533	strcspn.o		\
534	strdup.o		\
535	strerror.o		\
536	strlcat.o		\
537	strlcpy.o		\
538	strncasecmp.o		\
539	strncat.o		\
540	strpbrk.o		\
541	strrchr.o		\
542	strsignal.o		\
543	strspn.o		\
544	strstr.o		\
545	strtod.o		\
546	strtoimax.o		\
547	strtok.o		\
548	strtok_r.o		\
549	strtoll.o		\
550	strtoull.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	doprnt.o		\
592	fprintf.o		\
593	printf.o		\
594	snprintf.o		\
595	sprintf.o		\
596	vfprintf.o		\
597	vprintf.o		\
598	vsnprintf.o		\
599	vsprintf.o		\
600	vwprintf.o		\
601	wprintf.o
602
603# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
604# This macro should ALWAYS be empty; native APIs are already 'large file'.
605PORTSTDIO64=
606
607PORTSTDIO_W=			\
608	doscan_w.o
609
610PORTSTDIO=			\
611	__extensions.o		\
612	_endopen.o		\
613	_filbuf.o		\
614	_findbuf.o		\
615	_flsbuf.o		\
616	_wrtchk.o		\
617	clearerr.o		\
618	ctermid.o		\
619	ctermid_r.o		\
620	cuserid.o		\
621	data.o			\
622	doscan.o		\
623	fdopen.o		\
624	feof.o			\
625	ferror.o		\
626	fgetc.o			\
627	fgets.o			\
628	fileno.o		\
629	flockf.o		\
630	flush.o			\
631	fopen.o			\
632	fpos.o			\
633	fputc.o			\
634	fputs.o			\
635	fread.o			\
636	fseek.o			\
637	fseeko.o		\
638	ftell.o			\
639	ftello.o		\
640	fwrite.o		\
641	getc.o			\
642	getchar.o		\
643	getpass.o		\
644	gets.o			\
645	getw.o			\
646	mse.o			\
647	popen.o			\
648	putc.o			\
649	putchar.o		\
650	puts.o			\
651	putw.o			\
652	rewind.o		\
653	scanf.o			\
654	setbuf.o		\
655	setbuffer.o		\
656	setvbuf.o		\
657	system.o		\
658	tempnam.o		\
659	tmpfile.o		\
660	tmpnam_r.o		\
661	ungetc.o		\
662	vscanf.o		\
663	vwscanf.o		\
664	wscanf.o
665
666PORTI18N=			\
667	__fgetwc_xpg5.o		\
668	__fgetws_xpg5.o		\
669	__fputwc_xpg5.o		\
670	__fputws_xpg5.o		\
671	__ungetwc_xpg5.o	\
672	getwchar.o		\
673	putwchar.o		\
674	putws.o			\
675	strtows.o		\
676	wcsstr.o		\
677	wcstoimax.o		\
678	wcstol.o		\
679	wcstoul.o		\
680	wcswcs.o		\
681	wmemchr.o		\
682	wmemcmp.o		\
683	wmemcpy.o		\
684	wmemmove.o		\
685	wmemset.o		\
686	wscasecmp.o		\
687	wscat.o			\
688	wschr.o			\
689	wscmp.o			\
690	wscpy.o			\
691	wscspn.o		\
692	wsdup.o			\
693	wslen.o			\
694	wsncasecmp.o		\
695	wsncat.o		\
696	wsncmp.o		\
697	wsncpy.o		\
698	wspbrk.o		\
699	wsprintf.o		\
700	wsrchr.o		\
701	wsscanf.o		\
702	wsspn.o			\
703	wstod.o			\
704	wstok.o			\
705	wstol.o			\
706	wstoll.o		\
707	wsxfrm.o		\
708	gettext.o		\
709	gettext_gnu.o		\
710	gettext_real.o		\
711	gettext_util.o		\
712	plural_parser.o		\
713	wdresolve.o		\
714	_ctype.o		\
715	isascii.o		\
716	toascii.o
717
718PORTI18N_COND=			\
719	wcstol_longlong.o	\
720	wcstoul_longlong.o
721
722AIOOBJS=			\
723	aio.o			\
724	aio_alloc.o		\
725	posix_aio.o
726
727RTOBJS=				\
728	clock_timer.o		\
729	mqueue.o		\
730	pos4obj.o		\
731	sched.o			\
732	sem.o			\
733	shm.o			\
734	sigev_thread.o
735
736TPOOLOBJS=			\
737	thread_pool.o
738
739THREADSOBJS=			\
740	alloc.o			\
741	assfail.o		\
742	cancel.o		\
743	door_calls.o		\
744	pthr_attr.o		\
745	pthr_barrier.o		\
746	pthr_cond.o		\
747	pthr_mutex.o		\
748	pthr_rwlock.o		\
749	pthread.o		\
750	rwlock.o		\
751	scalls.o		\
752	sema.o			\
753	sigaction.o		\
754	spawn.o			\
755	synch.o			\
756	tdb_agent.o		\
757	thr.o			\
758	thread_interface.o	\
759	tls.o			\
760	tsd.o
761
762THREADSMACHOBJS=		\
763	machdep.o
764
765THREADSASMOBJS=			\
766	asm_subr.o
767
768UNICODEOBJS=			\
769	u8_textprep.o		\
770	uconv.o
771
772UNWINDMACHOBJS=			\
773	call_frame_inst.o	\
774	eh_frame.o		\
775	thrp_unwind.o		\
776	unwind.o
777
778pics/unwind.o:= COPTFLAG64 =
779
780UNWINDASMOBJS=			\
781	unwind_frame.o
782
783# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
784# This macro should ALWAYS be empty; native APIs are already 'large file'.
785PORTSYS64=
786
787PORTSYS=			\
788	_autofssys.o		\
789	acctctl.o		\
790	bsd_signal.o		\
791	corectl.o		\
792	exacctsys.o		\
793	execl.o			\
794	execle.o		\
795	execv.o			\
796	faccessat.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
923ALTPICS= $(TRACEOBJS:%=pics/%)
924
925$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
926$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
927
928MAPFILES =	../port/mapfile-vers mapfile-vers
929
930CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
931		-I. -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) -I/usr/include
932ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
933		$(amd64_AS_XARCH)
934
935# Conditionally add support for making |wordexp()| check whether
936# /usr/bin/ksh is ksh93 or not
937include ../../../Makefile.ksh93switch
938CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
939
940# proc64_id.o is built with defines in $(SRC)/uts/intel/sys/x86_archext.h
941pics/proc64_id.o	:= CFLAGS64 += -I$(SRC)/uts/intel
942
943# Inform the run-time linker about libc specialized initialization
944RTLDINFO =	-z rtldinfo=tls_rtldinfo
945DYNFLAGS +=	$(RTLDINFO)
946
947BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
948
949# Override this top level flag so the compiler builds in its native
950# C99 mode.  This has been enabled to support the complex arithmetic
951# added to libc.
952C99MODE=	$(C99_ENABLE)
953
954# libc method of building an archive
955BUILD.AR= $(RM) $@ ; \
956	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
957
958# extra files for the clean target
959CLEANFILES=			\
960	../port/gen/errlst.c	\
961	../port/gen/new_list.c	\
962	assym.h			\
963	genassym		\
964	crt/_rtld.s		\
965	pics/crti.o		\
966	pics/crtn.o		\
967	$(ALTPICS)
968
969CLOBBERFILES +=	$(LIB_PIC)
970
971# list of C source for lint
972SRCS=							\
973	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
974	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
975	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
976	$(PORTFP:%.o=../port/fp/%.c)			\
977	$(PORTGEN:%.o=../port/gen/%.c)			\
978	$(PORTI18N:%.o=../port/i18n/%.c)		\
979	$(PORTPRINT:%.o=../port/print/%.c)		\
980	$(PORTREGEX:%.o=../port/regex/%.c)		\
981	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
982	$(PORTSYS:%.o=../port/sys/%.c)			\
983	$(AIOOBJS:%.o=../port/aio/%.c)			\
984	$(RTOBJS:%.o=../port/rt/%.c)			\
985	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
986	$(THREADSOBJS:%.o=../port/threads/%.c)		\
987	$(THREADSMACHOBJS:%.o=threads/%.c)		\
988	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
989	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
990	$(FPOBJS:%.o=fp/%.c)				\
991	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
992	$(LIBCBASE)/gen/ecvt.c				\
993	$(LIBCBASE)/gen/makectxt.c			\
994	$(LIBCBASE)/gen/siginfolst.c			\
995	$(LIBCBASE)/gen/siglongjmp.c			\
996	$(LIBCBASE)/gen/sync_instruction_memory.c	\
997	$(LIBCBASE)/sys/uadmin.c
998
999# conditional assignments
1000# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1001$(DYNLIB) := CRTI = crti.o
1002$(DYNLIB) := CRTN = crtn.o
1003
1004# Files which need the threads .il inline template
1005TIL=				\
1006	aio.o			\
1007	alloc.o			\
1008	assfail.o		\
1009	atexit.o		\
1010	atfork.o		\
1011	cancel.o		\
1012	door_calls.o		\
1013	errno.o			\
1014	lwp.o			\
1015	ma.o			\
1016	machdep.o		\
1017	posix_aio.o		\
1018	pthr_attr.o		\
1019	pthr_barrier.o		\
1020	pthr_cond.o		\
1021	pthr_mutex.o		\
1022	pthr_rwlock.o		\
1023	pthread.o		\
1024	rand.o			\
1025	rwlock.o		\
1026	scalls.o		\
1027	sched.o			\
1028	sema.o			\
1029	sigaction.o		\
1030	sigev_thread.o		\
1031	spawn.o			\
1032	stack.o			\
1033	synch.o			\
1034	tdb_agent.o		\
1035	thr.o			\
1036	thread_interface.o	\
1037	thread_pool.o		\
1038	thrp_unwind.o		\
1039	tls.o			\
1040	tsd.o
1041
1042$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1043
1044# pics/mul64.o := CFLAGS64 += crt/mul64.il
1045
1046# large-file-aware components that should be built large
1047
1048#$(COMSYSOBJS64:%=pics/%) := \
1049#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1050
1051#$(SYSOBJS64:%=pics/%) := \
1052#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1053
1054#$(PORTGEN64:%=pics/%) := \
1055#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1056
1057#$(PORTSTDIO64:%=pics/%) := \
1058#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1059
1060#$(PORTSYS64:%=pics/%) := \
1061#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1062
1063$(PORTSTDIO_W:%=pics/%) := \
1064	CPPFLAGS += -D_WIDE
1065
1066$(PORTPRINT_W:%=pics/%) := \
1067	CPPFLAGS += -D_WIDE
1068
1069$(PORTPRINT_C89:%=pics/%) := \
1070	CPPFLAGS += -D_C89_INTMAX32
1071
1072$(PORTSTDIO_C89:%=pics/%) := \
1073	CPPFLAGS += -D_C89_INTMAX32
1074
1075$(PORTI18N_COND:%=pics/%) := \
1076	CPPFLAGS += -D_WCS_LONGLONG
1077
1078.KEEP_STATE:
1079
1080all: $(LIBS) $(LIB_PIC)
1081
1082lint	:=	CPPFLAGS += -I../$(MACH)/fp
1083lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1084lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1085
1086lint:
1087	@echo $(LINT.c) ... $(LDLIBS)
1088	@$(LINT.c) $(SRCS) $(LDLIBS)
1089
1090$(LINTLIB):= SRCS=../port/llib-lc
1091$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1092$(LINTLIB):= LINTFLAGS64=-nvx -Xarch=amd64
1093
1094# object files that depend on inline template
1095$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1096# pics/mul64.o: crt/mul64.il
1097
1098# include common libc targets
1099include ../Makefile.targ
1100
1101# We need to strip out all CTF data from the static library
1102$(LIB_PIC) := DIR = pics
1103$(LIB_PIC): pics $$(PICS)
1104	$(BUILD.AR)
1105	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1106	$(AR) -ts $@ > /dev/null
1107	$(POST_PROCESS_A)
1108
1109ASSYMDEP_OBJS=			\
1110	_lwp_mutex_unlock.o	\
1111	_stack_grow.o		\
1112	asm_subr.o		\
1113	getcontext.o		\
1114	tls_get_addr.o		\
1115	vforkx.o
1116
1117$(ASSYMDEP_OBJS:%=pics/%): assym.h
1118
1119# assym.h build rules
1120
1121GENASSYM_C = genassym.c
1122
1123# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1124#	live in Makefile.master
1125
1126CPPFLAGS.genassym = \
1127	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1128
1129genassym: $(GENASSYM_C)
1130	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1131
1132OFFSETS = ../$(MACH)/offsets.in
1133
1134assym.h: $(OFFSETS) genassym
1135	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1136	./genassym >>$@
1137
1138# derived C source and related explicit dependencies
1139../port/gen/errlst.c + \
1140../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1141	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1142
1143pics/errlst.o: ../port/gen/errlst.c
1144
1145pics/new_list.o: ../port/gen/new_list.c
1146