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