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