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