cc91d1760393801fc9e484778e4636cc885054de
[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 EXTRA_libwim_la_SOURCES = src/sha1-ssse3.asm
177 libwim_la_DEPENDENCIES = $(SSSE3_SHA1_OBJ)
178 EXTRA_DIST += build-aux/nasm_lt.sh
179
180 src/sha1-ssse3.lo:src/sha1-ssse3.asm
181         $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/build-aux/nasm_lt.sh \
182         $(NASM) $(NAFLAGS) $(NASM_PLATFORM_FLAGS)                           \
183         -DINTEL_SHA1_UPDATE_FUNCNAME=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_ssse3       \
184         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_default  \
185         $< -o $@
186
187 libwim_la_CFLAGS =              \
188         $(AM_CFLAGS)            \
189         $(LIBXML2_CFLAGS)       \
190         $(LIBFUSE_CFLAGS)       \
191         $(LIBNTFS_3G_CFLAGS)    \
192         $(LIBCRYPTO_CFLAGS)
193
194 libwim_la_LDFLAGS = $(AM_LDFLAGS) -version-info 18:0:3
195
196 libwim_la_LIBADD =              \
197         $(LIBXML2_LIBS)         \
198         $(LIBFUSE_LIBS)         \
199         $(LIBRT_LIBS)           \
200         $(LIBNTFS_3G_LIBS)      \
201         $(LTLIBICONV)           \
202         $(LIBCRYPTO_LIBS)       \
203         $(SSSE3_SHA1_OBJ)       \
204         $(PTHREAD_LDADD)
205
206 ##############################################################################
207 #                               Programs                                     #
208 ##############################################################################
209
210 bin_PROGRAMS = wimlib-imagex
211 dist_bin_SCRIPTS = programs/mkwinpeimg
212
213 wimlib_imagex_SOURCES =         \
214         programs/imagex.c       \
215         include/wimlib.h        \
216         include/wimlib_tchar.h
217
218 if WINDOWS_NATIVE_BUILD
219 wimlib_imagex_SOURCES +=        \
220         programs/imagex-win32.c \
221         programs/imagex-win32.h \
222         programs/wgetopt.c      \
223         programs/wgetopt.h
224 endif
225
226 wimlib_imagex_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
227
228 wimlib_imagex_LDADD = $(top_builddir)/libwim.la
229
230 wimlib_imagex_cmds =    \
231         append          \
232         apply           \
233         capture         \
234         delete          \
235         dir             \
236         export          \
237         extract         \
238         info            \
239         join            \
240         mount           \
241         mountrw         \
242         optimize        \
243         split           \
244         unmount         \
245         update          \
246         verify
247
248 ##############################################################################
249 #                                 Hooks                                      #
250 ##############################################################################
251
252 install-exec-hook:
253         for cmd in $(wimlib_imagex_cmds); do                            \
254                 cd $(DESTDIR)$(bindir) &&                               \
255                         ln -f wimlib-imagex wim$${cmd};                 \
256         done
257
258 install-data-hook:
259         for cmd in $(wimlib_imagex_cmds); do                            \
260                 cd $(DESTDIR)$(mandir)/man1 &&                          \
261                         ln -sf wimlib-imagex-$${cmd}.1 wim$${cmd}.1;    \
262         done
263
264 uninstall-hook:
265         for cmd in $(wimlib_imagex_cmds); do                            \
266                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};                   \
267                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;            \
268         done
269
270 ##############################################################################
271 #                               Documentation                                #
272 ##############################################################################
273
274 man1_MANS =                                     \
275         doc/man1/wimlib-imagex.1                \
276         doc/man1/wimlib-imagex-append.1         \
277         doc/man1/wimlib-imagex-apply.1          \
278         doc/man1/wimlib-imagex-capture.1        \
279         doc/man1/wimlib-imagex-delete.1         \
280         doc/man1/wimlib-imagex-dir.1            \
281         doc/man1/wimlib-imagex-export.1         \
282         doc/man1/wimlib-imagex-extract.1        \
283         doc/man1/wimlib-imagex-info.1           \
284         doc/man1/wimlib-imagex-join.1           \
285         doc/man1/wimlib-imagex-mount.1          \
286         doc/man1/wimlib-imagex-mountrw.1        \
287         doc/man1/wimlib-imagex-optimize.1       \
288         doc/man1/wimlib-imagex-split.1          \
289         doc/man1/wimlib-imagex-unmount.1        \
290         doc/man1/wimlib-imagex-update.1         \
291         doc/man1/wimlib-imagex-verify.1         \
292         doc/man1/mkwinpeimg.1
293
294 EXTRA_DIST += $(man1_MANS)
295
296 ##############################################################################
297 #                                 Tests                                      #
298 ##############################################################################
299
300 check_PROGRAMS = tests/tree-cmp
301 tests_tree_cmp_SOURCES = tests/tree-cmp.c
302
303 dist_check_SCRIPTS = tests/test-imagex \
304                      tests/test-imagex-capture_and_apply \
305                      tests/test-imagex-update_and_extract
306
307 if WITH_FUSE
308 dist_check_SCRIPTS += tests/test-imagex-mount
309 endif
310
311 if WITH_NTFS_3G
312 dist_check_SCRIPTS += tests/test-imagex-ntfs
313 endif
314
315 EXTRA_DIST +=                                   \
316         tests/common_tests.sh                   \
317         tests/tests-common.sh                   \
318         tests/security_descriptor_1.base64      \
319         tests/security_descriptor_1.bin         \
320         tests/security_descriptor_2.base64      \
321         tests/security_descriptor_2.bin
322
323 if WINDOWS_NATIVE_BUILD
324 # Tests are run manually for Windows builds.
325 TESTS =
326 else
327 TESTS = $(dist_check_SCRIPTS)
328 endif
329
330 ##############################################################################