edfb187dca17138b1902671689a333d8876f1ad1
[wimlib] / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4
2
3 AM_CPPFLAGS     = -I$(top_srcdir)/include $(WINDOWS_CPPFLAGS) \
4                   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
5
6 AM_CFLAGS       = -std=c99 -Wmissing-prototypes -Wstrict-prototypes     \
7                   -Werror-implicit-function-declaration                 \
8                   -fno-common -Wundef -Wno-pointer-sign
9
10 if WINDOWS_NATIVE_BUILD
11 # This option is needed to make packed structures work as expected
12 # with gcc 4.7+ (mingw) on Windows.
13 AM_CFLAGS += -mno-ms-bitfields
14 endif
15
16 lib_LTLIBRARIES = libwim.la
17
18 libwim_la_LDFLAGS = -version-info 18:0:3 $(WINDOWS_LDFLAGS)
19
20 libwim_la_SOURCES =             \
21         src/add_image.c         \
22         src/avl_tree.c          \
23         src/capture_common.c    \
24         src/compress.c          \
25         src/compress_common.c   \
26         src/compress_parallel.c \
27         src/compress_serial.c   \
28         src/decompress.c        \
29         src/decompress_common.c \
30         src/delete_image.c      \
31         src/dentry.c            \
32         src/divsufsort.c        \
33         src/encoding.c          \
34         src/export_image.c      \
35         src/extract.c           \
36         src/file_io.c           \
37         src/header.c            \
38         src/inode.c             \
39         src/inode_fixup.c       \
40         src/integrity.c         \
41         src/iterate_dir.c       \
42         src/join.c              \
43         src/lookup_table.c      \
44         src/lz_binary_trees.c   \
45         src/lz_hash_chains.c    \
46         src/lz_lcp_interval_tree.c      \
47         src/lz_linked_suffix_array.c    \
48         src/lz_mf.c             \
49         src/lz_null.c           \
50         src/lz_repsearch.c      \
51         src/lz_suffix_array_utils.c     \
52         src/lzms-common.c       \
53         src/lzms-compress.c     \
54         src/lzms-decompress.c   \
55         src/lzx-common.c        \
56         src/lzx-compress.c      \
57         src/lzx-decompress.c    \
58         src/metadata_resource.c \
59         src/mount_image.c       \
60         src/pathlist.c          \
61         src/paths.c             \
62         src/progress.c          \
63         src/resource.c          \
64         src/reference.c         \
65         src/security.c          \
66         src/sha1.c              \
67         src/split.c             \
68         src/reparse.c           \
69         src/tagged_items.c      \
70         src/template.c          \
71         src/textfile.c          \
72         src/timestamp.c         \
73         src/update_image.c      \
74         src/util.c              \
75         src/verify.c            \
76         src/wildcard.c          \
77         src/wim.c               \
78         src/write.c             \
79         src/xml.c               \
80         src/xpress-compress.c   \
81         src/xpress-decompress.c \
82         include/wimlib/apply.h          \
83         include/wimlib/assert.h         \
84         include/wimlib/avl_tree.h       \
85         include/wimlib/bitops.h         \
86         include/wimlib/callback.h       \
87         include/wimlib/capture.h        \
88         include/wimlib/case.h           \
89         include/wimlib/compiler.h       \
90         include/wimlib/compiler-gcc.h   \
91         include/wimlib/compressor_ops.h \
92         include/wimlib/compress_common.h        \
93         include/wimlib/chunk_compressor.h       \
94         include/wimlib/decompressor_ops.h       \
95         include/wimlib/decompress_common.h      \
96         include/wimlib/dentry.h         \
97         include/wimlib/divsufsort.h     \
98         include/wimlib/encoding.h       \
99         include/wimlib/endianness.h     \
100         include/wimlib/error.h          \
101         include/wimlib/file_io.h        \
102         include/wimlib/glob.h           \
103         include/wimlib/header.h         \
104         include/wimlib/inode.h          \
105         include/wimlib/inode_table.h    \
106         include/wimlib/integrity.h      \
107         include/wimlib/list.h           \
108         include/wimlib/lookup_table.h   \
109         include/wimlib/lz_extend.h      \
110         include/wimlib/lz_hash3.h       \
111         include/wimlib/lz_mf.h          \
112         include/wimlib/lz_mf_ops.h      \
113         include/wimlib/lz_repsearch.h   \
114         include/wimlib/lz_suffix_array_utils.h  \
115         include/wimlib/lzms.h           \
116         include/wimlib/lzms_constants.h \
117         include/wimlib/lzx.h            \
118         include/wimlib/lzx_constants.h  \
119         include/wimlib/metadata.h       \
120         include/wimlib/pathlist.h       \
121         include/wimlib/paths.h          \
122         include/wimlib/progress.h       \
123         include/wimlib/reparse.h        \
124         include/wimlib/resource.h       \
125         include/wimlib/security.h       \
126         include/wimlib/security_descriptor.h    \
127         include/wimlib/sha1.h           \
128         include/wimlib/textfile.h       \
129         include/wimlib/timestamp.h      \
130         include/wimlib/types.h          \
131         include/wimlib/unaligned.h      \
132         include/wimlib/unix_data.h      \
133         include/wimlib/util.h           \
134         include/wimlib/wildcard.h       \
135         include/wimlib/wim.h            \
136         include/wimlib/write.h          \
137         include/wimlib/xml.h            \
138         include/wimlib/xpress.h
139
140 if WITH_NTFS_3G
141 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
142                      src/ntfs-3g_capture.c      \
143                      include/wimlib/ntfs_3g.h
144 endif
145
146 if WINDOWS_NATIVE_BUILD
147 libwim_la_SOURCES += src/win32_common.c                 \
148                      src/win32_apply.c                  \
149                      src/win32_capture.c                \
150                      src/win32_replacements.c           \
151                      src/wimboot.c                      \
152                      include/wimlib/win32_common.h      \
153                      include/wimlib/win32.h             \
154                      include/wimlib/wimboot.h           \
155                      include/wimlib/wof.h
156 else
157 libwim_la_SOURCES += src/unix_apply.c           \
158                      src/unix_capture.c
159 endif
160
161
162
163 EXTRA_libwim_la_SOURCES = src/sha1-ssse3.asm
164 libwim_la_DEPENDENCIES = $(SSSE3_SHA1_OBJ)
165
166 src/sha1-ssse3.lo:src/sha1-ssse3.asm
167         $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/build-aux/nasm_lt.sh \
168         $(NASM) $(NAFLAGS) $(NASM_WINDOWS_FLAGS)                            \
169         -DINTEL_SHA1_UPDATE_FUNCNAME=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_ssse3       \
170         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_default  \
171         $< -o $@
172
173 libwim_la_LIBADD =              \
174         $(LIBXML2_LIBS)         \
175         $(LIBFUSE_LIBS)         \
176         $(LIBRT_LIBS)           \
177         $(LIBNTFS_3G_LIBS)      \
178         $(LTLIBICONV)           \
179         $(LIBCRYPTO_LIBS)       \
180         $(SSSE3_SHA1_OBJ)       \
181         $(PTHREAD_LDADD)
182
183 libwim_la_CFLAGS =              \
184         $(AM_CFLAGS)            \
185         $(VISIBILITY_CFLAGS)    \
186         $(LIBXML2_CFLAGS)       \
187         $(LIBFUSE_CFLAGS)       \
188         $(LIBNTFS_3G_CFLAGS)    \
189         $(LIBCRYPTO_CFLAGS)
190
191
192 bin_PROGRAMS     = imagex
193 imagex_SOURCES   = programs/imagex.c    \
194                    include/wimlib.h     \
195                    include/wimlib_tchar.h
196 imagex_LDADD     = $(top_builddir)/libwim.la
197 imagex_CFLAGS    = $(AM_CFLAGS) $(WINDOWS_CFLAGS) -Wno-deprecated-declarations
198
199 if WINDOWS_NATIVE_BUILD
200 imagex_SOURCES += programs/imagex-win32.c       \
201                   programs/imagex-win32.h       \
202                   programs/wgetopt.c            \
203                   programs/wgetopt.h
204 endif
205
206 imagex_cmds =   append  \
207                 apply   \
208                 capture \
209                 delete  \
210                 dir     \
211                 export  \
212                 extract \
213                 info    \
214                 join    \
215                 mount   \
216                 mountrw \
217                 optimize\
218                 split   \
219                 unmount \
220                 update  \
221                 verify
222
223 install-exec-hook:
224         if [ "@IMAGEX_PROGNAME@" != imagex ]; then                          \
225                 cd $(DESTDIR)$(bindir) && mv -f imagex "@IMAGEX_PROGNAME@"; \
226         fi
227         for cmd in $(imagex_cmds); do                           \
228                 cd $(DESTDIR)$(bindir) &&                       \
229                         ln -f "@IMAGEX_PROGNAME@" wim$${cmd};   \
230         done
231
232 install-data-hook:
233         for cmd in $(imagex_cmds); do                                       \
234                 cd $(DESTDIR)$(mandir)/man1 &&                              \
235                         ln -sf "@IMAGEX_PROGNAME@-$${cmd}.1" wim$${cmd}.1;  \
236         done
237
238 uninstall-hook:
239         if [ "@IMAGEX_PROGNAME@" != imagex ]; then              \
240                 rm -f $(DESTDIR)$(bindir)/"@IMAGEX_PROGNAME@";  \
241                 rm -f $(DESTDIR)$(bindir)/imagex;               \
242         fi
243         for cmd in $(imagex_cmds); do                           \
244                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};           \
245         done
246         for cmd in $(imagex_cmds); do                           \
247                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;    \
248         done
249
250
251 dist_bin_SCRIPTS = programs/mkwinpeimg
252
253 include_HEADERS = include/wimlib.h
254
255 EXTRA_DIST =                                    \
256         build-aux/nasm_lt.sh                    \
257         archlinux                               \
258         debian                                  \
259         rpm                                     \
260         examples                                \
261         COPYING                                 \
262         COPYING.GPLv3                           \
263         COPYING.LGPLv3                          \
264         README                                  \
265         README.WINDOWS                          \
266         tests/common_tests.sh                   \
267         tests/tests-common.sh                   \
268         tests/security_descriptor_1.base64      \
269         tests/security_descriptor_1.bin         \
270         tests/security_descriptor_2.base64      \
271         tests/security_descriptor_2.bin
272
273 pkgconfigdir    = @pkgconfigdir@
274 pkgconfig_DATA  = wimlib.pc
275
276 $(pkgconfig_DATA): config.status
277
278 wimlib_manpages =                               \
279         doc/man1/@IMAGEX_PROGNAME@.1                    \
280         doc/man1/@IMAGEX_PROGNAME@-append.1             \
281         doc/man1/@IMAGEX_PROGNAME@-apply.1              \
282         doc/man1/@IMAGEX_PROGNAME@-capture.1            \
283         doc/man1/@IMAGEX_PROGNAME@-delete.1             \
284         doc/man1/@IMAGEX_PROGNAME@-dir.1                \
285         doc/man1/@IMAGEX_PROGNAME@-export.1             \
286         doc/man1/@IMAGEX_PROGNAME@-extract.1            \
287         doc/man1/@IMAGEX_PROGNAME@-info.1               \
288         doc/man1/@IMAGEX_PROGNAME@-join.1               \
289         doc/man1/@IMAGEX_PROGNAME@-mount.1              \
290         doc/man1/@IMAGEX_PROGNAME@-mountrw.1            \
291         doc/man1/@IMAGEX_PROGNAME@-optimize.1   \
292         doc/man1/@IMAGEX_PROGNAME@-split.1              \
293         doc/man1/@IMAGEX_PROGNAME@-unmount.1            \
294         doc/man1/@IMAGEX_PROGNAME@-update.1             \
295         doc/man1/@IMAGEX_PROGNAME@-verify.1             \
296         doc/man1/mkwinpeimg.1
297
298 man1_MANS = $(wimlib_manpages)
299 DISTCLEANFILES = $(wimlib_manpages)
300
301 $(man1_MANS): config.status
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 if WINDOWS_NATIVE_BUILD
319 # Tests are run manually for Windows builds.
320 TESTS =
321 else
322 TESTS = $(dist_check_SCRIPTS)
323 endif
324