xref: /illumos-gate/usr/src/lib/libc/amd64/Makefile (revision 374ae87f60894937d3c6e53ec4a739188e702ea5)
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	lexp10.o		\
113	llog10.o		\
114	lock.o			\
115	ltostr.o		\
116	makectxt.o		\
117	memccpy.o		\
118	memchr.o		\
119	memcmp.o		\
120	memcpy.o		\
121	memset.o		\
122	new_list.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	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	lfind.o			\
454	lfmt.o			\
455	lfmt_log.o		\
456	lldiv.o			\
457	lltostr.o		\
458	lmath.o			\
459	localtime.o		\
460	lsearch.o		\
461	madvise.o		\
462	malloc.o		\
463	memalign.o		\
464	mkdev.o			\
465	mkdtemp.o		\
466	mkfifo.o		\
467	mkstemp.o		\
468	mktemp.o		\
469	mlock.o			\
470	mlockall.o		\
471	mon.o			\
472	msync.o			\
473	munlock.o		\
474	munlockall.o		\
475	ndbm.o			\
476	nftw.o			\
477	nlspath_checks.o	\
478	nsparse.o		\
479	nss_common.o		\
480	nss_dbdefs.o		\
481	nss_deffinder.o		\
482	opendir.o		\
483	opt_data.o		\
484	perror.o		\
485	pfmt.o			\
486	pfmt_data.o		\
487	pfmt_print.o		\
488	plock.o			\
489	poll.o			\
490	priocntl.o		\
491	privlib.o		\
492	priv_str_xlate.o	\
493	psiginfo.o		\
494	psignal.o		\
495	pt.o			\
496	putpwent.o		\
497	putspent.o		\
498	raise.o			\
499	rand.o			\
500	random.o		\
501	rctlops.o		\
502	readdir.o		\
503	readdir_r.o		\
504	realpath.o		\
505	reboot.o		\
506	regexpr.o		\
507	remove.o		\
508	rewinddir.o		\
509	rindex.o		\
510	scandir.o		\
511	seekdir.o		\
512	select.o		\
513	setlabel.o		\
514	setpriority.o		\
515	settimeofday.o		\
516	sh_locks.o		\
517	sigflag.o		\
518	siglist.o		\
519	sigsend.o		\
520	sigsetops.o		\
521	ssignal.o		\
522	stack.o			\
523	str2sig.o		\
524	strcase_charmap.o	\
525	strcasecmp.o		\
526	strcat.o		\
527	strchr.o		\
528	strcspn.o		\
529	strdup.o		\
530	strerror.o		\
531	strlcat.o		\
532	strlcpy.o		\
533	strncasecmp.o		\
534	strncat.o		\
535	strpbrk.o		\
536	strrchr.o		\
537	strsignal.o		\
538	strspn.o		\
539	strstr.o		\
540	strtod.o		\
541	strtoimax.o		\
542	strtok.o		\
543	strtok_r.o		\
544	strtoll.o		\
545	strtoull.o		\
546	strtoumax.o		\
547	swab.o			\
548	swapctl.o		\
549	sysconf.o		\
550	syslog.o		\
551	tcdrain.o		\
552	tcflow.o		\
553	tcflush.o		\
554	tcgetattr.o		\
555	tcgetpgrp.o		\
556	tcgetsid.o		\
557	tcsendbreak.o		\
558	tcsetattr.o		\
559	tcsetpgrp.o		\
560	tell.o			\
561	telldir.o		\
562	tfind.o			\
563	time_data.o		\
564	time_gdata.o		\
565	truncate.o		\
566	tsdalloc.o		\
567	tsearch.o		\
568	ttyname.o		\
569	ttyslot.o		\
570	ualarm.o		\
571	ucred.o			\
572	valloc.o		\
573	vlfmt.o			\
574	vpfmt.o			\
575	waitpid.o		\
576	walkstack.o		\
577	wdata.o			\
578	xgetwidth.o		\
579	xpg4.o			\
580	xpg6.o
581
582PORTPRINT_W=			\
583	doprnt_w.o
584
585PORTPRINT=			\
586	doprnt.o		\
587	fprintf.o		\
588	printf.o		\
589	snprintf.o		\
590	sprintf.o		\
591	vfprintf.o		\
592	vprintf.o		\
593	vsnprintf.o		\
594	vsprintf.o		\
595	vwprintf.o		\
596	wprintf.o
597
598# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
599# This macro should ALWAYS be empty; native APIs are already 'large file'.
600PORTSTDIO64=
601
602PORTSTDIO_W=			\
603	doscan_w.o
604
605PORTSTDIO=			\
606	__extensions.o		\
607	_endopen.o		\
608	_filbuf.o		\
609	_findbuf.o		\
610	_flsbuf.o		\
611	_wrtchk.o		\
612	clearerr.o		\
613	ctermid.o		\
614	ctermid_r.o		\
615	cuserid.o		\
616	data.o			\
617	doscan.o		\
618	fdopen.o		\
619	feof.o			\
620	ferror.o		\
621	fgetc.o			\
622	fgets.o			\
623	fileno.o		\
624	flockf.o		\
625	flush.o			\
626	fopen.o			\
627	fpos.o			\
628	fputc.o			\
629	fputs.o			\
630	fread.o			\
631	fseek.o			\
632	fseeko.o		\
633	ftell.o			\
634	ftello.o		\
635	fwrite.o		\
636	getc.o			\
637	getchar.o		\
638	getpass.o		\
639	gets.o			\
640	getw.o			\
641	mse.o			\
642	popen.o			\
643	putc.o			\
644	putchar.o		\
645	puts.o			\
646	putw.o			\
647	rewind.o		\
648	scanf.o			\
649	setbuf.o		\
650	setbuffer.o		\
651	setvbuf.o		\
652	system.o		\
653	tempnam.o		\
654	tmpfile.o		\
655	tmpnam_r.o		\
656	ungetc.o		\
657	vscanf.o		\
658	vwscanf.o		\
659	wscanf.o
660
661PORTI18N=			\
662	__fgetwc_xpg5.o		\
663	__fgetws_xpg5.o		\
664	__fputwc_xpg5.o		\
665	__fputws_xpg5.o		\
666	__ungetwc_xpg5.o	\
667	getwchar.o		\
668	putwchar.o		\
669	putws.o			\
670	strtows.o		\
671	wcsstr.o		\
672	wcstoimax.o		\
673	wcstol.o		\
674	wcstoul.o		\
675	wcswcs.o		\
676	wmemchr.o		\
677	wmemcmp.o		\
678	wmemcpy.o		\
679	wmemmove.o		\
680	wmemset.o		\
681	wscasecmp.o		\
682	wscat.o			\
683	wschr.o			\
684	wscmp.o			\
685	wscpy.o			\
686	wscspn.o		\
687	wsdup.o			\
688	wslen.o			\
689	wsncasecmp.o		\
690	wsncat.o		\
691	wsncmp.o		\
692	wsncpy.o		\
693	wspbrk.o		\
694	wsprintf.o		\
695	wsrchr.o		\
696	wsscanf.o		\
697	wsspn.o			\
698	wstod.o			\
699	wstok.o			\
700	wstol.o			\
701	wstoll.o		\
702	wsxfrm.o		\
703	gettext.o		\
704	gettext_gnu.o		\
705	gettext_real.o		\
706	gettext_util.o		\
707	plural_parser.o		\
708	wdresolve.o		\
709	_ctype.o		\
710	isascii.o		\
711	toascii.o
712
713PORTI18N_COND=			\
714	wcstol_longlong.o	\
715	wcstoul_longlong.o
716
717AIOOBJS=			\
718	aio.o			\
719	aio_alloc.o		\
720	posix_aio.o
721
722RTOBJS=				\
723	clock_timer.o		\
724	fallocate.o		\
725	mqueue.o		\
726	pos4obj.o		\
727	sched.o			\
728	sem.o			\
729	shm.o			\
730	sigev_thread.o
731
732TPOOLOBJS=			\
733	thread_pool.o
734
735THREADSOBJS=			\
736	alloc.o			\
737	assfail.o		\
738	cancel.o		\
739	door_calls.o		\
740	pthr_attr.o		\
741	pthr_barrier.o		\
742	pthr_cond.o		\
743	pthr_mutex.o		\
744	pthr_rwlock.o		\
745	pthread.o		\
746	rtsched.o		\
747	rwlock.o		\
748	scalls.o		\
749	sema.o			\
750	sigaction.o		\
751	spawn.o			\
752	synch.o			\
753	tdb_agent.o		\
754	thr.o			\
755	thread_interface.o	\
756	tls.o			\
757	tsd.o
758
759THREADSMACHOBJS=		\
760	machdep.o
761
762THREADSASMOBJS=			\
763	asm_subr.o
764
765UNICODEOBJS=			\
766	u8_textprep.o		\
767	uconv.o
768
769UNWINDMACHOBJS=			\
770	call_frame_inst.o	\
771	eh_frame.o		\
772	thrp_unwind.o		\
773	unwind.o
774
775pics/unwind.o:= COPTFLAG64 =
776
777UNWINDASMOBJS=			\
778	unwind_frame.o
779
780# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
781# This macro should ALWAYS be empty; native APIs are already 'large file'.
782PORTSYS64=
783
784PORTSYS=			\
785	_autofssys.o		\
786	acctctl.o		\
787	bsd_signal.o		\
788	corectl.o		\
789	exacctsys.o		\
790	execl.o			\
791	execle.o		\
792	execv.o			\
793	faccessat.o		\
794	fsmisc.o		\
795	fstatat.o		\
796	getpagesizes.o		\
797	getpeerucred.o		\
798	inst_sync.o		\
799	issetugid.o		\
800	label.o			\
801	libc_fcntl.o		\
802	libc_link.o		\
803	libc_open.o		\
804	lockf.o			\
805	lwp.o			\
806	lwp_cond.o		\
807	lwp_rwlock.o		\
808	lwp_sigmask.o		\
809	meminfosys.o		\
810	msgsys.o		\
811	nfssys.o		\
812	openat.o		\
813	pgrpsys.o		\
814	posix_sigwait.o		\
815	ppriv.o			\
816	psetsys.o		\
817	rctlsys.o		\
818	sbrk.o			\
819	semsys.o		\
820	set_errno.o		\
821	sharefs.o		\
822	shmsys.o		\
823	sidsys.o		\
824	siginterrupt.o		\
825	signal.o		\
826	sigpending.o		\
827	sigstack.o		\
828	tasksys.o		\
829	time.o			\
830	time_util.o		\
831	ucontext.o		\
832	ustat.o			\
833	zone.o
834
835PORTREGEX=			\
836	glob.o			\
837	regcmp.o		\
838	regex.o			\
839	wordexp.o
840
841VALUES=				\
842	values-Xa.o
843
844MOSTOBJS=			\
845	$(STRETS)		\
846	$(CRTOBJS)		\
847	$(DYNOBJS)		\
848	$(FPOBJS)		\
849	$(I386FPOBJS)		\
850	$(FPASMOBJS)		\
851	$(ATOMICOBJS)		\
852	$(XATTROBJS)		\
853	$(COMOBJS)		\
854	$(GENOBJS)		\
855	$(PORTFP)		\
856	$(PORTGEN)		\
857	$(PORTGEN64)		\
858	$(PORTI18N)		\
859	$(PORTI18N_COND)	\
860	$(PORTPRINT)		\
861	$(PORTPRINT_W)		\
862	$(PORTREGEX)		\
863	$(PORTSTDIO)		\
864	$(PORTSTDIO64)		\
865	$(PORTSTDIO_W)		\
866	$(PORTSYS)		\
867	$(PORTSYS64)		\
868	$(AIOOBJS)		\
869	$(RTOBJS)		\
870	$(TPOOLOBJS)		\
871	$(THREADSOBJS)		\
872	$(THREADSMACHOBJS)	\
873	$(THREADSASMOBJS)	\
874	$(UNICODEOBJS)		\
875	$(UNWINDMACHOBJS)	\
876	$(UNWINDASMOBJS)	\
877	$(COMSYSOBJS)		\
878	$(SYSOBJS)		\
879	$(COMSYSOBJS64)		\
880	$(SYSOBJS64)		\
881	$(VALUES)
882
883TRACEOBJS=			\
884	plockstat.o
885
886# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
887# modules whose source is provided in the $(SRC)/lib/common directory.
888# This must be done because otherwise the Sun C compiler would insert
889# its own versions of these modules and those versions contain code
890# to call out to C++ initialization functions.  Such C++ initialization
891# functions can call back into libc before thread initialization is
892# complete and this leads to segmentation violations and other problems.
893# Since libc contains no C++ code, linking with the minimal crti.o and
894# crtn.o modules is safe and avoids the problems described above.
895OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
896CRTSRCS= ../../common/amd64
897
898# include common library definitions
899include ../../Makefile.lib
900include ../../Makefile.lib.64
901
902# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
903# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
904# need to be compatible with the ones for the libc stuff.  Whenever the changes
905# that affect the compilation conditions of libc happened, those for libc_i18n
906# also need to be updated.
907
908CFLAGS64 += $(CTF_FLAGS)
909
910# This is necessary to avoid problems with calling _ex_unwind().
911# We probably don't want any inlining anyway.
912CFLAGS64 += -xinline=
913
914# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
915# enables ASSERT() checking in the threads portion of the library.
916# This is automatically enabled for DEBUG builds, not for non-debug builds.
917THREAD_DEBUG =
918$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
919
920CFLAGS64 += $(THREAD_DEBUG)
921
922ALTPICS= $(TRACEOBJS:%=pics/%)
923
924$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
925$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
926
927MAPFILES =	../port/mapfile-vers mapfile-vers
928
929CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) \
930		-I. -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) -I/usr/include
931ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
932		$(amd64_AS_XARCH)
933
934# Conditionally add support for making |wordexp()| check whether
935# /usr/bin/ksh is ksh93 or not
936include ../../../Makefile.ksh93switch
937CPPFLAGS += -DWORDEXP_KSH93=$(ON_BUILD_KSH93_AS_BINKSH)
938
939# Inform the run-time linker about libc specialized initialization
940RTLDINFO =	-z rtldinfo=tls_rtldinfo
941DYNFLAGS +=	$(RTLDINFO)
942
943BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
944
945# Override this top level flag so the compiler builds in its native
946# C99 mode.  This has been enabled to support the complex arithmetic
947# added to libc.
948C99MODE=	$(C99_ENABLE)
949
950# libc method of building an archive
951BUILD.AR= $(RM) $@ ; \
952	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
953
954# extra files for the clean target
955CLEANFILES=			\
956	../port/gen/errlst.c	\
957	../port/gen/new_list.c	\
958	assym.h			\
959	genassym		\
960	crt/_rtld.s		\
961	pics/crti.o		\
962	pics/crtn.o		\
963	$(ALTPICS)
964
965CLOBBERFILES +=	$(LIB_PIC)
966
967# list of C source for lint
968SRCS=							\
969	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
970	$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c)	\
971	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
972	$(PORTFP:%.o=../port/fp/%.c)			\
973	$(PORTGEN:%.o=../port/gen/%.c)			\
974	$(PORTI18N:%.o=../port/i18n/%.c)		\
975	$(PORTPRINT:%.o=../port/print/%.c)		\
976	$(PORTREGEX:%.o=../port/regex/%.c)		\
977	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
978	$(PORTSYS:%.o=../port/sys/%.c)			\
979	$(AIOOBJS:%.o=../port/aio/%.c)			\
980	$(RTOBJS:%.o=../port/rt/%.c)			\
981	$(TPOOLOBJS:%.o=../port/tpool/%.c)		\
982	$(THREADSOBJS:%.o=../port/threads/%.c)		\
983	$(THREADSMACHOBJS:%.o=threads/%.c)		\
984	$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c)	\
985	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
986	$(FPOBJS:%.o=fp/%.c)				\
987	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
988	$(LIBCBASE)/gen/ecvt.c				\
989	$(LIBCBASE)/gen/lexp10.c			\
990	$(LIBCBASE)/gen/llog10.c			\
991	$(LIBCBASE)/gen/ltostr.c			\
992	$(LIBCBASE)/gen/makectxt.c			\
993	$(LIBCBASE)/gen/siginfolst.c			\
994	$(LIBCBASE)/gen/siglongjmp.c			\
995	$(LIBCBASE)/gen/sync_instruction_memory.c	\
996	$(LIBCBASE)/sys/uadmin.c
997
998# conditional assignments
999# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
1000$(DYNLIB) := CRTI = crti.o
1001$(DYNLIB) := CRTN = crtn.o
1002
1003# Files which need the threads .il inline template
1004TIL=				\
1005	aio.o			\
1006	alloc.o			\
1007	assfail.o		\
1008	atexit.o		\
1009	atfork.o		\
1010	cancel.o		\
1011	door_calls.o		\
1012	errno.o			\
1013	lwp.o			\
1014	ma.o			\
1015	machdep.o		\
1016	posix_aio.o		\
1017	pthr_attr.o		\
1018	pthr_barrier.o		\
1019	pthr_cond.o		\
1020	pthr_mutex.o		\
1021	pthr_rwlock.o		\
1022	pthread.o		\
1023	rand.o			\
1024	rtsched.o		\
1025	rwlock.o		\
1026	scalls.o		\
1027	sema.o			\
1028	sigaction.o		\
1029	sigev_thread.o		\
1030	spawn.o			\
1031	stack.o			\
1032	synch.o			\
1033	tdb_agent.o		\
1034	thr.o			\
1035	thread_interface.o	\
1036	thread_pool.o		\
1037	thrp_unwind.o		\
1038	tls.o			\
1039	tsd.o
1040
1041$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1042
1043# pics/mul64.o := CFLAGS64 += crt/mul64.il
1044
1045# large-file-aware components that should be built large
1046
1047#$(COMSYSOBJS64:%=pics/%) := \
1048#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1049
1050#$(SYSOBJS64:%=pics/%) := \
1051#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1052
1053#$(PORTGEN64:%=pics/%) := \
1054#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1055
1056#$(PORTSTDIO64:%=pics/%) := \
1057#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1058
1059#$(PORTSYS64:%=pics/%) := \
1060#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1061
1062$(PORTSTDIO_W:%=pics/%) := \
1063	CPPFLAGS += -D_WIDE
1064
1065$(PORTPRINT_W:%=pics/%) := \
1066	CPPFLAGS += -D_WIDE
1067
1068$(PORTPRINT_C89:%=pics/%) := \
1069	CPPFLAGS += -D_C89_INTMAX32
1070
1071$(PORTSTDIO_C89:%=pics/%) := \
1072	CPPFLAGS += -D_C89_INTMAX32
1073
1074$(PORTI18N_COND:%=pics/%) := \
1075	CPPFLAGS += -D_WCS_LONGLONG
1076
1077.KEEP_STATE:
1078
1079all: $(LIBS) $(LIB_PIC)
1080
1081lint	:=	CPPFLAGS += -I../$(MACH)/fp
1082lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1083lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1084
1085lint:
1086	@echo $(LINT.c) ... $(LDLIBS)
1087	@$(LINT.c) $(SRCS) $(LDLIBS)
1088
1089$(LINTLIB):= SRCS=../port/llib-lc
1090$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1091$(LINTLIB):= LINTFLAGS64=-nvx -Xarch=amd64
1092
1093# object files that depend on inline template
1094$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1095# pics/mul64.o: crt/mul64.il
1096
1097# include common libc targets
1098include ../Makefile.targ
1099
1100# We need to strip out all CTF data from the static library
1101$(LIB_PIC) := DIR = pics
1102$(LIB_PIC): pics $$(PICS)
1103	$(BUILD.AR)
1104	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1105	$(AR) -ts $@ > /dev/null
1106	$(POST_PROCESS_A)
1107
1108ASSYMDEP_OBJS=			\
1109	_lwp_mutex_unlock.o	\
1110	_stack_grow.o		\
1111	asm_subr.o		\
1112	getcontext.o		\
1113	tls_get_addr.o		\
1114	vforkx.o
1115
1116$(ASSYMDEP_OBJS:%=pics/%): assym.h
1117
1118# assym.h build rules
1119
1120GENASSYM_C = genassym.c
1121
1122# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1123#	live in Makefile.master
1124
1125CPPFLAGS.genassym = \
1126	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1127
1128genassym: $(GENASSYM_C)
1129	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1130
1131OFFSETS = ../$(MACH)/offsets.in
1132
1133assym.h: $(OFFSETS) genassym
1134	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1135	./genassym >>$@
1136
1137# derived C source and related explicit dependencies
1138../port/gen/errlst.c + \
1139../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1140	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1141
1142pics/errlst.o: ../port/gen/errlst.c
1143
1144pics/new_list.o: ../port/gen/new_list.c
1145