14a5d661aSToomas Soome# 24a5d661aSToomas Soome# This file and its contents are supplied under the terms of the 34a5d661aSToomas Soome# Common Development and Distribution License ("CDDL"), version 1.0. 44a5d661aSToomas Soome# You may only use this file in accordance with the terms of version 54a5d661aSToomas Soome# 1.0 of the CDDL. 64a5d661aSToomas Soome# 74a5d661aSToomas Soome# A full copy of the text of the CDDL should have accompanied this 84a5d661aSToomas Soome# source. A copy of the CDDL is also available via the Internet at 94a5d661aSToomas Soome# http://www.illumos.org/license/CDDL. 104a5d661aSToomas Soome# 114a5d661aSToomas Soome 124a5d661aSToomas Soome# 134a5d661aSToomas Soome# Copyright 2016 Toomas Soome <tsoome@me.com> 144a5d661aSToomas Soome# 154a5d661aSToomas Soome 164a5d661aSToomas Soome# 174a5d661aSToomas Soome# Notes: 184a5d661aSToomas Soome# - We don't use the libc strerror/sys_errlist because the string table is 194a5d661aSToomas Soome# quite large. 204a5d661aSToomas Soome# 214a5d661aSToomas Soome 224a5d661aSToomas Soome# standalone components and stuff we have modified locally 234a5d661aSToomas SoomeSRCS= $(LIB_BASE)/libz/gzguts.h $(LIB_BASE)/libz/zutil.h 244a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/__main.c $(LIBSTAND_SRC)/assert.c 25*31da4aefSToomas SoomeSRCS += $(LIBSTAND_SRC)/bcd.c $(LIBSTAND_SRC)/environment.c 26*31da4aefSToomas SoomeSRCS += $(LIBSTAND_SRC)/getopt.c $(LIBSTAND_SRC)/strtol.c 27*31da4aefSToomas SoomeSRCS += $(LIBSTAND_SRC)/strtoul.c $(LIBSTAND_SRC)/random.c 28*31da4aefSToomas SoomeSRCS += $(LIBSTAND_SRC)/sbrk.c $(LIBSTAND_SRC)/twiddle.c 29*31da4aefSToomas SoomeSRCS += $(LIBSTAND_SRC)/zalloc.c $(LIBSTAND_SRC)/zalloc_malloc.c 304a5d661aSToomas Soome 31*31da4aefSToomas SoomeOBJS= __main.o assert.o bcd.o environment.o \ 324a5d661aSToomas Soome getopt.o gets.o globals.o pager.o printf.o \ 334a5d661aSToomas Soome strdup.o strerror.o strtol.o strtoul.o random.o \ 344a5d661aSToomas Soome sbrk.o twiddle.o zalloc.o zalloc_malloc.o 354a5d661aSToomas Soome 364a5d661aSToomas Soome# private (pruned) versions of libc string functions 374a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/strcasecmp.c 384a5d661aSToomas SoomeOBJS += strcasecmp.o 394a5d661aSToomas Soome 404a5d661aSToomas Soome# from libc 414a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/net/ntoh.c 424a5d661aSToomas SoomeOBJS += ntoh.o 434a5d661aSToomas Soome 444a5d661aSToomas Soome# string functions from libc 454a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/bcmp.c $(LIB_BASE)/libc/string/bcopy.c 464a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/bzero.c $(LIB_BASE)/libc/string/ffs.c 474a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/fls.c $(LIB_BASE)/libc/string/memccpy.c 484a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/memchr.c $(LIB_BASE)/libc/string/memcmp.c 494a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/memcpy.c $(LIB_BASE)/libc/string/memmove.c 504a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/memset.c $(LIB_BASE)/libc/string/strcat.c 514a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strchr.c $(LIB_BASE)/libc/string/strcmp.c 524a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strcpy.c $(LIB_BASE)/libc/string/strcspn.c 534a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strlcat.c $(LIB_BASE)/libc/string/strlcpy.c 544a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strlen.c $(LIB_BASE)/libc/string/strncat.c 554a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strncmp.c $(LIB_BASE)/libc/string/strncpy.c 564a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strpbrk.c $(LIB_BASE)/libc/string/strrchr.c 574a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strsep.c $(LIB_BASE)/libc/string/strspn.c 584a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/strstr.c $(LIB_BASE)/libc/string/strtok.c 594a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/string/swab.c 604a5d661aSToomas Soome 614a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/qdivrem.c 624a5d661aSToomas Soome 634a5d661aSToomas SoomeOBJS += bcmp.o bcopy.o bzero.o ffs.o fls.o \ 644a5d661aSToomas Soome memccpy.o memchr.o memcmp.o memcpy.o memmove.o memset.o \ 654a5d661aSToomas Soome qdivrem.o strcat.o strchr.o strcmp.o strcpy.o \ 664a5d661aSToomas Soome strcspn.o strlcat.o strlcpy.o strlen.o strncat.o strncmp.o strncpy.o \ 674a5d661aSToomas Soome strpbrk.o strrchr.o strsep.o strspn.o strstr.o strtok.o swab.o 684a5d661aSToomas Soome 694a5d661aSToomas Soome# uuid functions from libc 704a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/uuid/uuid_create_nil.c 714a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/uuid/uuid_equal.c 724a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libc/uuid/uuid_is_nil.c 734a5d661aSToomas Soome 744a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/uuid_from_string.c 754a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/uuid_to_string.c 764a5d661aSToomas Soome 774a5d661aSToomas SoomeOBJS += uuid_create_nil.o uuid_equal.o uuid_from_string.o uuid_is_nil.o \ 784a5d661aSToomas Soome uuid_to_string.o 794a5d661aSToomas Soome 804a5d661aSToomas Soome# decompression functionality from libbz2 814a5d661aSToomas Soome# NOTE: to actually test this functionality after libbz2 upgrade compile 824a5d661aSToomas Soome# loader(8) with LOADER_BZIP2_SUPPORT defined 836cac02c5SYuri PankovCFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS 844a5d661aSToomas SoomeSRCS += libstand_bzlib_private.h 854a5d661aSToomas Soome 864a5d661aSToomas SoomeSRCS += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c 874a5d661aSToomas SoomeOBJS += _bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o 884a5d661aSToomas SoomeCLEANFILES += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c 894a5d661aSToomas Soome 906cac02c5SYuri Pankov_bzlib.c: $(SRC)/common/bzip2/bzlib.c 914a5d661aSToomas Soome sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 924a5d661aSToomas Soome 936cac02c5SYuri Pankov_crctable.c: $(SRC)/common/bzip2/crctable.c 944a5d661aSToomas Soome sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 954a5d661aSToomas Soome 966cac02c5SYuri Pankov_decompress.c: $(SRC)/common/bzip2/decompress.c 974a5d661aSToomas Soome sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 984a5d661aSToomas Soome 996cac02c5SYuri Pankov_huffman.c: $(SRC)/common/bzip2/huffman.c 1004a5d661aSToomas Soome sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 1014a5d661aSToomas Soome 1026cac02c5SYuri Pankov_randtable.c: $(SRC)/common/bzip2/randtable.c 1034a5d661aSToomas Soome sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@ 1044a5d661aSToomas Soome 1054a5d661aSToomas SoomeCLEANFILES += libstand_bzlib_private.h 1066cac02c5SYuri Pankovlibstand_bzlib_private.h: $(SRC)/common/bzip2/bzlib_private.h 1074a5d661aSToomas Soome sed -e 's|<stdlib.h>|"stand.h"|' $^ > $@ 1084a5d661aSToomas Soome 1094a5d661aSToomas Soome# decompression functionality from libz 1104a5d661aSToomas SoomeCFLAGS += -DHAVE_MEMCPY -I$(LIB_BASE)/libz 1114a5d661aSToomas SoomeSRCS += $(LIB_BASE)/libz/adler32.c $(LIB_BASE)/libz/crc32.c \ 1124a5d661aSToomas Soome libstand_zutil.h libstand_gzguts.h 1134a5d661aSToomas SoomeOBJS += adler32.o crc32.o 1144a5d661aSToomas Soome 1154a5d661aSToomas Soome_infback.c: $(LIB_BASE)/libz/infback.c 1164a5d661aSToomas Soome sed -e "s|zutil\.h|libstand_zutil.h|" \ 1174a5d661aSToomas Soome -e "s|gzguts\.h|libstand_gzguts.h|" \ 1184a5d661aSToomas Soome $^ > $@ 1194a5d661aSToomas Soome_inffast.c: $(LIB_BASE)/libz/inffast.c 1204a5d661aSToomas Soome sed -e "s|zutil\.h|libstand_zutil.h|" \ 1214a5d661aSToomas Soome -e "s|gzguts\.h|libstand_gzguts.h|" \ 1224a5d661aSToomas Soome $^ > $@ 1234a5d661aSToomas Soome_inflate.c: $(LIB_BASE)/libz/inflate.c 1244a5d661aSToomas Soome sed -e "s|zutil\.h|libstand_zutil.h|" \ 1254a5d661aSToomas Soome -e "s|gzguts\.h|libstand_gzguts.h|" \ 1264a5d661aSToomas Soome $^ > $@ 1274a5d661aSToomas Soome_inftrees.c: $(LIB_BASE)/libz/inftrees.c 1284a5d661aSToomas Soome sed -e "s|zutil\.h|libstand_zutil.h|" \ 1294a5d661aSToomas Soome -e "s|gzguts\.h|libstand_gzguts.h|" \ 1304a5d661aSToomas Soome $^ > $@ 1314a5d661aSToomas Soome_zutil.c: $(LIB_BASE)/libz/zutil.c 1324a5d661aSToomas Soome sed -e "s|zutil\.h|libstand_zutil.h|" \ 1334a5d661aSToomas Soome -e "s|gzguts\.h|libstand_gzguts.h|" \ 1344a5d661aSToomas Soome $^ > $@ 1354a5d661aSToomas Soome 1364a5d661aSToomas SoomeSRCS += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c 1374a5d661aSToomas SoomeOBJS += _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o 1384a5d661aSToomas SoomeCLEANFILES += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c 1394a5d661aSToomas Soome 1404a5d661aSToomas Soome# depend on stand.h being able to be included multiple times 1414a5d661aSToomas Soomelibstand_zutil.h: $(LIB_BASE)/libz/zutil.h 1424a5d661aSToomas Soome sed -e 's|<fcntl.h>|"stand.h"|' \ 1434a5d661aSToomas Soome -e 's|<stddef.h>|"stand.h"|' \ 1444a5d661aSToomas Soome -e 's|<string.h>|"stand.h"|' \ 1454a5d661aSToomas Soome -e 's|<stdio.h>|"stand.h"|' \ 1464a5d661aSToomas Soome -e 's|<stdlib.h>|"stand.h"|' \ 1474a5d661aSToomas Soome $^ > $@ 1484a5d661aSToomas Soome 1494a5d661aSToomas Soomelibstand_gzguts.h: $(LIB_BASE)/libz/gzguts.h 1504a5d661aSToomas Soome sed -e 's|<fcntl.h>|"stand.h"|' \ 1514a5d661aSToomas Soome -e 's|<stddef.h>|"stand.h"|' \ 1524a5d661aSToomas Soome -e 's|<string.h>|"stand.h"|' \ 1534a5d661aSToomas Soome -e 's|<stdio.h>|"stand.h"|' \ 1544a5d661aSToomas Soome -e 's|<stdlib.h>|"stand.h"|' \ 1554a5d661aSToomas Soome $^ > $@ 1564a5d661aSToomas Soome 1574a5d661aSToomas SoomeCLEANFILES += libstand_zutil.h libstand_gzguts.h 1584a5d661aSToomas Soome 1594a5d661aSToomas Soome# io routines 1604a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/closeall.c $(LIBSTAND_SRC)/dev.c \ 1614a5d661aSToomas Soome $(LIBSTAND_SRC)/ioctl.c $(LIBSTAND_SRC)/nullfs.c \ 1624a5d661aSToomas Soome $(LIBSTAND_SRC)/stat.c $(LIBSTAND_SRC)/fstat.c $(LIBSTAND_SRC)/close.c \ 1634a5d661aSToomas Soome $(LIBSTAND_SRC)/lseek.c $(LIBSTAND_SRC)/open.c $(LIBSTAND_SRC)/read.c \ 1644a5d661aSToomas Soome $(LIBSTAND_SRC)/write.c $(LIBSTAND_SRC)/readdir.c 1654a5d661aSToomas Soome 1664a5d661aSToomas SoomeOBJS += closeall.o dev.o ioctl.o nullfs.o stat.o fstat.o close.o lseek.o \ 1674a5d661aSToomas Soome open.o read.o write.o readdir.o 1684a5d661aSToomas Soome 1694a5d661aSToomas Soome# network routines 1704a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/arp.c $(LIBSTAND_SRC)/ether.c \ 1714a5d661aSToomas Soome $(LIBSTAND_SRC)/inet_ntoa.c $(LIBSTAND_SRC)/in_cksum.c \ 1724a5d661aSToomas Soome $(LIBSTAND_SRC)/net.c $(LIBSTAND_SRC)/udp.c $(LIBSTAND_SRC)/netif.c \ 1734a5d661aSToomas Soome $(LIBSTAND_SRC)/rpc.c 1744a5d661aSToomas SoomeOBJS += arp.o ether.o inet_ntoa.o in_cksum.o net.o udp.o netif.o rpc.o 1754a5d661aSToomas Soome 1764a5d661aSToomas Soome# network info services: 1774a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/bootp.c $(LIBSTAND_SRC)/rarp.c \ 1784a5d661aSToomas Soome $(LIBSTAND_SRC)/bootparam.c 1794a5d661aSToomas SoomeOBJS += bootp.o rarp.o bootparam.o 1804a5d661aSToomas Soome 1814a5d661aSToomas Soome# boot filesystems 1824a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/ufs.c 1834a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/nfs.c 1844a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/cd9660.c 1854a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/tftp.c 1864a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/gzipfs.c 1874a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/bzipfs.c 1884a5d661aSToomas SoomeSRCS += $(LIBSTAND_SRC)/dosfs.c 1894a5d661aSToomas SoomeOBJS += ufs.o 1904a5d661aSToomas SoomeOBJS += nfs.o 1914a5d661aSToomas SoomeOBJS += cd9660.o 1924a5d661aSToomas SoomeOBJS += tftp.o 1934a5d661aSToomas SoomeOBJS += gzipfs.o 1944a5d661aSToomas SoomeOBJS += bzipfs.o 1954a5d661aSToomas SoomeOBJS += dosfs.o 1964a5d661aSToomas Soome# 197