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