]> wimlib.net Git - wimlib/blob - Makefile.am
v1.13.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 COPYING.CC0      \
22                   examples
23
24 ##############################################################################
25 #                               Library                                      #
26 ##############################################################################
27
28 lib_LTLIBRARIES = libwim.la
29 include_HEADERS = include/wimlib.h
30
31 pkgconfigdir    = @pkgconfigdir@
32 pkgconfig_DATA  = wimlib.pc
33 wimlib.pc: config.status
34
35 libwim_la_SOURCES =             \
36         src/add_image.c         \
37         src/avl_tree.c          \
38         src/blob_table.c        \
39         src/compress.c          \
40         src/compress_common.c   \
41         src/compress_parallel.c \
42         src/compress_serial.c   \
43         src/decompress.c        \
44         src/decompress_common.c \
45         src/delete_image.c      \
46         src/dentry.c            \
47         src/divsufsort.c        \
48         src/encoding.c          \
49         src/error.c             \
50         src/export_image.c      \
51         src/extract.c           \
52         src/file_io.c           \
53         src/header.c            \
54         src/inode.c             \
55         src/inode_fixup.c       \
56         src/inode_table.c       \
57         src/integrity.c         \
58         src/iterate_dir.c       \
59         src/join.c              \
60         src/lcpit_matchfinder.c \
61         src/lzms_common.c       \
62         src/lzms_compress.c     \
63         src/lzms_decompress.c   \
64         src/lzx_common.c        \
65         src/lzx_compress.c      \
66         src/lzx_decompress.c    \
67         src/metadata_resource.c \
68         src/mount_image.c       \
69         src/pathlist.c          \
70         src/paths.c             \
71         src/pattern.c           \
72         src/progress.c          \
73         src/reference.c         \
74         src/registry.c          \
75         src/reparse.c           \
76         src/resource.c          \
77         src/scan.c              \
78         src/security.c          \
79         src/sha1.c              \
80         src/solid.c             \
81         src/split.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/xml_windows.c       \
94         src/xpress_compress.c   \
95         src/xpress_decompress.c \
96         include/wimlib/alloca.h         \
97         include/wimlib/apply.h          \
98         include/wimlib/assert.h         \
99         include/wimlib/avl_tree.h       \
100         include/wimlib/bitops.h         \
101         include/wimlib/blob_table.h     \
102         include/wimlib/bt_matchfinder.h \
103         include/wimlib/case.h           \
104         include/wimlib/compiler.h       \
105         include/wimlib/compressor_ops.h \
106         include/wimlib/compress_common.h        \
107         include/wimlib/chunk_compressor.h       \
108         include/wimlib/decompressor_ops.h       \
109         include/wimlib/decompress_common.h      \
110         include/wimlib/dentry.h         \
111         include/wimlib/divsufsort.h     \
112         include/wimlib/encoding.h       \
113         include/wimlib/endianness.h     \
114         include/wimlib/error.h          \
115         include/wimlib/file_io.h        \
116         include/wimlib/glob.h           \
117         include/wimlib/guid.h           \
118         include/wimlib/hc_matchfinder.h \
119         include/wimlib/header.h         \
120         include/wimlib/inode.h          \
121         include/wimlib/inode_table.h    \
122         include/wimlib/integrity.h      \
123         include/wimlib/lcpit_matchfinder.h      \
124         include/wimlib/list.h           \
125         include/wimlib/lz_extend.h      \
126         include/wimlib/lz_hash.h        \
127         include/wimlib/lzms_common.h    \
128         include/wimlib/lzms_constants.h \
129         include/wimlib/lzx_common.h     \
130         include/wimlib/lzx_constants.h  \
131         include/wimlib/metadata.h       \
132         include/wimlib/object_id.h      \
133         include/wimlib/pathlist.h       \
134         include/wimlib/paths.h          \
135         include/wimlib/pattern.h        \
136         include/wimlib/progress.h       \
137         include/wimlib/registry.h       \
138         include/wimlib/reparse.h        \
139         include/wimlib/resource.h       \
140         include/wimlib/scan.h           \
141         include/wimlib/security.h       \
142         include/wimlib/security_descriptor.h    \
143         include/wimlib/sha1.h           \
144         include/wimlib/solid.h          \
145         include/wimlib/tagged_items.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/xattr.h          \
156         include/wimlib/xml.h            \
157         include/wimlib/xml_windows.h    \
158         include/wimlib/xpress_constants.h
159
160 if WITH_NTFS_3G
161 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
162                      src/ntfs-3g_capture.c      \
163                      include/wimlib/ntfs_3g.h
164 endif
165
166 if WINDOWS_NATIVE_BUILD
167 libwim_la_SOURCES += src/wimboot.c                      \
168                      src/win32_common.c                 \
169                      src/win32_apply.c                  \
170                      src/win32_capture.c                \
171                      src/win32_replacements.c           \
172                      src/win32_vss.c                    \
173                      include/wimlib/wimboot.h           \
174                      include/wimlib/win32.h             \
175                      include/wimlib/win32_common.h      \
176                      include/wimlib/win32_vss.h         \
177                      include/wimlib/wof.h
178 PLATFORM_LIBS = -lmsvcrt -lntdll
179 else
180 libwim_la_SOURCES += src/unix_apply.c           \
181                      src/unix_capture.c
182 PLATFORM_LIBS =
183 endif
184
185 if ENABLE_TEST_SUPPORT
186 libwim_la_SOURCES += src/test_support.c         \
187                      include/wimlib/test_support.h
188 if WINDOWS_NATIVE_BUILD
189 # Workaround for "multiple definition" error when math symbols are present in
190 # both libmsvcrt.a and ntdll.a
191 AM_LDFLAGS += -Wl,--allow-multiple-definition
192 endif
193 endif
194
195 libwim_la_CFLAGS =              \
196         $(AM_CFLAGS)            \
197         $(PTHREAD_CFLAGS)       \
198         $(LIBXML2_CFLAGS)       \
199         $(LIBNTFS_3G_CFLAGS)    \
200         $(LIBFUSE_CFLAGS)       \
201         $(LIBCRYPTO_CFLAGS)
202
203 libwim_la_LDFLAGS = $(AM_LDFLAGS) -version-info 32:0:17
204
205 libwim_la_LIBADD =              \
206         $(PTHREAD_LIBS)         \
207         $(LIBXML2_LIBS)         \
208         $(LIBNTFS_3G_LIBS)      \
209         $(LIBFUSE_LIBS)         \
210         $(LIBRT_LIBS)           \
211         $(LIBCRYPTO_LIBS)       \
212         $(PLATFORM_LIBS)
213
214 if ENABLE_SSSE3_SHA1
215 libwim_la_SOURCES += src/sha1-ssse3.asm
216 libwim_la_LIBADD += src/sha1-ssse3.lo
217
218 src/sha1-ssse3.lo:src/sha1-ssse3.asm
219         $(LIBTOOL) --mode=compile $(srcdir)/build-aux/nasm_lt.sh \
220         $(NASM) $(NAFLAGS) $(NASM_PLATFORM_FLAGS)                           \
221         -DINTEL_SHA1_UPDATE_FUNCNAME=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_ssse3       \
222         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_default  \
223         $< -o $@
224 endif
225 EXTRA_DIST += build-aux/nasm_lt.sh
226
227 ##############################################################################
228 #                               Programs                                     #
229 ##############################################################################
230
231 bin_PROGRAMS = wimlib-imagex
232 dist_bin_SCRIPTS = programs/mkwinpeimg
233
234 wimlib_imagex_SOURCES =         \
235         programs/imagex.c       \
236         include/wimlib.h        \
237         include/wimlib_tchar.h
238
239 if WINDOWS_NATIVE_BUILD
240 wimlib_imagex_SOURCES +=        \
241         programs/imagex-win32.c \
242         programs/imagex-win32.h \
243         programs/wgetopt.c      \
244         programs/wgetopt.h
245 endif
246
247 wimlib_imagex_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
248
249 wimlib_imagex_LDADD = $(top_builddir)/libwim.la
250
251 wimlib_imagex_cmds =    \
252         append          \
253         apply           \
254         capture         \
255         delete          \
256         dir             \
257         export          \
258         extract         \
259         info            \
260         join            \
261         mount           \
262         mountrw         \
263         optimize        \
264         split           \
265         unmount         \
266         update          \
267         verify
268
269 ##############################################################################
270 #                                 Hooks                                      #
271 ##############################################################################
272
273 install-exec-hook:
274         for cmd in $(wimlib_imagex_cmds); do                            \
275                 cd $(DESTDIR)$(bindir) &&                               \
276                         ln -f wimlib-imagex wim$${cmd};                 \
277         done
278
279 install-data-hook:
280         for cmd in $(wimlib_imagex_cmds); do                            \
281                 cd $(DESTDIR)$(mandir)/man1 &&                          \
282                         ln -sf wim$${cmd}.1 wimlib-imagex-$${cmd}.1;    \
283         done
284
285 uninstall-hook:
286         for cmd in $(wimlib_imagex_cmds); do                            \
287                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};                   \
288                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;            \
289         done
290
291 ##############################################################################
292 #                               Documentation                                #
293 ##############################################################################
294
295 man1_MANS =                             \
296         doc/man1/wimlib-imagex.1        \
297         doc/man1/wimappend.1            \
298         doc/man1/wimapply.1             \
299         doc/man1/wimcapture.1           \
300         doc/man1/wimdelete.1            \
301         doc/man1/wimdir.1               \
302         doc/man1/wimexport.1            \
303         doc/man1/wimextract.1           \
304         doc/man1/wiminfo.1              \
305         doc/man1/wimjoin.1              \
306         doc/man1/wimmount.1             \
307         doc/man1/wimmountrw.1           \
308         doc/man1/wimoptimize.1          \
309         doc/man1/wimsplit.1             \
310         doc/man1/wimunmount.1           \
311         doc/man1/wimupdate.1            \
312         doc/man1/wimverify.1            \
313         doc/man1/mkwinpeimg.1
314
315 EXTRA_DIST += $(man1_MANS)
316
317 ##############################################################################
318 #                                 Tests                                      #
319 ##############################################################################
320
321 check_PROGRAMS = tests/tree-cmp
322 tests_tree_cmp_SOURCES = tests/tree-cmp.c
323
324 dist_check_SCRIPTS = tests/test-imagex \
325                      tests/test-imagex-capture_and_apply \
326                      tests/test-imagex-update_and_extract
327
328 if WITH_FUSE
329 dist_check_SCRIPTS += tests/test-imagex-mount
330 endif
331
332 if WITH_NTFS_3G
333 dist_check_SCRIPTS += tests/test-imagex-ntfs
334 endif
335
336 EXTRA_DIST +=                                   \
337         tests/common_tests.sh                   \
338         tests/exclusionlists                    \
339         tests/test_utils.sh                     \
340         tests/security_descriptor_1.base64      \
341         tests/security_descriptor_1.bin         \
342         tests/security_descriptor_2.base64      \
343         tests/security_descriptor_2.bin
344
345 if WINDOWS_NATIVE_BUILD
346 # Tests are run manually for Windows builds.
347 TESTS =
348 else
349 TESTS = $(dist_check_SCRIPTS)
350 endif
351
352 # Extra test programs (not run by 'make check')
353 EXTRA_PROGRAMS = tests/wlfuzz
354 tests_wlfuzz_SOURCES = tests/wlfuzz.c
355 tests_wlfuzz_LDADD = $(top_builddir)/libwim.la
356
357 ##############################################################################