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