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