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