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