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