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