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