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 23SRCS= $(LIB_BASE)/libz/gzguts.h $(LIB_BASE)/libz/zutil.h 24SRCS += $(LIBSTAND_SRC)/__main.c $(LIBSTAND_SRC)/assert.c 25SRCS += $(LIBSTAND_SRC)/bcd.c $(LIBSTAND_SRC)/environment.c 26SRCS += $(LIBSTAND_SRC)/getopt.c $(LIBSTAND_SRC)/strtol.c 27SRCS += $(LIBSTAND_SRC)/strtoul.c $(LIBSTAND_SRC)/random.c 28SRCS += $(LIBSTAND_SRC)/sbrk.c $(LIBSTAND_SRC)/twiddle.c 29SRCS += $(LIBSTAND_SRC)/zalloc.c $(LIBSTAND_SRC)/zalloc_malloc.c 30 31OBJS= __main.o assert.o bcd.o environment.o \ 32 getopt.o gets.o globals.o pager.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 37SRCS += $(LIBSTAND_SRC)/strcasecmp.c 38OBJS += strcasecmp.o 39 40# from libc 41SRCS += $(LIB_BASE)/libc/net/ntoh.c 42OBJS += ntoh.o 43 44# string functions from libc 45SRCS += $(LIB_BASE)/libc/string/bcmp.c $(LIB_BASE)/libc/string/bcopy.c 46SRCS += $(LIB_BASE)/libc/string/bzero.c $(LIB_BASE)/libc/string/ffs.c 47SRCS += $(LIB_BASE)/libc/string/fls.c $(LIB_BASE)/libc/string/memccpy.c 48SRCS += $(LIB_BASE)/libc/string/memchr.c $(LIB_BASE)/libc/string/memcmp.c 49SRCS += $(LIB_BASE)/libc/string/memcpy.c $(LIB_BASE)/libc/string/memmove.c 50SRCS += $(LIB_BASE)/libc/string/memset.c $(LIB_BASE)/libc/string/strcat.c 51SRCS += $(LIB_BASE)/libc/string/strchr.c $(LIB_BASE)/libc/string/strcmp.c 52SRCS += $(LIB_BASE)/libc/string/strcpy.c $(LIB_BASE)/libc/string/strcspn.c 53SRCS += $(LIB_BASE)/libc/string/strlcat.c $(LIB_BASE)/libc/string/strlcpy.c 54SRCS += $(LIB_BASE)/libc/string/strlen.c $(LIB_BASE)/libc/string/strncat.c 55SRCS += $(LIB_BASE)/libc/string/strncmp.c $(LIB_BASE)/libc/string/strncpy.c 56SRCS += $(LIB_BASE)/libc/string/strpbrk.c $(LIB_BASE)/libc/string/strrchr.c 57SRCS += $(LIB_BASE)/libc/string/strsep.c $(LIB_BASE)/libc/string/strspn.c 58SRCS += $(LIB_BASE)/libc/string/strstr.c $(LIB_BASE)/libc/string/strtok.c 59SRCS += $(LIB_BASE)/libc/string/swab.c 60 61SRCS += $(LIBSTAND_SRC)/qdivrem.c 62 63OBJS += bcmp.o bcopy.o bzero.o ffs.o fls.o \ 64 memccpy.o memchr.o memcmp.o memcpy.o memmove.o memset.o \ 65 qdivrem.o strcat.o strchr.o strcmp.o strcpy.o \ 66 strcspn.o strlcat.o strlcpy.o strlen.o strncat.o strncmp.o strncpy.o \ 67 strpbrk.o strrchr.o strsep.o strspn.o strstr.o strtok.o swab.o 68 69# uuid functions from libc 70SRCS += $(LIB_BASE)/libc/uuid/uuid_create_nil.c 71SRCS += $(LIB_BASE)/libc/uuid/uuid_equal.c 72SRCS += $(LIB_BASE)/libc/uuid/uuid_is_nil.c 73 74SRCS += $(LIBSTAND_SRC)/uuid_from_string.c 75SRCS += $(LIBSTAND_SRC)/uuid_to_string.c 76 77OBJS += uuid_create_nil.o uuid_equal.o uuid_from_string.o uuid_is_nil.o \ 78 uuid_to_string.o 79 80# decompression functionality from libbz2 81# NOTE: to actually test this functionality after libbz2 upgrade compile 82# loader(8) with LOADER_BZIP2_SUPPORT defined 83CFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS 84SRCS += libstand_bzlib_private.h 85 86SRCS += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c 87OBJS += _bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o 88CLEANFILES += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c 89 90_bzlib.c: $(SRC)/common/bzip2/bzlib.c 91 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 92 93_crctable.c: $(SRC)/common/bzip2/crctable.c 94 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 95 96_decompress.c: $(SRC)/common/bzip2/decompress.c 97 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 98 99_huffman.c: $(SRC)/common/bzip2/huffman.c 100 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 101 102_randtable.c: $(SRC)/common/bzip2/randtable.c 103 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 104 105CLEANFILES += libstand_bzlib_private.h 106libstand_bzlib_private.h: $(SRC)/common/bzip2/bzlib_private.h 107 sed -e 's|<stdlib.h>|"stand.h"|' $^ > $@ 108 109# decompression functionality from libz 110CFLAGS += -DHAVE_MEMCPY -I$(LIB_BASE)/libz 111SRCS += $(LIB_BASE)/libz/adler32.c $(LIB_BASE)/libz/crc32.c \ 112 libstand_zutil.h libstand_gzguts.h 113OBJS += adler32.o crc32.o 114 115_infback.c: $(LIB_BASE)/libz/infback.c 116 sed -e "s|zutil\.h|libstand_zutil.h|" \ 117 -e "s|gzguts\.h|libstand_gzguts.h|" \ 118 $^ > $@ 119_inffast.c: $(LIB_BASE)/libz/inffast.c 120 sed -e "s|zutil\.h|libstand_zutil.h|" \ 121 -e "s|gzguts\.h|libstand_gzguts.h|" \ 122 $^ > $@ 123_inflate.c: $(LIB_BASE)/libz/inflate.c 124 sed -e "s|zutil\.h|libstand_zutil.h|" \ 125 -e "s|gzguts\.h|libstand_gzguts.h|" \ 126 $^ > $@ 127_inftrees.c: $(LIB_BASE)/libz/inftrees.c 128 sed -e "s|zutil\.h|libstand_zutil.h|" \ 129 -e "s|gzguts\.h|libstand_gzguts.h|" \ 130 $^ > $@ 131_zutil.c: $(LIB_BASE)/libz/zutil.c 132 sed -e "s|zutil\.h|libstand_zutil.h|" \ 133 -e "s|gzguts\.h|libstand_gzguts.h|" \ 134 $^ > $@ 135 136SRCS += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c 137OBJS += _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o 138CLEANFILES += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c 139 140# depend on stand.h being able to be included multiple times 141libstand_zutil.h: $(LIB_BASE)/libz/zutil.h 142 sed -e 's|<fcntl.h>|"stand.h"|' \ 143 -e 's|<stddef.h>|"stand.h"|' \ 144 -e 's|<string.h>|"stand.h"|' \ 145 -e 's|<stdio.h>|"stand.h"|' \ 146 -e 's|<stdlib.h>|"stand.h"|' \ 147 $^ > $@ 148 149libstand_gzguts.h: $(LIB_BASE)/libz/gzguts.h 150 sed -e 's|<fcntl.h>|"stand.h"|' \ 151 -e 's|<stddef.h>|"stand.h"|' \ 152 -e 's|<string.h>|"stand.h"|' \ 153 -e 's|<stdio.h>|"stand.h"|' \ 154 -e 's|<stdlib.h>|"stand.h"|' \ 155 $^ > $@ 156 157CLEANFILES += libstand_zutil.h libstand_gzguts.h 158 159# io routines 160SRCS += $(LIBSTAND_SRC)/closeall.c $(LIBSTAND_SRC)/dev.c \ 161 $(LIBSTAND_SRC)/ioctl.c $(LIBSTAND_SRC)/nullfs.c \ 162 $(LIBSTAND_SRC)/stat.c $(LIBSTAND_SRC)/fstat.c $(LIBSTAND_SRC)/close.c \ 163 $(LIBSTAND_SRC)/lseek.c $(LIBSTAND_SRC)/open.c $(LIBSTAND_SRC)/read.c \ 164 $(LIBSTAND_SRC)/write.c $(LIBSTAND_SRC)/readdir.c 165 166OBJS += closeall.o dev.o ioctl.o nullfs.o stat.o fstat.o close.o lseek.o \ 167 open.o read.o write.o readdir.o 168 169# network routines 170SRCS += $(LIBSTAND_SRC)/arp.c $(LIBSTAND_SRC)/ether.c \ 171 $(LIBSTAND_SRC)/inet_ntoa.c $(LIBSTAND_SRC)/in_cksum.c \ 172 $(LIBSTAND_SRC)/net.c $(LIBSTAND_SRC)/udp.c $(LIBSTAND_SRC)/netif.c \ 173 $(LIBSTAND_SRC)/rpc.c 174OBJS += arp.o ether.o inet_ntoa.o in_cksum.o net.o udp.o netif.o rpc.o 175 176# network info services: 177SRCS += $(LIBSTAND_SRC)/bootp.c $(LIBSTAND_SRC)/rarp.c \ 178 $(LIBSTAND_SRC)/bootparam.c 179OBJS += bootp.o rarp.o bootparam.o 180 181# boot filesystems 182SRCS += $(LIBSTAND_SRC)/ufs.c 183SRCS += $(LIBSTAND_SRC)/nfs.c 184SRCS += $(LIBSTAND_SRC)/cd9660.c 185SRCS += $(LIBSTAND_SRC)/tftp.c 186SRCS += $(LIBSTAND_SRC)/gzipfs.c 187SRCS += $(LIBSTAND_SRC)/bzipfs.c 188SRCS += $(LIBSTAND_SRC)/dosfs.c 189OBJS += ufs.o 190OBJS += nfs.o 191OBJS += cd9660.o 192OBJS += tftp.o 193OBJS += gzipfs.o 194OBJS += bzipfs.o 195OBJS += dosfs.o 196# 197