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 getacinfo.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 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 337DYNFLAGS += $(ZINTERPOSE) 338 339BUILD.s= $(AS) $(ASFLAGS) $< -o $@ 340 341# libbc method of building an archive 342BUILD.AR= $(RM) $@ ; \ 343 $(AR) q $@ $(OBJECTS:%=$(DIR)/%) 344 345# the TXTS macro is used for NSE bootstrapping. 346TXTS= inc/SYS.h inc/PIC.h inc/machine/asm_linkage.h 347 348LIBS = $(DYNLIB4X) $(DYNLIBS5) 349 350OBJECTS= $(COMPATCOM) $(COMPAT4.1) $(CRTSPARC) $(GENCOM) \ 351$(GENCOMSPARC) $(GEN4.2) $(STDIOCOM) $(STDIO4.2) \ 352$(INET) $(NET) $(NETSPARC) $(YP) \ 353$(SYSCOM) $(SYSCOMSPARC) $(SYS4.2) 354 355# 356# Since this library is strictly for binary compability with ancient 357# applications, we deactivate CTF to avoid kicking up dust. 358# 359CTFCONVERT_POST = : 360CTFMERGE_LIB = : 361 362S5OBJECTS= $(COMPATCOM) $(COMPATSYS5) $(CRTSPARC) $(GENCOM) \ 363$(GENCOMSPARC) $(GENSYS5) $(STDIOCOM) $(STDIOSYS5) \ 364$(SYSCOM) $(SYSCOMSPARC) $(SYSSYS5) $(SSYS5SPARC) \ 365$(INET) $(NET) $(NETSPARC) $(YP) 366 367S5PICOBJS= $(S5OBJECTS:%=s5pics/%) 368 369CLEANFILES= ../libc/yp/ypupdate_prot.c ../inc/include/rpcsvc/ypupdate_prot.h \ 370 ../libc/compat/sys5/epoch.h \ 371 $(S5PICOBJS) 372CLOBBERFILES= ../libc/compat/sys5/mkepoch 373 374# conditional assignments 375s5pics/%.o:= CPPFLAGS = -Dsparc -DS5EMUL -K pic -DPIC -I. -Iinc \ 376 -I../inc/5include -I../inc/include -I../inc/include/sys \ 377 $(CPPFLAGS.master) 378 379s5pics/%.o := CFLAGS += -xregs=no%appl 380pics/%.o := CFLAGS += -xregs=no%appl 381 382$(DYNLIB4X):= DIR = pics 383$(DYNLIBS5):= DIR = s5pics 384 385.KEEP_STATE: 386 387# Declare that all .o's can be made in parallel. 388.PARALLEL: $(PICS) $(S5PICOBJS) 389 390all: $(TXTS) $(LIBS) 391 392$(DYNLIB4X): pics .WAIT $(PICS) 393 $(CC) -o $@ -G $(DYNFLAGS) $(PICS) $(LDLIBS) 394 $(POST_PROCESS_SO) 395 396$(DYNLIBS5): s5pics .WAIT $(S5PICOBJS) 397 $(CC) -o $@ -G $(DYNFLAGS) $(S5PICOBJS) $(LDLIBS) 398 $(POST_PROCESS_SO) 399 400# include common library targets 401include ../../Makefile.targ 402 403s5pics: 404 -@mkdir -p $@ 405 406# special cases 407PSEUDO_POBJS= $(PSEUDO_SRCS:%.s=pics/%.o) 408PSEUDO_PS5OBJS= $(PSEUDO_SRCS:%.s=s5pics/%.o) 409 410$(PSEUDO_POBJS) $(PSEUDO_PS5OBJS): 411 @(echo '#include "SYS.h"'; \ 412 echo ' SYSCALL($(@F:.o=))'; \ 413 echo ' RET'; \ 414 echo ' SET_SIZE($(@F:.o=))') > tmp.$(@F:.o=).s 415 $(AS) $(ASFLAGS) -o $@ tmp.$(@F:.o=).s 416 $(POST_PROCESS_O) 417 @$(RM) tmp.$(@F:.o=).s 418 419s5pics/times.o : ../libc/compat/sys5/epoch.h ../libc/compat/sys5/times.c 420 $(COMPILE.c) -o $@ ../libc/compat/sys5/times.c 421 $(POST_PROCESS_O) 422 423../libc/compat/sys5/epoch.h: ../libc/compat/sys5/mkepoch 424 ../libc/compat/sys5/mkepoch > $@ 425 426../libc/compat/sys5/mkepoch: ../libc/compat/sys5/mkepoch.c 427 $(NATIVECC) -O -o $@ ../libc/compat/sys5/mkepoch.c 428 429pics/maperror.o s5pics/maperror.o: ../libc/sys/common/maperror.c 430 $(CC) -I../libc/sys/common $(CPPFLAGS) $(CFLAGS) -c -o $@ ../libc/sys/common/maperror.c 431 432# 433# The following rules generate the .h file and XDR routines from the 434# rpcgen source. Objects built here, look for it here. Further, when 435# building ypupdated it should look here too, but doesn't at the moment. 436# 437# It would be nice to use a ".x.h" rule for this, but that causes problems. 438# 439pics/yp_update.o \ 440s5pics/yp_update.o : ../inc/include/rpcsvc/ypupdate_prot.h ../libc/yp/yp_update.c 441 $(COMPILE.c) -o $@ ../libc/yp/yp_update.c 442 $(POST_PROCESS_O) 443 444pics/ypupdate_prot.o s5pics/ypupdate_prot.o : ../inc/include/rpcsvc/ypupdate_prot.h\ 445 ../libc/yp/ypupdate_prot.c 446 $(COMPILE.c) -o $@ ../libc/yp/ypupdate_prot.c 447 $(POST_PROCESS_O) 448 449../libc/yp/ypupdate_prot.c: ../libc/yp/ypupdate_prot.x 450 $(RM) $@ 451 $(RPCGEN) -c -o $@ ../libc/yp/ypupdate_prot.x 452 453../libc/yp/ypupdate_prot.h: ../libc/yp/ypupdate_prot.x 454 $(RM) $@ ../libc/yp/ypupdate_prot.h 455 $(RPCGEN) -h -o ../libc/yp/ypupdate_prot.h ../libc/yp/ypupdate_prot.x 456 457../inc/include/rpcsvc/ypupdate_prot.h: ../libc/yp/ypupdate_prot.h 458 cp ../libc/yp/ypupdate_prot.h $@ 459