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
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.
13 # Copyright 2016 Toomas Soome <tsoome@me.com>
18 # - We don't use the libc strerror/sys_errlist because the string table is
22 # standalone components and stuff we have modified locally
23 SRCS= $(LIB_BASE)/libz/gzguts.h $(LIB_BASE)/libz/zutil.h
24 SRCS += $(LIBSTAND_SRC)/__main.c $(LIBSTAND_SRC)/assert.c
25 SRCS += $(LIBSTAND_SRC)/bcd.c $(LIBSTAND_SRC)/environment.c
26 SRCS += $(LIBSTAND_SRC)/getopt.c $(LIBSTAND_SRC)/strtol.c
27 SRCS += $(LIBSTAND_SRC)/strtoul.c $(LIBSTAND_SRC)/random.c
28 SRCS += $(LIBSTAND_SRC)/sbrk.c $(LIBSTAND_SRC)/twiddle.c
29 SRCS += $(LIBSTAND_SRC)/zalloc.c $(LIBSTAND_SRC)/zalloc_malloc.c
31 OBJS= __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
36 # private (pruned) versions of libc string functions
37 SRCS += $(LIBSTAND_SRC)/strcasecmp.c
41 SRCS += $(LIB_BASE)/libc/net/ntoh.c
44 # string functions from libc
45 SRCS += $(LIB_BASE)/libc/string/bcmp.c $(LIB_BASE)/libc/string/bcopy.c
46 SRCS += $(LIB_BASE)/libc/string/bzero.c $(LIB_BASE)/libc/string/ffs.c
47 SRCS += $(LIB_BASE)/libc/string/fls.c $(LIB_BASE)/libc/string/memccpy.c
48 SRCS += $(LIB_BASE)/libc/string/memchr.c $(LIB_BASE)/libc/string/memcmp.c
49 SRCS += $(LIB_BASE)/libc/string/memcpy.c $(LIB_BASE)/libc/string/memmove.c
50 SRCS += $(LIB_BASE)/libc/string/memset.c $(LIB_BASE)/libc/string/strcat.c
51 SRCS += $(LIB_BASE)/libc/string/strchr.c $(LIB_BASE)/libc/string/strcmp.c
52 SRCS += $(LIB_BASE)/libc/string/strcpy.c $(LIB_BASE)/libc/string/stpcpy.c
53 SRCS += $(LIB_BASE)/libc/string/stpncpy.c $(LIB_BASE)/libc/string/strcspn.c
54 SRCS += $(LIB_BASE)/libc/string/strlcat.c $(LIB_BASE)/libc/string/strlcpy.c
55 SRCS += $(LIB_BASE)/libc/string/strlen.c $(LIB_BASE)/libc/string/strncat.c
56 SRCS += $(LIB_BASE)/libc/string/strncmp.c $(LIB_BASE)/libc/string/strncpy.c
57 SRCS += $(LIB_BASE)/libc/string/strpbrk.c $(LIB_BASE)/libc/string/strrchr.c
58 SRCS += $(LIB_BASE)/libc/string/strsep.c $(LIB_BASE)/libc/string/strspn.c
59 SRCS += $(LIB_BASE)/libc/string/strstr.c $(LIB_BASE)/libc/string/strtok.c
60 SRCS += $(LIB_BASE)/libc/string/swab.c
62 SRCS += $(LIBSTAND_SRC)/qdivrem.c
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
70 # uuid functions from libc
71 SRCS += $(LIB_BASE)/libc/uuid/uuid_create_nil.c
72 SRCS += $(LIB_BASE)/libc/uuid/uuid_equal.c
73 SRCS += $(LIB_BASE)/libc/uuid/uuid_is_nil.c
75 SRCS += $(LIBSTAND_SRC)/uuid_from_string.c
76 SRCS += $(LIBSTAND_SRC)/uuid_to_string.c
78 OBJS += uuid_create_nil.o uuid_equal.o uuid_from_string.o uuid_is_nil.o \
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 CFLAGS += -DBZ_LOADER -DBZ_NO_STDIO -DBZ_NO_COMPRESS
85 SRCS += libstand_bzlib_private.h
87 SRCS += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c
88 OBJS += _bzlib.o _crctable.o _decompress.o _huffman.o _randtable.o
89 CLEANFILES += _bzlib.c _crctable.c _decompress.c _huffman.c _randtable.c
91 _bzlib.c: $(SRC)/common/bzip2/bzlib.c
92 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@
94 _crctable.c: $(SRC)/common/bzip2/crctable.c
95 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@
97 _decompress.c: $(SRC)/common/bzip2/decompress.c
98 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@
100 _huffman.c: $(SRC)/common/bzip2/huffman.c
101 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@
103 _randtable.c: $(SRC)/common/bzip2/randtable.c
104 sed "s|bzlib_private\.h|libstand_bzlib_private.h|" $^ > $@
106 CLEANFILES += libstand_bzlib_private.h
107 libstand_bzlib_private.h: $(SRC)/common/bzip2/bzlib_private.h
108 sed -e 's|<stdlib.h>|"stand.h"|' $^ > $@
110 # decompression functionality from libz
111 CFLAGS += -DHAVE_MEMCPY -I$(LIB_BASE)/libz
112 SRCS += $(LIB_BASE)/libz/adler32.c $(LIB_BASE)/libz/crc32.c \
113 libstand_zutil.h libstand_gzguts.h
114 OBJS += adler32.o crc32.o
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|" \
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|" \
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|" \
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|" \
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|" \
137 SRCS += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c
138 OBJS += _infback.o _inffast.o _inflate.o _inftrees.o _zutil.o
139 CLEANFILES += _infback.c _inffast.c _inflate.c _inftrees.c _zutil.c
141 # depend on stand.h being able to be included multiple times
142 libstand_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"|' \
150 libstand_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"|' \
158 CLEANFILES += libstand_zutil.h libstand_gzguts.h
161 SRCS += $(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
167 OBJS += 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
171 SRCS += $(LIBSTAND_SRC)/arp.c $(LIBSTAND_SRC)/ether.c $(LIBSTAND_SRC)/ip.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
175 OBJS += arp.o ether.o ip.o inet_ntoa.o in_cksum.o net.o udp.o netif.o rpc.o
177 # network info services:
178 SRCS += $(LIBSTAND_SRC)/bootp.c $(LIBSTAND_SRC)/rarp.c \
179 $(LIBSTAND_SRC)/bootparam.c
180 OBJS += bootp.o rarp.o bootparam.o
183 SRCS += $(LIBSTAND_SRC)/ufs.c
184 SRCS += $(LIBSTAND_SRC)/nfs.c
185 SRCS += $(LIBSTAND_SRC)/cd9660.c
186 SRCS += $(LIBSTAND_SRC)/tftp.c
187 SRCS += $(LIBSTAND_SRC)/gzipfs.c
188 SRCS += $(LIBSTAND_SRC)/bzipfs.c
189 SRCS += $(LIBSTAND_SRC)/dosfs.c