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