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