xref: /titanic_51/usr/src/lib/libbc/sparc/Makefile (revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c)
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
28#
29# This builds all objects needed for libbc.
30#
31
32LIBRARY= libc.a
33# Default rules in ../../Makefile.targ not used.
34VERS= bogus
35DYNLIB4X= libc.so.1.9
36DYNLIBS5= libc.so.2.9
37#DYNLIBS5 is also defined in ../Makefile
38
39M4= m4
40ECHO=	echo
41
42# objects are grouped by source directory.
43
44COMPATCOM= \
45gtty.o      lockf.o     pause.o     stty.o      tell.o      ulimit.o \
46utime.o
47
48COMPAT4.1=\
49ftime.o     nice.o      rand.o      vlimit.o    vtimes.o    getpw.o times.o
50
51COMPATSYS5=\
52nice.o      rand.o      getpw.o     times.o
53
54CRTSPARC =\
55_ftou.o      misalign.o  ptr_call.o \
56start_float.o \
57alloc_pbuf.o mon.o muldiv.o
58
59GENCOM=\
60_crypt.o _nlist.o _perror.o _psignal.o a64l.o abs.o alarm.o\
61asctime.o atof.o atoi.o atol.o bcmp.o bsearch.o\
62clock.o closedir.o crypt.o ctime.o ctype_.o\
63drand48.o dysize.o errlst.o execvp.o exit.o exportent.o ecvt.o\
64fabs.o fmod.o frexp.o\
65fstab.o ftok.o ftw.o getacinfo.o getauid.o getauditflags.o \
66getcwd.o getenv.o getfaudflgs.o getgraent.o getlogin.o \
67getopt.o getsubopt.o getpwaent.o  getttyent.o\
68getttynam.o getusershell.o grpauth.o hsearch.o\
69ieee_globals.o index.o isatty.o \
70issecure.o jcsetpgrp.o\
71l64a.o labeltostring.o ldexp.o lfind.o lsearch.o\
72madvise.o mallopt.o \
73euc.multibyte.o iso.multibyte.o xccs.multibyte.o \
74mblib.o mbstowcs.o mbtowc.o wcstombs.o wctomb.o \
75memalign.o memccpy.o memchr.o memcmp.o\
76mkstemp.o mktemp.o mlock.o mlockall.o\
77mntent.o modf.o msync.o munlock.o munlockall.o\
78nl_cxtime.o nl_strncmp.o  ndbm.o on_exit.o\
79opendir.o optind.o perror.o plock.o \
80posix_sig.o posix_tty.o popen.o psignal.o putenv.o \
81pwdauth.o pwdnm.o qsort.o\
82random.o readdir.o realpath.o regex.o rindex.o scandir.o seekdir.o\
83setlocale.o setregid.o setreuid.o setrgid.o setruid.o sigfpe.o siglist.o\
84ssignal.o strchr.o stricmp.o \
85strftime.o strncat.o \
86strpbrk.o strptime.o strrchr.o strspn.o strstr.o \
87strtod.o strtok.o strtol.o swab.o syslog.o\
88telldir.o tfind.o time.o tsearch.o \
89ualarm.o usleep.o valloc.o string_decim.o \
90file_decim.o func_decim.o econvert.o seconvert.o gconvert.o \
91decimal_bin.o float_decim.o double_decim.o \
92pack_float.o _unpack_dble.o unpack_float.o \
93_base_S.o _base_il.o _base_sup.o _big_power.o _small_power.o \
94_sprintf_sup.o _times_power.o qeconvert.o \
95_Q_neg.o _Q_add.o _Q_sub.o _Q_mul.o _Q_div.o _Q_cmp.o \
96_Q_cmpe.o _Q_stoq.o _Q_dtoq.o _Q_itoq.o _Q_utoq.o _Q_qtos.o _Q_qtod.o \
97_Q_qtoi.o _Q_qtou.o _Q_sqrt.o _Qfaddsub.o _Qfcompare.o _Qfdiv.o \
98_Qfmul.o _Qfpack.o _Qfunpack.o _Qfutility.o _Q_fcc.o _Q_get_rp_rd.o \
99calloc.o malloc.o \
100getpass.o localtime.o ttyslot.o
101
102GENCOMSPARC=\
103alloca.o   ffs.o insque.o    remque.o    isinf.o     base_conv.o
104
105GEN4.2=\
106nlist.o     timezone.o  sleep.o  system.o
107
108GENSYS5=\
109assert.o    nlist.o     sgetl.o    sleep.o      sputl.o     system.o \
110sighold.o
111
112STDIOCOM=\
113clrerr.o    ctermid.o   cuserid.o   doprnt.o    doscan.o    fdopen.o \
114feof.o      ferror.o    fgetc.o     fgets.o     fileno.o    findiop.o \
115fputc.o     fputs.o     fread.o     fseek.o     ftell.o \
116fwrite.o    getc.o      getchar.o   gets.o      getw.o      iob.o \
117putc.o      putchar.o   puts.o      putw.o      remove.o \
118rew.o       scanf.o     setbuffer.o setvbuf.o   tmpnam.o    tempnam.o \
119tmpfile.o   ungetc.o
120
121STDIO4.2=\
122filbuf.o    fopen.o     fprintf.o   printf.o    flsbuf.o  setbuf.o \
123sprintf.o   vfprintf.o  vprintf.o   vsprintf.o
124
125STDIOSYS5=\
126filbuf.o    fopen.o     fprintf.o   flsbuf.o    printf.o    setbuf.o \
127sprintf.o   vfprintf.o  vprintf.o   vsprintf.o
128
129SYSCOM=\
130_access.o acct.o  adjtime.o close.o _creat.o dup.o dup2.o \
131fchdir.o fchmod.o fchown.o fchroot.o \
132fdlist.o flock.o  fpathconf.o fsync.o ftruncate.o getdents.o \
133getdtablesize.o getgid.o  getitimer.o getpid.o gettimeofday.o \
134getuid.o ioctl.o kill.o lseek.o mincore.o mprotect.o munmap.o\
135_open.o poll.o profil.o setitimer.o \
136rlimit.o _statfs.o  sync.o umask.o uname.o\
137execl.o execle.o execv.o mkfifo.o msgsys.o\
138pathconf.o semsys.o shmsys.o unmount.o wait.o setuid.o\
139setgid.o _stat.o seteuid.o setegid.o signalmap.o utimes.o syscall.o \
140maperror.o sigsetjmp.o accept.o bind.o connect.o getpeername.o \
141getsockname.o getsockopt.o listen.o recv.o send.o \
142setsockopt.o shutdown.o socket.o socketpair.o setsid.o sigaction.o
143
144SYSCOMSPARC=\
145_exit.o     brk.o       cerror.o    errno.o     \
146getegid.o   geteuid.o   getppid.o   mmap.o      pipe.o      putmsg.o \
147sbrk.o      _syscall.o  getmsg.o    _read.o     _write.o \
148_readv.o    _writev.o	sendsig.o
149
150SYS4.2=\
151access.o    chdir.o     chmod.o     chown.o     chroot.o    \
152creat.o     execve.o    getpgrp.o   link.o      mkdir.o  \
153mknod.o     open.o      readlink.o  rename.o    rmdir.o  \
154setpgrp.o   stat.o      symlink.o   truncate.o  unlink.o     \
155statfs.o    fcntl.o     read.o      write.o     readv.o \
156writev.o    setjmp.o	mount.o
157
158SYS4.2SPARC=\
159getgroups.o setgroups.o
160
161SYSSYS5=\
162access.o    chdir.o     chmod.o     chown.o     chroot.o \
163creat.o     execve.o    getgroups.o getpgrp.o   link.o \
164mkdir.o     mknod.o     open.o      readlink.o  rename.o \
165rmdir.o     setgroups.o setpgrp.o   stat.o      statfs.o \
166stime.o     symlink.o   truncate.o  unlink.o    fcntl.o \
167read.o      write.o     readv.o     writev.o    setjmp.o \
168mount.o
169
170#SSYSSPARC=\
171#_getpgrp.o  _kill.o     _lseek.o    _mknod.o    _mount.o    _setpgrp.o \
172#umount.o
173
174INET=\
175inet_addr.o        inet_lnaof.o     inet_makeaddr.o  inet_netof.o \
176inet_network.o     inet_ntoa.o
177
178NET=\
179ether_addr.o bindresvport.o getrpcport.o rcmd.o \
180rexec.o ruserpass.o authunix.o
181
182NETSPARC= htonl.o     htons.o         ntohl.o          ntohs.o
183
184YP= yp_bind.o
185
186YP= yp_bind.o
187PSEUDO_SRCS= adjtime.s fchdir.s \
188fchmod.s   fchown.s    fchroot.s      \
189fpathconf.s getitimer.s    getpid.s    \
190mincore.s   mprotect.s munmap.s    \
191profil.s    setitimer.s \
192sync.s     sysconf.s   umask.s         ustat.s \
193acct.s    stime.s      \
194utimes.s poll.s
195
196#
197# libbc build rules
198pics/%.o s5pics/%.o : ../libc/compat/common/%.c
199	$(COMPILE.c) -o $@ $<
200	$(POST_PROCESS_O)
201
202pics/%.o : ../libc/compat/4.1/%.c
203	$(COMPILE.c) -o $@ $<
204	$(POST_PROCESS_O)
205
206s5pics/%.o : ../libc/compat/sys5/%.c
207	$(COMPILE.c) -o $@ $<
208	$(POST_PROCESS_O)
209
210pics/%.o s5pics/%.o : ../libc/crt/sparc/%.s
211	$(BUILD.s)
212	$(POST_PROCESS_O)
213
214pics/%.o s5pics/%.o : ../libc/crt/sparc/%.c
215	$(COMPILE.c) -o $@ $<
216	$(POST_PROCESS_O)
217
218pics/%.o s5pics/%.o : ../csu/common/%.c
219	$(COMPILE.c) -o $@ $<
220	$(POST_PROCESS_O)
221
222pics/%.o s5pics/%.o : ../libc/gen/common/%.S
223	$(BUILD.s)
224	$(POST_PROCESS_O)
225
226pics/%.o s5pics/%.o : ../libc/gen/common/%.c
227	$(COMPILE.c) -o $@ $<
228	$(POST_PROCESS_O)
229
230pics/%.o s5pics/%.o : ../libc/gen/common/sparc/%.s
231	$(BUILD.s)
232	$(POST_PROCESS_O)
233
234pics/%.o s5pics/%.o : ../libc/gen/common/sparc/%.c
235	$(COMPILE.c) -o $@ $<
236	$(POST_PROCESS_O)
237
238pics/%.o : ../libc/gen/4.2/%.c
239	$(COMPILE.c) -o $@ $<
240	$(POST_PROCESS_O)
241
242s5pics/%.o : ../libc/gen/sys5/%.c
243	$(COMPILE.c) -o $@ $<
244	$(POST_PROCESS_O)
245
246pics/%.o s5pics/%.o : ../libc/inet/%.c
247	$(COMPILE.c) -o $@ $<
248	$(POST_PROCESS_O)
249
250pics/%.o s5pics/%.o : ../libc/net/%.c
251	$(COMPILE.c) -o $@ $<
252	$(POST_PROCESS_O)
253
254pics/%.o s5pics/%.o : ../libc/net/sparc/%.c
255	$(COMPILE.c) -o $@ $<
256	$(POST_PROCESS_O)
257
258pics/%.o s5pics/%.o : ../libc/stdio/common/%.c
259	$(COMPILE.c) -o $@ $<
260	$(POST_PROCESS_O)
261
262pics/%.o : ../libc/stdio/4.2/%.c
263	$(COMPILE.c) -o $@ $<
264	$(POST_PROCESS_O)
265
266s5pics/%.o : ../libc/stdio/sys5/%.c
267	$(COMPILE.c) -o $@ $<
268	$(POST_PROCESS_O)
269
270pics/%.o s5pics/%.o : ../libc/sys/common/%.s
271	$(BUILD.s)
272	$(POST_PROCESS_O)
273
274pics/%.o s5pics/%.o : ../libc/sys/common/%.c
275	$(COMPILE.c) -o $@ $<
276	$(POST_PROCESS_O)
277
278pics/%.o s5pics/%.o : ../libc/sys/common/sparc/%.s
279	$(BUILD.s)
280	$(POST_PROCESS_O)
281
282pics/%.o : ../libc/sys/4.2/%.c
283	$(COMPILE.c) -o $@ $<
284	$(POST_PROCESS_O)
285
286pics/%.o : ../libc/sys/4.2/sparc/%.s
287	$(BUILD.s)
288	$(POST_PROCESS_O)
289
290s5pics/%.o : ../libc/sys/sys5/%.c
291	$(COMPILE.c) -o $@ $<
292	$(POST_PROCESS_O)
293
294s5pics/%.o : ../libc/sys/sys5/sparc/%.s
295	$(BUILD.s)
296	$(POST_PROCESS_O)
297
298s5pics/%.o : ../libc/stdio/sys5/%.c
299	$(COMPILE.c) -o $@ $<
300	$(POST_PROCESS_O)
301
302pics/%.o s5pics/%.o : ../libc/rpc/%.c
303	$(COMPILE.c) -o $@ $<
304	$(POST_PROCESS_O)
305
306pics/%.o s5pics/%.o : ../libc/yp/%.c
307	$(COMPILE.c) -o $@ $<
308	$(POST_PROCESS_O)
309
310
311# include common library definitions
312include ../../Makefile.lib
313
314# There should be a mapfile here
315MAPFILES =
316
317C99MODE=	$(C99_DISABLE)
318
319#
320# The BCP include files depend on old preprocessor semantics.
321#
322CCMODE = -Xt
323
324# the bcp libraries go in /usr/4lib. override ROOTLIBDIR from ../../Makefile.lib
325# and save it so we can find the libraries with which to link
326ROOTLIBDIR=     $(ROOT)/usr/4lib
327
328CPPFLAGS= -Dsparc \
329	-I. -Iinc -I../inc/include -I../inc/include/sys $(CPPFLAGS.master)
330ASFLAGS=  -P -D__STDC__ -DLOCORE -D_SYS_SYS_S -D_ASM $(CPPFLAGS)
331LDLIBS= -t -R/usr/ucblib -L$(ROOT)/usr/ucblib $(LDLIBS.lib) \
332	-lucb -lc -lnsl -lsocket
333
334# SONAME is used by DYNFLAGS
335$(DYNLIB4X) :=	SONAME = $(DYNLIB4X)
336$(DYNLIBS5) :=	SONAME = $(DYNLIBS5)
337
338pics/%.o:= ASFLAGS += -K pic -DPIC
339pics/%.o:= CPPFLAGS += -K pic -DPIC
340s5pics/%.o:= ASFLAGS += -K pic -DPIC
341
342BUILD.s=  $(AS) $(ASFLAGS) $< -o $@
343
344# libbc method of building an archive
345BUILD.AR= $(RM) $@ ; \
346	$(AR) q $@ $(OBJECTS:%=$(DIR)/%)
347
348# the TXTS macro is used for NSE bootstrapping.
349TXTS=	inc/SYS.h inc/PIC.h inc/machine/asm_linkage.h
350
351LIBS = $(DYNLIB4X) $(DYNLIBS5)
352
353OBJECTS= $(COMPATCOM) $(COMPAT4.1) $(CRTSPARC) $(GENCOM) \
354$(GENCOMSPARC) $(GEN4.2) $(STDIOCOM) $(STDIO4.2) \
355$(INET) $(NET) $(NETSPARC) $(YP) \
356$(SYSCOM) $(SYSCOMSPARC) $(SYS4.2)
357
358#
359# Since this library is strictly for binary compability with ancient
360# applications, we deactivate CTF to avoid kicking up dust.
361#
362CTFCONVERT_POST = :
363CTFMERGE_LIB = :
364
365S5OBJECTS= $(COMPATCOM) $(COMPATSYS5) $(CRTSPARC) $(GENCOM) \
366$(GENCOMSPARC) $(GENSYS5) $(STDIOCOM) $(STDIOSYS5) \
367$(SYSCOM) $(SYSCOMSPARC) $(SYSSYS5) $(SSYS5SPARC) \
368$(INET) $(NET) $(NETSPARC) $(YP)
369
370S5PICOBJS=	$(S5OBJECTS:%=s5pics/%)
371
372CLEANFILES= ../libc/yp/ypupdate_prot.c ../inc/include/rpcsvc/ypupdate_prot.h \
373	../libc/compat/sys5/epoch.h \
374	$(S5PICOBJS)
375CLOBBERFILES= ../libc/compat/sys5/mkepoch
376
377# conditional assignments
378s5pics/%.o:= CPPFLAGS = -Dsparc -DS5EMUL -K pic -DPIC -I. -Iinc \
379	-I../inc/5include -I../inc/include -I../inc/include/sys \
380	$(CPPFLAGS.master)
381
382s5pics/%.o := CFLAGS += -xregs=no%appl
383pics/%.o := CFLAGS += -xregs=no%appl
384
385$(DYNLIB4X):= DIR = pics
386$(DYNLIBS5):= DIR = s5pics
387
388.KEEP_STATE:
389
390# Declare that all .o's can be made in parallel.
391.PARALLEL:	$(PICS) $(S5PICOBJS)
392
393all: $(TXTS) $(LIBS)
394
395$(DYNLIB4X): pics .WAIT $(PICS)
396	$(CC) -o $@ -G $(DYNFLAGS) $(PICS) $(LDLIBS)
397	$(POST_PROCESS_SO)
398
399$(DYNLIBS5): s5pics .WAIT $(S5PICOBJS)
400	$(CC) -o $@ -G $(DYNFLAGS) $(S5PICOBJS) $(LDLIBS)
401	$(POST_PROCESS_SO)
402
403# include common library targets
404include ../../Makefile.targ
405
406s5pics:
407	-@mkdir -p $@
408
409# special cases
410PSEUDO_POBJS= $(PSEUDO_SRCS:%.s=pics/%.o)
411PSEUDO_PS5OBJS= $(PSEUDO_SRCS:%.s=s5pics/%.o)
412
413$(PSEUDO_POBJS) $(PSEUDO_PS5OBJS):
414	@(echo '#include "SYS.h"'; \
415	echo '  SYSCALL($(@F:.o=))'; \
416	echo '  RET'; \
417	echo '  SET_SIZE($(@F:.o=))') >  tmp.$(@F:.o=).s
418	$(AS) $(ASFLAGS) -o $@ tmp.$(@F:.o=).s
419	$(POST_PROCESS_O)
420	@$(RM) tmp.$(@F:.o=).s
421
422s5pics/times.o : ../libc/compat/sys5/epoch.h ../libc/compat/sys5/times.c
423	$(COMPILE.c) -o $@ ../libc/compat/sys5/times.c
424	$(POST_PROCESS_O)
425
426../libc/compat/sys5/epoch.h: ../libc/compat/sys5/mkepoch
427	../libc/compat/sys5/mkepoch > $@
428
429../libc/compat/sys5/mkepoch: ../libc/compat/sys5/mkepoch.c
430	$(NATIVECC) -O -o $@ ../libc/compat/sys5/mkepoch.c
431
432pics/maperror.o s5pics/maperror.o: ../libc/sys/common/maperror.c
433	$(CC) -I../libc/sys/common $(CPPFLAGS) $(CFLAGS) -c -o $@ ../libc/sys/common/maperror.c
434
435#
436# The following rules generate the .h file and XDR routines from the
437# rpcgen source. Objects built here, look for it here. Further, when
438# building ypupdated it should look here too, but doesn't at the moment.
439#
440# It would be nice to use a ".x.h" rule for this, but that causes problems.
441#
442pics/yp_update.o \
443s5pics/yp_update.o : ../inc/include/rpcsvc/ypupdate_prot.h ../libc/yp/yp_update.c
444	$(COMPILE.c) -o $@ ../libc/yp/yp_update.c
445	$(POST_PROCESS_O)
446
447pics/ypupdate_prot.o s5pics/ypupdate_prot.o : ../inc/include/rpcsvc/ypupdate_prot.h\
448				../libc/yp/ypupdate_prot.c
449	$(COMPILE.c) -o $@ ../libc/yp/ypupdate_prot.c
450	$(POST_PROCESS_O)
451
452../libc/yp/ypupdate_prot.c: ../libc/yp/ypupdate_prot.x
453	$(RM) $@
454	$(RPCGEN) -c -o $@ ../libc/yp/ypupdate_prot.x
455
456../libc/yp/ypupdate_prot.h: ../libc/yp/ypupdate_prot.x
457	$(RM) $@ ../libc/yp/ypupdate_prot.h
458	$(RPCGEN) -h -o ../libc/yp/ypupdate_prot.h ../libc/yp/ypupdate_prot.x
459
460../inc/include/rpcsvc/ypupdate_prot.h: ../libc/yp/ypupdate_prot.h
461	cp ../libc/yp/ypupdate_prot.h $@
462