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