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