]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - SQUASHFS/squashfs-tools-4.4/squashfs-tools/Makefile
1.1.07 release
[Ventoy.git] / SQUASHFS / squashfs-tools-4.4 / squashfs-tools / Makefile
1 ###############################################
2 # Compression build options #
3 ###############################################
4 #
5 #
6 ############# Building gzip support ###########
7 #
8 # Gzip support is by default enabled, and the compression type default
9 # (COMP_DEFAULT) is gzip.
10 #
11 # If you don't want/need gzip support then comment out the GZIP SUPPORT line
12 # below, and change COMP_DEFAULT to one of the compression types you have
13 # selected.
14 #
15 # Obviously, you must select at least one of the available gzip, lzma, lzo
16 # compression types.
17 #
18 GZIP_SUPPORT = 1
19
20 ########### Building XZ support #############
21 #
22 # LZMA2 compression.
23 #
24 # XZ Utils liblzma (http://tukaani.org/xz/) is supported
25 #
26 # Development packages (libraries and header files) should be
27 # supported by most modern distributions. Please refer to
28 # your distribution package manager.
29 #
30 # To build install the library and uncomment
31 # the XZ_SUPPORT line below.
32 #
33 XZ_SUPPORT = 1
34
35
36 ############ Building LZO support ##############
37 #
38 # The LZO library (http://www.oberhumer.com/opensource/lzo/) is supported.
39 #
40 # Development packages (libraries and header files) should be
41 # supported by most modern distributions. Please refer to
42 # your distribution package manager.
43 #
44 # To build install the library and uncomment
45 # the XZ_SUPPORT line below.
46 #
47 LZO_SUPPORT = 1
48
49
50 ########### Building LZ4 support #############
51 #
52 # Yann Collet's LZ4 tools are supported
53 # LZ4 homepage: http://fastcompression.blogspot.com/p/lz4.html
54 # LZ4 source repository: http://code.google.com/p/lz4
55 #
56 # Development packages (libraries and header files) should be
57 # supported by most modern distributions. Please refer to
58 # your distribution package manager.
59 #
60 # To build install and uncomment
61 # the LZ4_SUPPORT line below.
62 #
63 LZ4_SUPPORT = 1
64
65
66 ########### Building ZSTD support ############
67 #
68 # The ZSTD library is supported
69 # ZSTD homepage: http://zstd.net
70 # ZSTD source repository: https://github.com/facebook/zstd
71 #
72 # Development packages (libraries and header files) should be
73 # supported by most modern distributions. Please refer to
74 # your distribution package manager.
75 #
76 # To build install the library and uncomment
77 # the XZ_SUPPORT line below.
78 #
79 ZSTD_SUPPORT = 1
80
81
82 ######## Specifying default compression ########
83 #
84 # The next line specifies which compression algorithm is used by default
85 # in Mksquashfs. Obviously the compression algorithm must have been
86 # selected to be built
87 #
88 COMP_DEFAULT = gzip
89
90
91 ###############################################
92 # Extended attribute (XATTRs) build options #
93 ###############################################
94 #
95 # Building XATTR support for Mksquashfs and Unsquashfs
96 #
97 # If your C library or build/target environment doesn't support XATTRs then
98 # comment out the next line to build Mksquashfs and Unsquashfs without XATTR
99 # support
100 XATTR_SUPPORT = 1
101
102 # Select whether you wish xattrs to be stored by Mksquashfs and extracted
103 # by Unsquashfs by default. If selected users can disable xattr support by
104 # using the -no-xattrs option
105 #
106 # If unselected, Mksquashfs/Unsquashfs won't store and extract xattrs by
107 # default. Users can enable xattrs by using the -xattrs option.
108 XATTR_DEFAULT = 1
109
110
111 ###############################################
112 # Reproducible Image options #
113 ###############################################
114 #
115 # Select whether you wish reproducible builds by default. If selected users
116 # can disable reproducible builds using the not-reproducible option.
117 # If not selected, users can enable reproducible builds using the
118 # -reproducible option
119 REPRODUCIBLE_DEFAULT = 1
120
121
122 ###############################################
123 # Obsolete options #
124 ###############################################
125
126 ########### Building LZMA support #############
127 #
128 # LZMA1 compression.
129 #
130 # LZMA1 compression is obsolete, and the newer and better XZ (LZMA2)
131 # compression should be used in preference.
132 #
133 # Both XZ Utils liblzma (http://tukaani.org/xz/) and LZMA SDK
134 # (http://www.7-zip.org/sdk.html) are supported
135 #
136 # To build using XZ Utils liblzma - install the library and uncomment
137 # the LZMA_XZ_SUPPORT line below.
138 #
139 # To build using the LZMA SDK (4.65 used in development, other versions may
140 # work) - download and unpack it, uncomment and set LZMA_DIR to unpacked source,
141 # and uncomment the LZMA_SUPPORT line below.
142 #
143 LZMA_XZ_SUPPORT = 1
144 #LZMA_SUPPORT = 1
145 #LZMA_DIR = ../../../../LZMA/lzma465
146
147 ###############################################
148 # End of BUILD options section #
149 ###############################################
150
151 INCLUDEDIR = -I.
152 INSTALL_DIR = /usr/local/bin
153
154 MKSQUASHFS_OBJS = mksquashfs.o read_fs.o action.o swap.o pseudo.o compressor.o \
155 sort.o progressbar.o read_file.o info.o restore.o process_fragments.o \
156 caches-queues-lists.o
157
158 UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o \
159 unsquash-4.o unsquash-123.o unsquash-34.o swap.o compressor.o unsquashfs_info.o
160
161 CFLAGS ?= -Os
162 CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
163 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"$(COMP_DEFAULT)\" \
164 -Wall
165
166 LIBS = -lpthread
167 ifeq ($(GZIP_SUPPORT),1)
168 CFLAGS += -DGZIP_SUPPORT
169 MKSQUASHFS_OBJS += gzip_wrapper.o
170 UNSQUASHFS_OBJS += gzip_wrapper.o
171 LIBS += $(VTZLIB)
172 COMPRESSORS += gzip
173 endif
174
175 ifeq ($(LZMA_SUPPORT),1)
176 LZMA_OBJS = $(LZMA_DIR)/C/Alloc.o $(LZMA_DIR)/C/LzFind.o \
177 $(LZMA_DIR)/C/LzmaDec.o $(LZMA_DIR)/C/LzmaEnc.o $(LZMA_DIR)/C/LzmaLib.o
178 INCLUDEDIR += -I$(LZMA_DIR)/C
179 CFLAGS += -DLZMA_SUPPORT
180 MKSQUASHFS_OBJS += lzma_wrapper.o $(LZMA_OBJS)
181 UNSQUASHFS_OBJS += lzma_wrapper.o $(LZMA_OBJS)
182 COMPRESSORS += lzma
183 endif
184
185 ifeq ($(LZMA_XZ_SUPPORT),1)
186 CFLAGS += -DLZMA_SUPPORT
187 MKSQUASHFS_OBJS += lzma_xz_wrapper.o
188 UNSQUASHFS_OBJS += lzma_xz_wrapper.o
189 LIBS +=
190 COMPRESSORS += lzma
191 endif
192
193 ifeq ($(XZ_SUPPORT),1)
194 CFLAGS += -DXZ_SUPPORT -I$(LZMA_LIBDIR)/include
195 MKSQUASHFS_OBJS += xz_wrapper.o
196 UNSQUASHFS_OBJS += xz_wrapper.o
197 LIBS += $(LZMA_LIBDIR)/lib/liblzma.a
198 COMPRESSORS += xz
199 endif
200
201 ifeq ($(LZO_SUPPORT),1)
202 CFLAGS += -DLZO_SUPPORT -I $(LZO_LIBDIR)/include
203 MKSQUASHFS_OBJS += lzo_wrapper.o
204 UNSQUASHFS_OBJS += lzo_wrapper.o
205 LIBS += $(LZO_LIBDIR)/lib/liblzo2.a
206 COMPRESSORS += lzo
207 endif
208
209 ifeq ($(LZ4_SUPPORT),1)
210 CFLAGS += -DLZ4_SUPPORT -I $(LZ4_LIBDIR)/include
211 MKSQUASHFS_OBJS += lz4_wrapper.o
212 UNSQUASHFS_OBJS += lz4_wrapper.o
213 LIBS += $(LZ4_LIBDIR)/lib/liblz4.a
214 COMPRESSORS += lz4
215 endif
216
217 ifeq ($(ZSTD_SUPPORT),1)
218 CFLAGS += -DZSTD_SUPPORT -I $(ZSTD_LIBDIR)/include
219 MKSQUASHFS_OBJS += zstd_wrapper.o
220 UNSQUASHFS_OBJS += zstd_wrapper.o
221 LIBS += $(ZSTD_LIBDIR)/lib/libzstd.a
222 COMPRESSORS += zstd
223 endif
224
225 ifeq ($(XATTR_SUPPORT),1)
226 ifeq ($(XATTR_DEFAULT),1)
227 CFLAGS += -DXATTR_SUPPORT -DXATTR_DEFAULT
228 else
229 CFLAGS += -DXATTR_SUPPORT
230 endif
231 MKSQUASHFS_OBJS += xattr.o read_xattrs.o
232 UNSQUASHFS_OBJS += read_xattrs.o unsquashfs_xattr.o
233 endif
234
235 ifeq ($(REPRODUCIBLE_DEFAULT),1)
236 CFLAGS += -DREPRODUCIBLE_DEFAULT
237 endif
238
239 #
240 # If LZMA_SUPPORT is specified then LZMA_DIR must be specified too
241 #
242 ifeq ($(LZMA_SUPPORT),1)
243 ifndef LZMA_DIR
244 $(error "LZMA_SUPPORT requires LZMA_DIR to be also defined")
245 endif
246 endif
247
248 #
249 # Both LZMA_XZ_SUPPORT and LZMA_SUPPORT cannot be specified
250 #
251 ifeq ($(LZMA_XZ_SUPPORT),1)
252 ifeq ($(LZMA_SUPPORT),1)
253 $(error "Both LZMA_XZ_SUPPORT and LZMA_SUPPORT cannot be specified")
254 endif
255 endif
256
257 #
258 # At least one compressor must have been selected
259 #
260 ifndef COMPRESSORS
261 $(error "No compressor selected! Select one or more of GZIP, LZMA, XZ, LZO, \
262 LZ4 or ZSTD!")
263 endif
264
265 #
266 # COMP_DEFAULT should be defined
267 #
268 ifndef COMP_DEFAULT
269 $(error "COMP_DEFAULT must be set to a compressor!")
270 endif
271
272 #
273 # COMP_DEFAULT must be a selected compressor
274 #
275 ifeq (, $(findstring $(COMP_DEFAULT), $(COMPRESSORS)))
276 $(error "COMP_DEFAULT is set to ${COMP_DEFAULT}, which isn't selected to be \
277 built!")
278 endif
279
280 .PHONY: all
281 all: mksquashfs unsquashfs
282
283 mksquashfs: $(MKSQUASHFS_OBJS)
284 $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(MKSQUASHFS_OBJS) $(LIBS) -o $@
285
286 mksquashfs.o: Makefile mksquashfs.c squashfs_fs.h squashfs_swap.h mksquashfs.h \
287 sort.h pseudo.h compressor.h xattr.h action.h error.h progressbar.h \
288 info.h caches-queues-lists.h read_fs.h restore.h process_fragments.h
289
290 read_fs.o: read_fs.c squashfs_fs.h squashfs_swap.h compressor.h xattr.h \
291 error.h mksquashfs.h
292
293 sort.o: sort.c squashfs_fs.h mksquashfs.h sort.h error.h progressbar.h
294
295 swap.o: swap.c
296
297 pseudo.o: pseudo.c pseudo.h error.h progressbar.h
298
299 compressor.o: Makefile compressor.c compressor.h squashfs_fs.h
300
301 xattr.o: xattr.c squashfs_fs.h squashfs_swap.h mksquashfs.h xattr.h error.h \
302 progressbar.h
303
304 read_xattrs.o: read_xattrs.c squashfs_fs.h squashfs_swap.h xattr.h error.h
305
306 action.o: action.c squashfs_fs.h mksquashfs.h action.h error.h
307
308 progressbar.o: progressbar.c error.h
309
310 read_file.o: read_file.c error.h
311
312 info.o: info.c squashfs_fs.h mksquashfs.h error.h progressbar.h \
313 caches-queues-lists.h
314
315 restore.o: restore.c caches-queues-lists.h squashfs_fs.h mksquashfs.h error.h \
316 progressbar.h info.h
317
318 process_fragments.o: process_fragments.c process_fragments.h
319
320 caches-queues-lists.o: caches-queues-lists.c error.h caches-queues-lists.h
321
322 gzip_wrapper.o: gzip_wrapper.c squashfs_fs.h gzip_wrapper.h compressor.h
323
324 lzma_wrapper.o: lzma_wrapper.c compressor.h squashfs_fs.h
325
326 lzma_xz_wrapper.o: lzma_xz_wrapper.c compressor.h squashfs_fs.h
327
328 lzo_wrapper.o: lzo_wrapper.c squashfs_fs.h lzo_wrapper.h compressor.h
329
330 lz4_wrapper.o: lz4_wrapper.c squashfs_fs.h lz4_wrapper.h compressor.h
331
332 xz_wrapper.o: xz_wrapper.c squashfs_fs.h xz_wrapper.h compressor.h
333
334 unsquashfs: $(UNSQUASHFS_OBJS)
335 $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(UNSQUASHFS_OBJS) $(LIBS) -o $@
336
337 unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h \
338 squashfs_compat.h xattr.h read_fs.h compressor.h
339
340 unsquash-1.o: unsquashfs.h unsquash-1.c squashfs_fs.h squashfs_compat.h
341
342 unsquash-2.o: unsquashfs.h unsquash-2.c squashfs_fs.h squashfs_compat.h
343
344 unsquash-3.o: unsquashfs.h unsquash-3.c squashfs_fs.h squashfs_compat.h
345
346 unsquash-4.o: unsquashfs.h unsquash-4.c squashfs_fs.h squashfs_swap.h \
347 read_fs.h
348
349 unsquash-123.o: unsquashfs.h unsquash-123.c squashfs_fs.h squashfs_compat.h
350
351 unsquash-34.o: unsquashfs.h unsquash-34.c
352
353 unsquashfs_xattr.o: unsquashfs_xattr.c unsquashfs.h squashfs_fs.h xattr.h
354
355 unsquashfs_info.o: unsquashfs.h squashfs_fs.h
356
357 .PHONY: clean
358 clean:
359 -rm -f *.o mksquashfs unsquashfs
360
361 .PHONY: install
362 install: mksquashfs unsquashfs
363 mkdir -p $(INSTALL_DIR)
364 cp mksquashfs $(INSTALL_DIR)
365 cp unsquashfs $(INSTALL_DIR)