1 # 2 # This file and its contents are supplied under the terms of the 3 # Common Development and Distribution License ("CDDL"), version 1.0. 4 # You may only use this file in accordance with the terms of version 5 # 1.0 of the CDDL. 6 # 7 # A full copy of the text of the CDDL should have accompanied this 8 # source. A copy of the CDDL is also available via the Internet at 9 # http://www.illumos.org/license/CDDL. 10 # 11 12 # 13 # Copyright 2016 Toomas Soome <tsoome@me.com> 14 # 15 16 # 17 # Notes: 18 # - We don't use the libc strerror/sys_errlist because the string table is 19 # quite large. 20 # 21 22 # standalone components and stuff we have modified locally 23 SRCS= $(ZLIB)/gzguts.h $(ZLIB)/zutil.h 24 SRCS += $(SASRC)/__main.c $(SASRC)/assert.c 25 SRCS += $(SASRC)/bcd.c $(SASRC)/environment.c 26 SRCS += $(SASRC)/getopt.c $(SASRC)/strtol.c 27 SRCS += $(SASRC)/strtoul.c $(SASRC)/random.c 28 SRCS += $(SASRC)/sbrk.c $(SASRC)/twiddle.c 29 SRCS += $(SASRC)/zalloc.c $(SASRC)/zalloc_malloc.c 30 31 OBJS= __main.o assert.o bcd.o environment.o \ 32 getopt.o gets.o globals.o pager.o panic.o printf.o \ 33 strdup.o strerror.o strtol.o strtoul.o random.o \ 34 sbrk.o twiddle.o zalloc.o zalloc_malloc.o 35 36 # private (pruned) versions of libc string functions 37 SRCS += $(SASRC)/strcasecmp.c 38 OBJS += strcasecmp.o 39 40 # from libc 41 SRCS += $(LIBSRC)/libc/net/ntoh.c 42 OBJS += ntoh.o 43 44 # string functions from libc 45 SRCS += $(LIBSRC)/libc/string/bcmp.c $(LIBSRC)/libc/string/bcopy.c 46 SRCS += $(LIBSRC)/libc/string/bzero.c $(LIBSRC)/libc/string/ffs.c 47 SRCS += $(LIBSRC)/libc/string/fls.c $(LIBSRC)/libc/string/memccpy.c 48 SRCS += $(LIBSRC)/libc/string/memchr.c $(LIBSRC)/libc/string/memcmp.c 49 SRCS += $(LIBSRC)/libc/string/memcpy.c $(LIBSRC)/libc/string/memmove.c 50 SRCS += $(LIBSRC)/libc/string/memset.c $(LIBSRC)/libc/string/strcat.c 51 SRCS += $(LIBSRC)/libc/string/strchr.c $(LIBSRC)/libc/string/strcmp.c 52 SRCS += $(LIBSRC)/libc/string/strcpy.c $(LIBSRC)/libc/string/stpcpy.c 53 SRCS += $(LIBSRC)/libc/string/stpncpy.c $(LIBSRC)/libc/string/strcspn.c 54 SRCS += $(LIBSRC)/libc/string/strlcat.c $(LIBSRC)/libc/string/strlcpy.c 55 SRCS += $(LIBSRC)/libc/string/strlen.c $(LIBSRC)/libc/string/strncat.c 56 SRCS += $(LIBSRC)/libc/string/strncmp.c $(LIBSRC)/libc/string/strncpy.c 57 SRCS += $(LIBSRC)/libc/string/strpbrk.c $(LIBSRC)/libc/string/strrchr.c 58 SRCS += $(LIBSRC)/libc/string/strsep.c $(LIBSRC)/libc/string/strspn.c 59 SRCS += $(LIBSRC)/libc/string/strstr.c $(LIBSRC)/libc/string/strtok.c 60 SRCS += $(LIBSRC)/libc/string/swab.c 61 62 SRCS += $(SASRC)/qdivrem.c 63 64 OBJS += bcmp.o bcopy.o bzero.o ffs.o fls.o \ 65 memccpy.o memchr.o memcmp.o memcpy.o memmove.o memset.o \ 66 qdivrem.o strcat.o strchr.o strcmp.o strcpy.o stpcpy.o stpncpy.o \ 67 strcspn.o strlcat.o strlcpy.o strlen.o strncat.o strncmp.o strncpy.o \ 68 strpbrk.o strrchr.o strsep.o strspn.o strstr.o strtok.o swab.o 69 70 # uuid functions from libc 71 SRCS += $(LIBSRC)/libc/uuid/uuid_create_nil.c 72 SRCS += $(LIBSRC)/libc/uuid/uuid_equal.c 73 SRCS += $(LIBSRC)/libc/uuid/uuid_is_nil.c 74 75 SRCS += $(SASRC)/uuid_from_string.c 76 SRCS += $(SASRC)/uuid_to_string.c 77 78 OBJS += uuid_create_nil.o uuid_equal.o uuid_from_string.o uuid_is_nil.o \ 79 uuid_to_string.o 80 81 # decompression functionality from libbz2 82 # NOTE: to actually test this functionality after libbz2 upgrade compile 83 # loader(8) with LOADER_BZIP2_SUPPORT defined 84 _bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o bzipfs.o \ 85 := CFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS 86 SRCS += libstand_bzlib_private.h 87 88 SRCS += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c 89 OBJS += _bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o 90 CLEANFILES += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c 91 92 _bzlib.c: $(SRC)/common/bzip2/bzlib.c 93 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 94 95 _crctable.c: $(SRC)/common/bzip2/crctable.c 96 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 97 98 _decompress.c: $(SRC)/common/bzip2/decompress.c 99 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 100 101 _huffman.c: $(SRC)/common/bzip2/huffman.c 102 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 103 104 _randtable.c: $(SRC)/common/bzip2/randtable.c 105 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 106 107 CLEANFILES += libstand_bzlib_private.h 108 libstand_bzlib_private.h: $(SRC)/common/bzip2/bzlib_private.h 109 sed -e 's|<stdlib.h>|"stand.h"|' $^ > $@ 110 111 # decompression functionality from zlib 112 adler32.o crc32.o _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o \ 113 gzipfs.o gzip.o := CPPFLAGS += -I$(ZLIB) 114 SRCS += $(ZLIB)/adler32.c $(ZLIB)/crc32.c \ 115 libstand_zutil.h libstand_gzguts.h 116 OBJS += adler32.o crc32.o 117 118 _infback.c: $(ZLIB)/infback.c 119 sed -e "s|zutil\.h|libstand_zutil.h|" \ 120 -e "s|gzguts\.h|libstand_gzguts.h|" \ 121 $^ > $@ 122 _inffast.c: $(ZLIB)/inffast.c 123 sed -e "s|zutil\.h|libstand_zutil.h|" \ 124 -e "s|gzguts\.h|libstand_gzguts.h|" \ 125 $^ > $@ 126 _inflate.c: $(ZLIB)/inflate.c 127 sed -e "s|zutil\.h|libstand_zutil.h|" \ 128 -e "s|gzguts\.h|libstand_gzguts.h|" \ 129 $^ > $@ 130 _inftrees.c: $(ZLIB)/inftrees.c 131 sed -e "s|zutil\.h|libstand_zutil.h|" \ 132 -e "s|gzguts\.h|libstand_gzguts.h|" \ 133 $^ > $@ 134 _zutil.c: $(ZLIB)/zutil.c 135 sed -e "s|zutil\.h|libstand_zutil.h|" \ 136 -e "s|gzguts\.h|libstand_gzguts.h|" \ 137 $^ > $@ 138 139 SRCS += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c 140 OBJS += _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o 141 CLEANFILES += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c 142 143 # depend on stand.h being able to be included multiple times 144 libstand_zutil.h: $(ZLIB)/zutil.h 145 sed -e 's|<fcntl.h>|"stand.h"|' \ 146 -e 's|<stddef.h>|"stand.h"|' \ 147 -e 's|<string.h>|"stand.h"|' \ 148 -e 's|<stdio.h>|"stand.h"|' \ 149 -e 's|<stdlib.h>|"stand.h"|' \ 150 $^ > $@ 151 152 libstand_gzguts.h: $(ZLIB)/gzguts.h 153 sed -e 's|<fcntl.h>|"stand.h"|' \ 154 -e 's|<stddef.h>|"stand.h"|' \ 155 -e 's|<string.h>|"stand.h"|' \ 156 -e 's|<stdio.h>|"stand.h"|' \ 157 -e 's|<stdlib.h>|"stand.h"|' \ 158 $^ > $@ 159 160 CLEANFILES += libstand_zutil.h libstand_gzguts.h 161 162 # io routines 163 SRCS += $(SASRC)/closeall.c $(SASRC)/dev.c \ 164 $(SASRC)/ioctl.c $(SASRC)/nullfs.c \ 165 $(SASRC)/stat.c $(SASRC)/fstat.c $(SASRC)/close.c \ 166 $(SASRC)/lseek.c $(SASRC)/open.c $(SASRC)/read.c \ 167 $(SASRC)/write.c $(SASRC)/readdir.c 168 169 OBJS += closeall.o dev.o ioctl.o nullfs.o stat.o fstat.o close.o lseek.o \ 170 open.o read.o write.o readdir.o 171 172 # network routines 173 SRCS += $(SASRC)/arp.c $(SASRC)/ether.c $(SASRC)/ip.c \ 174 $(SASRC)/inet_ntoa.c $(SASRC)/in_cksum.c \ 175 $(SASRC)/net.c $(SASRC)/udp.c $(SASRC)/netif.c \ 176 $(SASRC)/rpc.c 177 OBJS += arp.o ether.o ip.o inet_ntoa.o in_cksum.o net.o udp.o netif.o rpc.o 178 179 # network info services: 180 SRCS += $(SASRC)/bootp.c $(SASRC)/rarp.c \ 181 $(SASRC)/bootparam.c 182 OBJS += bootp.o rarp.o bootparam.o 183 184 # boot filesystems 185 SRCS += $(SASRC)/ufs.c 186 SRCS += $(SASRC)/nfs.c 187 SRCS += $(SASRC)/cd9660.c 188 SRCS += $(SASRC)/tftp.c 189 SRCS += $(SASRC)/gzipfs.c 190 SRCS += $(SASRC)/bzipfs.c 191 SRCS += $(SASRC)/dosfs.c 192 OBJS += ufs.o 193 OBJS += nfs.o 194 OBJS += cd9660.o 195 OBJS += tftp.o 196 OBJS += gzipfs.o 197 OBJS += bzipfs.o 198 OBJS += dosfs.o 199 # 200 .PARALLEL: