xref: /illumos-gate/usr/src/lib/libc/amd64/Makefile (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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	inlines.o		\
744	asm_subr.o
745
746UNWINDMACHOBJS=			\
747	call_frame_inst.o	\
748	eh_frame.o		\
749	thrp_unwind.o		\
750	unwind.o
751
752pics/unwind.o:= COPTFLAG64 =
753
754UNWINDASMOBJS=			\
755	unwind_frame.o
756
757# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
758# This macro should ALWAYS be empty; native APIs are already 'large file'.
759PORTSYS64=
760
761PORTSYS=			\
762	_autofssys.o		\
763	acctctl.o		\
764	bsd_signal.o		\
765	corectl.o		\
766	exacctsys.o		\
767	execl.o			\
768	execle.o		\
769	execv.o			\
770	fcntl.o			\
771	fsmisc.o		\
772	fstatat.o		\
773	fsync.o			\
774	getpeerucred.o		\
775	inst_sync.o		\
776	issetugid.o		\
777	libc_link.o		\
778	libc_open.o		\
779	lockf.o			\
780	lwp.o			\
781	lwp_cond.o		\
782	lwp_rwlock.o		\
783	lwp_sigmask.o		\
784	meminfosys.o		\
785	msgsys.o		\
786	nfssys.o		\
787	openat.o		\
788	pgrpsys.o		\
789	posix_sigwait.o		\
790	ppriv.o			\
791	psetsys.o		\
792	rctlsys.o		\
793	sbrk.o			\
794	semsys.o		\
795	set_errno.o		\
796	shmsys.o		\
797	siginterrupt.o		\
798	signal.o		\
799	sigpending.o		\
800	sigstack.o		\
801	tasksys.o		\
802	time.o			\
803	time_util.o		\
804	ucontext.o		\
805	ustat.o			\
806	zone.o
807
808PORTREGEX=			\
809	glob.o			\
810	regcmp.o		\
811	regex.o			\
812	wordexp.o
813
814MOSTOBJS=			\
815	$(STRETS)		\
816	$(CRTOBJS)		\
817	$(DYNOBJS)		\
818	$(FPOBJS)		\
819	$(I386FPOBJS)		\
820	$(FPASMOBJS)		\
821	$(ATOMICOBJS)		\
822	$(COMOBJS)		\
823	$(GENOBJS)		\
824	$(PORTFP)		\
825	$(PORTGEN)		\
826	$(PORTGEN64)		\
827	$(PORTI18N)		\
828	$(PORTI18N_COND)	\
829	$(PORTPRINT)		\
830	$(PORTPRINT_W)		\
831	$(PORTREGEX)		\
832	$(PORTSTDIO)		\
833	$(PORTSTDIO64)		\
834	$(PORTSTDIO_W)		\
835	$(PORTSYS)		\
836	$(PORTSYS64)		\
837	$(THREADSOBJS)		\
838	$(THREADSMACHOBJS)	\
839	$(THREADSASMOBJS)	\
840	$(UNWINDMACHOBJS)	\
841	$(UNWINDASMOBJS)	\
842	$(COMSYSOBJS)		\
843	$(SYSOBJS)		\
844	$(COMSYSOBJS64)		\
845	$(SYSOBJS64)
846
847TRACEOBJS=			\
848	plockstat.o
849
850# NOTE:	libc.so.1 must be linked with the minimal crti.o and crtn.o
851# modules whose source is provided in the $(SRC)/lib/common directory.
852# This must be done because otherwise the Sun C compiler would insert
853# its own versions of these modules and those versions contain code
854# to call out to C++ initialization functions.  Such C++ initialization
855# functions can call back into libc before thread initialization is
856# complete and this leads to segmentation violations and other problems.
857# Since libc contains no C++ code, linking with the minimal crti.o and
858# crtn.o modules is safe and avoids the problems described above.
859OBJECTS= $(CRTI) $(MOSTOBJS) $(CRTN)
860CRTSRCS= ../../common/amd64
861
862# these aren't listed as $(PICS), so we need to force CTF
863pics/values-Xa.o := POST_PROCESS_O = $(CTFCONVERT_O)
864
865# include common library definitions
866include ../../Makefile.lib
867include ../../Makefile.lib.64
868
869# NOTE: libc_i18n.a will be part of libc.so.1.  Therefore, the compilation
870# conditions such as the settings of CFLAGS and CPPFLAGS for the libc_i18n stuff
871# need to be compatible with the ones for the libc stuff.  Whenever the changes
872# that affect the compilation conditions of libc happened, those for libc_i18n
873# also need to be updated.
874
875CFLAGS64 += $(CTF_FLAGS)
876
877# This is necessary to avoid problems with calling _ex_unwind().
878# We probably don't want any inlining anyway.
879CFLAGS64 += -xinline=
880
881# Setting THREAD_DEBUG = -DTHREAD_DEBUG (make THREAD_DEBUG=-DTHREAD_DEBUG ...)
882# enables ASSERT() checking in the threads portion of the library.
883# This is automatically enabled for DEBUG builds, not for non-debug builds.
884THREAD_DEBUG =
885$(NOT_RELEASE_BUILD)THREAD_DEBUG = -DTHREAD_DEBUG
886
887CFLAGS64 += $(THREAD_DEBUG)
888
889ALTPICS= $(TRACEOBJS:%=pics/%)
890
891$(DYNLIB) := PICS += $(ROOTFS_LIBDIR64)/libc_i18n.a
892$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS)
893
894MAPDIR=		../spec/amd64
895MAPFILE=	$(MAPDIR)/mapfile
896
897CPPFLAGS=	-D_REENTRANT -D$(MACH64) -D__$(MACH64) \
898		-I. -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) -I/usr/include
899ASFLAGS=	$(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
900		-xarch=generic64
901
902# Inform the run-time linker about libc specialized initialization
903RTLDINFO =	-z rtldinfo=tls_rtldinfo
904
905DYNFLAGS +=	-M $(MAPFILE) $(RTLDINFO)
906
907BUILD.s=	$(AS) $(ASFLAGS) $< -o $@
908
909# Override this top level flag so the compiler builds in its native
910# C99 mode.  This has been enabled to support the complex arithmetic
911# added to libc.
912C99MODE=	$(C99_ENABLE)
913
914# libc method of building an archive
915BUILD.AR= $(RM) $@ ; \
916	$(AR) q $@ `$(LORDER) $(MOSTOBJS:%=$(DIR)/%)| $(TSORT)`
917
918# extra files for the clean target
919CLEANFILES=			\
920	../port/gen/errlst.c	\
921	../port/gen/new_list.c	\
922	assym.h			\
923	genassym		\
924	crt/_rtld.s		\
925	pics/crti.o		\
926	pics/crtn.o		\
927	pics/values-Xa.o	\
928	$(ALTPICS)
929
930CLOBBERFILES +=	$(MAPFILE) $(LIB_PIC)
931
932# list of C source for lint
933SRCS=							\
934	$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c)	\
935	$(COMOBJS:%.o=$(SRC)/common/util/%.c)		\
936	$(PORTFP:%.o=../port/fp/%.c)			\
937	$(PORTGEN:%.o=../port/gen/%.c)			\
938	$(PORTI18N:%.o=../port/i18n/%.c)		\
939	$(PORTPRINT:%.o=../port/print/%.c)		\
940	$(PORTREGEX:%.o=../port/regex/%.c)		\
941	$(PORTSTDIO:%.o=../port/stdio/%.c)		\
942	$(PORTSYS:%.o=../port/sys/%.c)			\
943	$(THREADSOBJS:%.o=../port/threads/%.c)		\
944	$(THREADSMACHOBJS:%.o=threads/%.c)		\
945	$(UNWINDMACHOBJS:%.o=unwind/%.c)		\
946	$(FPOBJS:%.o=fp/%.c)				\
947	$(I386FPOBJS:%.o=../i386/fp/%.c)		\
948	$(LIBCBASE)/gen/ecvt.c				\
949	$(LIBCBASE)/gen/lexp10.c			\
950	$(LIBCBASE)/gen/llog10.c			\
951	$(LIBCBASE)/gen/ltostr.c			\
952	$(LIBCBASE)/gen/makectxt.c			\
953	$(LIBCBASE)/gen/siginfolst.c			\
954	$(LIBCBASE)/gen/siglongjmp.c			\
955	$(LIBCBASE)/gen/sync_instruction_memory.c	\
956	$(LIBCBASE)/sys/uadmin.c
957
958# conditional assignments
959# $(DYNLIB) $(LIB_PIC) := DYNOBJS = _rtbootld.o
960$(DYNLIB) := CRTI = crti.o values-Xa.o
961$(DYNLIB) := CRTN = crtn.o
962
963$(DYNLIB):	$(MAPFILE)
964
965$(MAPFILE):
966	@cd $(MAPDIR); $(MAKE) mapfile
967
968# Files which need the threads .il inline template
969TIL=				\
970	alloc.o			\
971	assfail.o		\
972	atexit.o		\
973	atfork.o		\
974	cancel.o		\
975	door_calls.o		\
976	errno.o			\
977	lwp.o			\
978	machdep.o		\
979	pthr_attr.o		\
980	pthr_barrier.o		\
981	pthr_cond.o		\
982	pthr_mutex.o		\
983	pthr_rwlock.o		\
984	pthread.o		\
985	rand.o			\
986	rtsched.o		\
987	rwlock.o		\
988	scalls.o		\
989	sema.o			\
990	sigaction.o		\
991	spawn.o			\
992	stack.o			\
993	synch.o			\
994	tdb_agent.o		\
995	thr.o			\
996	thread_interface.o	\
997	thrp_unwind.o		\
998	tls.o			\
999	tsd.o
1000
1001$(TIL:%=pics/%) := CFLAGS64 += $(LIBCBASE)/threads/amd64.il
1002
1003# pics/mul64.o := CFLAGS64 += crt/mul64.il
1004
1005# large-file-aware components that should be built large
1006
1007#$(COMSYSOBJS64:%=pics/%) := \
1008#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1009
1010#$(SYSOBJS64:%=pics/%) := \
1011#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1012
1013#$(PORTGEN64:%=pics/%) := \
1014#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1015
1016#$(PORTSTDIO64:%=pics/%) := \
1017#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1018
1019#$(PORTSYS64:%=pics/%) := \
1020#	CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
1021
1022$(PORTSTDIO_W:%=pics/%) := \
1023	CPPFLAGS += -D_WIDE
1024
1025$(PORTPRINT_W:%=pics/%) := \
1026	CPPFLAGS += -D_WIDE
1027
1028$(PORTPRINT_C89:%=pics/%) := \
1029	CPPFLAGS += -D_C89_INTMAX32
1030
1031$(PORTSTDIO_C89:%=pics/%) := \
1032	CPPFLAGS += -D_C89_INTMAX32
1033
1034$(PORTI18N_COND:%=pics/%) := \
1035	CPPFLAGS += -D_WCS_LONGLONG
1036
1037.KEEP_STATE:
1038
1039all: $(LIBS) $(LIB_PIC)
1040
1041lint	:=	CPPFLAGS += -I../$(MACH)/fp
1042lint	:=	CPPFLAGS += -D_MSE_INT_H -D_LCONV_C99
1043lint	:=	LINTFLAGS64 += -mn -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1044
1045lint:
1046	@echo $(LINT.c) ... $(LDLIBS)
1047	@$(LINT.c) $(SRCS) $(LDLIBS)
1048
1049$(LINTLIB):= SRCS=../port/llib-lc
1050$(LINTLIB):= CPPFLAGS += -D_MSE_INT_H
1051$(LINTLIB):= LINTFLAGS64=-nvx -Xarch=amd64
1052
1053# object files that depend on inline template
1054$(TIL:%=pics/%): $(LIBCBASE)/threads/amd64.il
1055# pics/mul64.o: crt/mul64.il
1056
1057# include common libc targets
1058include ../Makefile.targ
1059
1060# We need to strip out all CTF data from the static library
1061$(LIB_PIC) := DIR = pics
1062$(LIB_PIC): pics $$(PICS)
1063	$(BUILD.AR)
1064	$(MCS) -d -n .SUNW_ctf $@ > /dev/null 2>&1
1065	$(AR) -ts $@ > /dev/null
1066	$(POST_PROCESS_A)
1067
1068ASSYMDEP_OBJS=			\
1069	_lwp_mutex_unlock.o	\
1070	_stack_grow.o		\
1071	asm_subr.o		\
1072	getcontext.o		\
1073	tls_get_addr.o		\
1074	vfork.o
1075
1076$(ASSYMDEP_OBJS:%=pics/%): assym.h
1077
1078# assym.h build rules
1079
1080GENASSYM_C = genassym.c
1081
1082# XXX	A hack.  Perhaps this should be 'CPPFLAGS.native' and
1083#	live in Makefile.master
1084
1085CPPFLAGS.genassym = \
1086	$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4)
1087
1088genassym: $(GENASSYM_C)
1089	$(NATIVECC) -Iinc -I../inc $(CPPFLAGS.genassym) -o $@ $(GENASSYM_C)
1090
1091OFFSETS = ../$(MACH)/offsets.in
1092
1093assym.h: $(OFFSETS) genassym
1094	$(OFFSETS_CREATE) <$(OFFSETS) >$@
1095	./genassym >>$@
1096
1097# derived C source and related explicit dependencies
1098../port/gen/errlst.c + \
1099../port/gen/new_list.c: ../port/gen/errlist ../port/gen/errlist.awk
1100	cd ../port/gen; pwd; $(AWK) -f errlist.awk < errlist
1101
1102pics/errlst.o: ../port/gen/errlst.c
1103
1104pics/new_list.o: ../port/gen/new_list.c
1105