Toomas Soome | 199767f | 2015-10-25 00:06:51 +0300 | [diff] [blame^] | 1 | # $FreeBSD$ |
| 2 | # Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $ |
| 3 | # |
| 4 | # Notes: |
| 5 | # - We don't use the libc strerror/sys_errlist because the string table is |
| 6 | # quite large. |
| 7 | # |
| 8 | |
| 9 | MAN= |
| 10 | |
| 11 | .include <bsd.own.mk> |
| 12 | MK_SSP= no |
| 13 | |
| 14 | LIBSTAND_SRC= ${.CURDIR}/../../../../lib/libstand |
| 15 | LIBC_SRC= ${LIBSTAND_SRC}/../libc |
| 16 | |
| 17 | .PATH: ${LIBSTAND_SRC} |
| 18 | LIB= stand |
| 19 | INTERNALLIB= |
| 20 | MK_PROFILE= no |
| 21 | NO_PIC= |
| 22 | |
| 23 | WARNS?= 0 |
| 24 | |
| 25 | # standalone components and stuff we have modified locally |
| 26 | SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \ |
| 27 | globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \ |
| 28 | sbrk.c twiddle.c zalloc.c zalloc_malloc.c |
| 29 | |
| 30 | # private (pruned) versions of libc string functions |
| 31 | SRCS+= strcasecmp.c |
| 32 | |
| 33 | .PATH: ${LIBC_SRC}/net |
| 34 | |
| 35 | SRCS+= ntoh.c |
| 36 | |
| 37 | # string functions from libc |
| 38 | .PATH: ${LIBC_SRC}/string |
| 39 | .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \ |
| 40 | ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \ |
| 41 | ${MACHINE_CPUARCH} == "arm" |
| 42 | SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ |
| 43 | memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ |
| 44 | strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \ |
| 45 | strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c |
| 46 | .endif |
| 47 | .if ${MACHINE_CPUARCH} == "arm" |
| 48 | .PATH: ${LIBC_SRC}/arm/gen |
| 49 | SRCS+= divsi3.S |
| 50 | .endif |
| 51 | .if ${MACHINE_CPUARCH} == "powerpc" |
| 52 | .PATH: ${LIBC_SRC}/quad |
| 53 | SRCS+= ashldi3.c ashrdi3.c |
| 54 | .PATH: ${LIBC_SRC}/powerpc/gen |
| 55 | SRCS+= syncicache.c |
| 56 | .endif |
| 57 | |
| 58 | # uuid functions from libc |
| 59 | .PATH: ${LIBC_SRC}/uuid |
| 60 | SRCS+= uuid_equal.c uuid_is_nil.c |
| 61 | |
| 62 | # _setjmp/_longjmp |
| 63 | .if ${MACHINE_CPUARCH} == "amd64" |
| 64 | .PATH: ${LIBSTAND_SRC}/amd64 |
| 65 | .elif ${MACHINE_ARCH} == "powerpc64" |
| 66 | .PATH: ${LIBSTAND_SRC}/powerpc |
| 67 | .else |
| 68 | .PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH} |
| 69 | .endif |
| 70 | SRCS+= _setjmp.S |
| 71 | |
| 72 | # decompression functionality from libbz2 |
| 73 | # NOTE: to actually test this functionality after libbz2 upgrade compile |
| 74 | # loader(8) with LOADER_BZIP2_SUPPORT defined |
| 75 | .PATH: ${LIBSTAND_SRC}/../../contrib/bzip2 |
| 76 | CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS |
| 77 | SRCS+= libstand_bzlib_private.h |
| 78 | |
| 79 | .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c |
| 80 | SRCS+= _${file} |
| 81 | CLEANFILES+= _${file} |
| 82 | |
| 83 | _${file}: ${file} |
| 84 | sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \ |
| 85 | ${.ALLSRC} > ${.TARGET} |
| 86 | .endfor |
| 87 | |
| 88 | CLEANFILES+= libstand_bzlib_private.h |
| 89 | libstand_bzlib_private.h: bzlib_private.h |
| 90 | sed -e 's|<stdlib.h>|"stand.h"|' \ |
| 91 | ${.ALLSRC} > ${.TARGET} |
| 92 | |
| 93 | # decompression functionality from libz |
| 94 | .PATH: ${LIBSTAND_SRC}/../libz |
| 95 | CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz |
| 96 | SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h |
| 97 | |
| 98 | .for file in infback.c inffast.c inflate.c inftrees.c zutil.c |
| 99 | SRCS+= _${file} |
| 100 | CLEANFILES+= _${file} |
| 101 | |
| 102 | _${file}: ${file} |
| 103 | sed -e "s|zutil\.h|libstand_zutil.h|" \ |
| 104 | -e "s|gzguts\.h|libstand_gzguts.h|" \ |
| 105 | ${.ALLSRC} > ${.TARGET} |
| 106 | .endfor |
| 107 | |
| 108 | # depend on stand.h being able to be included multiple times |
| 109 | .for file in zutil.h gzguts.h |
| 110 | CLEANFILES+= libstand_${file} |
| 111 | libstand_${file}: ${file} |
| 112 | sed -e 's|<fcntl.h>|"stand.h"|' \ |
| 113 | -e 's|<stddef.h>|"stand.h"|' \ |
| 114 | -e 's|<string.h>|"stand.h"|' \ |
| 115 | -e 's|<stdio.h>|"stand.h"|' \ |
| 116 | -e 's|<stdlib.h>|"stand.h"|' \ |
| 117 | ${.ALLSRC} > ${.TARGET} |
| 118 | .endfor |
| 119 | |
| 120 | # io routines |
| 121 | SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ |
| 122 | fstat.c close.c lseek.c open.c read.c write.c readdir.c |
| 123 | |
| 124 | # network routines |
| 125 | SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c |
| 126 | |
| 127 | # network info services: |
| 128 | SRCS+= bootp.c rarp.c bootparam.c |
| 129 | |
| 130 | # boot filesystems |
| 131 | SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c |
| 132 | SRCS+= dosfs.c ext2fs.c |
| 133 | SRCS+= splitfs.c |
| 134 | |
| 135 | .include <bsd.stand.mk> |
| 136 | .include <bsd.lib.mk> |