v1.8.2
[wimlib] / Makefile.am
1 ##############################################################################
2 #                               General                                      #
3 ##############################################################################
4
5
6 ACLOCAL_AMFLAGS = -I m4
7
8 AM_CPPFLAGS     = -I$(top_srcdir)/include $(PLATFORM_CPPFLAGS)  \
9                   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
10
11 # Note: -std=gnu99 instead of -std=c99 is needed for unnamed structs and unions,
12 # which are in C11 but not C99.  But we can't yet actually use -std=c11 because
13 # we want to support older versions of gcc.
14 AM_CFLAGS       = -std=gnu99 $(PLATFORM_CFLAGS) -fno-common     \
15                   -Wmissing-prototypes -Wstrict-prototypes      \
16                   -Wundef -Wno-pointer-sign
17
18 AM_LDFLAGS      = $(PLATFORM_LDFLAGS)
19
20 EXTRA_DIST      = README README.WINDOWS                         \
21                   COPYING COPYING.GPLv3 COPYING.LGPLv3          \
22                   examples                                      \
23                   archlinux debian rpm
24
25 ##############################################################################
26 #                               Library                                      #
27 ##############################################################################
28
29 lib_LTLIBRARIES = libwim.la
30 include_HEADERS = include/wimlib.h
31
32 pkgconfigdir    = @pkgconfigdir@
33 pkgconfig_DATA  = wimlib.pc
34 wimlib.pc: config.status
35
36 libwim_la_SOURCES =             \
37         src/add_image.c         \
38         src/avl_tree.c          \
39         src/blob_table.c        \
40         src/capture_common.c    \
41         src/compress.c          \
42         src/compress_common.c   \
43         src/compress_parallel.c \
44         src/compress_serial.c   \
45         src/decompress.c        \
46         src/decompress_common.c \
47         src/delete_image.c      \
48         src/dentry.c            \
49         src/divsufsort.c        \
50         src/encoding.c          \
51         src/error.c             \
52         src/export_image.c      \
53         src/extract.c           \
54         src/file_io.c           \
55         src/header.c            \
56         src/inode.c             \
57         src/inode_fixup.c       \
58         src/inode_table.c       \
59         src/integrity.c         \
60         src/iterate_dir.c       \
61         src/join.c              \
62         src/lcpit_matchfinder.c \
63         src/lzms_common.c       \
64         src/lzms_compress.c     \
65         src/lzms_decompress.c   \
66         src/lzx_common.c        \
67         src/lzx_compress.c      \
68         src/lzx_decompress.c    \
69         src/metadata_resource.c \
70         src/mount_image.c       \
71         src/pathlist.c          \
72         src/paths.c             \
73         src/pattern.c           \
74         src/progress.c          \
75         src/resource.c          \
76         src/reference.c         \
77         src/security.c          \
78         src/sha1.c              \
79         src/solid.c             \
80         src/split.c             \
81         src/reparse.c           \
82         src/tagged_items.c      \
83         src/template.c          \
84         src/textfile.c          \
85         src/timestamp.c         \
86         src/update_image.c      \
87         src/util.c              \
88         src/verify.c            \
89         src/wim.c               \
90         src/write.c             \
91         src/x86_cpu_features.c  \
92         src/xml.c               \
93         src/xpress_compress.c   \
94         src/xpress_decompress.c \
95         include/wimlib/alloca.h         \
96         include/wimlib/apply.h          \
97         include/wimlib/assert.h         \
98         include/wimlib/avl_tree.h       \
99         include/wimlib/bitops.h         \
100         include/wimlib/blob_table.h     \
101         include/wimlib/bt_matchfinder.h \
102         include/wimlib/capture.h        \
103         include/wimlib/case.h           \
104         include/wimlib/compiler.h       \
105         include/wimlib/compiler-gcc.h   \
106         include/wimlib/compressor_ops.h \
107         include/wimlib/compress_common.h        \
108         include/wimlib/chunk_compressor.h       \
109         include/wimlib/decompressor_ops.h       \
110         include/wimlib/decompress_common.h      \
111         include/wimlib/dentry.h         \
112         include/wimlib/divsufsort.h     \
113         include/wimlib/encoding.h       \
114         include/wimlib/endianness.h     \
115         include/wimlib/error.h          \
116         include/wimlib/file_io.h        \
117         include/wimlib/glob.h           \
118         include/wimlib/guid.h           \
119         include/wimlib/hc_matchfinder.h \
120         include/wimlib/header.h         \
121         include/wimlib/inode.h          \
122         include/wimlib/inode_table.h    \
123         include/wimlib/integrity.h      \
124         include/wimlib/lcpit_matchfinder.h      \
125         include/wimlib/list.h           \
126         include/wimlib/lz_extend.h      \
127         include/wimlib/lz_hash.h        \
128         include/wimlib/lzms_common.h    \
129         include/wimlib/lzms_constants.h \
130         include/wimlib/lzx_common.h     \
131         include/wimlib/lzx_constants.h  \
132         include/wimlib/matchfinder_avx2.h       \
133         include/wimlib/matchfinder_common.h     \
134         include/wimlib/matchfinder_sse2.h       \
135         include/wimlib/metadata.h       \
136         include/wimlib/pathlist.h       \
137         include/wimlib/paths.h          \
138         include/wimlib/pattern.h        \
139         include/wimlib/progress.h       \
140         include/wimlib/reparse.h        \
141         include/wimlib/resource.h       \
142         include/wimlib/security.h       \
143         include/wimlib/security_descriptor.h    \
144         include/wimlib/sha1.h           \
145         include/wimlib/solid.h          \
146         include/wimlib/textfile.h       \
147         include/wimlib/timestamp.h      \
148         include/wimlib/types.h          \
149         include/wimlib/unaligned.h      \
150         include/wimlib/unix_data.h      \
151         include/wimlib/util.h           \
152         include/wimlib/wim.h            \
153         include/wimlib/write.h          \
154         include/wimlib/x86_cpu_features.h       \
155         include/wimlib/xml.h            \
156         include/wimlib/xpress_constants.h
157
158 if WITH_NTFS_3G
159 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
160                      src/ntfs-3g_capture.c      \
161                      include/wimlib/ntfs_3g.h
162 endif
163
164 if WINDOWS_NATIVE_BUILD
165 libwim_la_SOURCES += src/win32_common.c                 \
166                      src/win32_apply.c                  \
167                      src/win32_capture.c                \
168                      src/win32_replacements.c           \
169                      src/wimboot.c                      \
170                      include/wimlib/win32_common.h      \
171                      include/wimlib/win32.h             \
172                      include/wimlib/wimboot.h           \
173                      include/wimlib/wof.h
174 else
175 libwim_la_SOURCES += src/unix_apply.c           \
176                      src/unix_capture.c
177 endif
178
179 libwim_la_CFLAGS =              \
180         $(AM_CFLAGS)            \
181         $(PTHREAD_CFLAGS)       \
182         $(LIBXML2_CFLAGS)       \
183         $(LIBNTFS_3G_CFLAGS)    \
184         $(LIBFUSE_CFLAGS)       \
185         $(LIBCRYPTO_CFLAGS)
186
187 libwim_la_LDFLAGS = $(AM_LDFLAGS) -version-info 21:0:6
188
189 libwim_la_LIBADD =              \
190         $(PTHREAD_LIBS)         \
191         $(LIBXML2_LIBS)         \
192         $(LTLIBICONV)           \
193         $(LIBNTFS_3G_LIBS)      \
194         $(LIBFUSE_LIBS)         \
195         $(LIBRT_LIBS)           \
196         $(LIBCRYPTO_LIBS)
197
198 if ENABLE_SSSE3_SHA1
199 libwim_la_SOURCES += src/sha1-ssse3.asm
200 libwim_la_LIBADD += src/sha1-ssse3.lo
201
202 src/sha1-ssse3.lo:src/sha1-ssse3.asm
203         $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/build-aux/nasm_lt.sh \
204         $(NASM) $(NAFLAGS) $(NASM_PLATFORM_FLAGS)                           \
205         -DINTEL_SHA1_UPDATE_FUNCNAME=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_ssse3       \
206         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_default  \
207         $< -o $@
208
209 EXTRA_DIST += build-aux/nasm_lt.sh
210 endif
211
212 ##############################################################################
213 #                               Programs                                     #
214 ##############################################################################
215
216 bin_PROGRAMS = wimlib-imagex
217 dist_bin_SCRIPTS = programs/mkwinpeimg
218
219 wimlib_imagex_SOURCES =         \
220         programs/imagex.c       \
221         include/wimlib.h        \
222         include/wimlib_tchar.h
223
224 if WINDOWS_NATIVE_BUILD
225 wimlib_imagex_SOURCES +=        \
226         programs/imagex-win32.c \
227         programs/imagex-win32.h \
228         programs/wgetopt.c      \
229         programs/wgetopt.h
230 endif
231
232 wimlib_imagex_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
233
234 wimlib_imagex_LDADD = $(top_builddir)/libwim.la
235
236 wimlib_imagex_cmds =    \
237         append          \
238         apply           \
239         capture         \
240         delete          \
241         dir             \
242         export          \
243         extract         \
244         info            \
245         join            \
246         mount           \
247         mountrw         \
248         optimize        \
249         split           \
250         unmount         \
251         update          \
252         verify
253
254 ##############################################################################
255 #                                 Hooks                                      #
256 ##############################################################################
257
258 install-exec-hook:
259         for cmd in $(wimlib_imagex_cmds); do                            \
260                 cd $(DESTDIR)$(bindir) &&                               \
261                         ln -f wimlib-imagex wim$${cmd};                 \
262         done
263
264 install-data-hook:
265         for cmd in $(wimlib_imagex_cmds); do                            \
266                 cd $(DESTDIR)$(mandir)/man1 &&                          \
267                         ln -sf wimlib-imagex-$${cmd}.1 wim$${cmd}.1;    \
268         done
269
270 uninstall-hook:
271         for cmd in $(wimlib_imagex_cmds); do                            \
272                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};                   \
273                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;            \
274         done
275
276 ##############################################################################
277 #                               Documentation                                #
278 ##############################################################################
279
280 man1_MANS =                                     \
281         doc/man1/wimlib-imagex.1                \
282         doc/man1/wimlib-imagex-append.1         \
283         doc/man1/wimlib-imagex-apply.1          \
284         doc/man1/wimlib-imagex-capture.1        \
285         doc/man1/wimlib-imagex-delete.1         \
286         doc/man1/wimlib-imagex-dir.1            \
287         doc/man1/wimlib-imagex-export.1         \
288         doc/man1/wimlib-imagex-extract.1        \
289         doc/man1/wimlib-imagex-info.1           \
290         doc/man1/wimlib-imagex-join.1           \
291         doc/man1/wimlib-imagex-mount.1          \
292         doc/man1/wimlib-imagex-mountrw.1        \
293         doc/man1/wimlib-imagex-optimize.1       \
294         doc/man1/wimlib-imagex-split.1          \
295         doc/man1/wimlib-imagex-unmount.1        \
296         doc/man1/wimlib-imagex-update.1         \
297         doc/man1/wimlib-imagex-verify.1         \
298         doc/man1/mkwinpeimg.1
299
300 EXTRA_DIST += $(man1_MANS)
301
302 ##############################################################################
303 #                                 Tests                                      #
304 ##############################################################################
305
306 check_PROGRAMS = tests/tree-cmp
307 tests_tree_cmp_SOURCES = tests/tree-cmp.c
308
309 dist_check_SCRIPTS = tests/test-imagex \
310                      tests/test-imagex-capture_and_apply \
311                      tests/test-imagex-update_and_extract
312
313 if WITH_FUSE
314 dist_check_SCRIPTS += tests/test-imagex-mount
315 endif
316
317 if WITH_NTFS_3G
318 dist_check_SCRIPTS += tests/test-imagex-ntfs
319 endif
320
321 EXTRA_DIST +=                                   \
322         tests/common_tests.sh                   \
323         tests/tests-common.sh                   \
324         tests/security_descriptor_1.base64      \
325         tests/security_descriptor_1.bin         \
326         tests/security_descriptor_2.base64      \
327         tests/security_descriptor_2.bin
328
329 if WINDOWS_NATIVE_BUILD
330 # Tests are run manually for Windows builds.
331 TESTS =
332 else
333 TESTS = $(dist_check_SCRIPTS)
334 endif
335
336 ##############################################################################