23ffcd9c1f3dc362b21823699d5a266c3909ee4e
[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=gnu99 -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 14:0:5 $(WINDOWS_LDFLAGS)
19
20 libwim_la_SOURCES =             \
21         src/add_image.c         \
22         src/avl_tree.c          \
23         src/capture_common.c    \
24         src/compat.c            \
25         src/compress.c          \
26         src/compress_common.c   \
27         src/compress_parallel.c \
28         src/compress_serial.c   \
29         src/decompress.c        \
30         src/decompress_common.c \
31         src/delete_image.c      \
32         src/dentry.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/lzms-common.c       \
45         src/lzms-compress.c     \
46         src/lzms-decompress.c   \
47         src/lz_hash.c           \
48         src/lz_sarray.c         \
49         src/divsufsort/divsufsort.c             \
50         src/divsufsort/divsufsort.h             \
51         src/divsufsort/divsufsort_private.h     \
52         src/divsufsort/sssort.c \
53         src/divsufsort/trsort.c \
54         src/lzx-common.c        \
55         src/lzx-compress.c      \
56         src/lzx-decompress.c    \
57         src/metadata_resource.c \
58         src/mount_image.c       \
59         src/pathlist.c          \
60         src/paths.c             \
61         src/resource.c          \
62         src/reference.c         \
63         src/security.c          \
64         src/sha1.c              \
65         src/split.c             \
66         src/reparse.c           \
67         src/template.c          \
68         src/timestamp.c         \
69         src/update_image.c      \
70         src/util.c              \
71         src/verify.c            \
72         src/wildcard.c          \
73         src/wim.c               \
74         src/write.c             \
75         src/xml.c               \
76         src/xpress-compress.c   \
77         src/xpress-decompress.c \
78         include/wimlib/apply.h          \
79         include/wimlib/assert.h         \
80         include/wimlib/avl_tree.h       \
81         include/wimlib/callback.h       \
82         include/wimlib/capture.h        \
83         include/wimlib/case.h           \
84         include/wimlib/compiler.h       \
85         include/wimlib/compressor_ops.h \
86         include/wimlib/compress_common.h        \
87         include/wimlib/chunk_compressor.h       \
88         include/wimlib/decompressor_ops.h       \
89         include/wimlib/decompress_common.h      \
90         include/wimlib/dentry.h         \
91         include/wimlib/encoding.h       \
92         include/wimlib/endianness.h     \
93         include/wimlib/error.h          \
94         include/wimlib/file_io.h        \
95         include/wimlib/glob.h           \
96         include/wimlib/header.h         \
97         include/wimlib/inode.h          \
98         include/wimlib/inode_table.h    \
99         include/wimlib/integrity.h      \
100         include/wimlib/list.h           \
101         include/wimlib/lookup_table.h   \
102         include/wimlib/lz.h             \
103         include/wimlib/lz_hash.h        \
104         include/wimlib/lz_optimal.h     \
105         include/wimlib/lz_sarray.h      \
106         include/wimlib/lzms.h           \
107         include/wimlib/lzx.h            \
108         include/wimlib/metadata.h       \
109         include/wimlib/pathlist.h       \
110         include/wimlib/paths.h          \
111         include/wimlib/reparse.h        \
112         include/wimlib/resource.h       \
113         include/wimlib/security.h       \
114         include/wimlib/security_descriptor.h    \
115         include/wimlib/sha1.h           \
116         include/wimlib/timestamp.h      \
117         include/wimlib/types.h          \
118         include/wimlib/unix_data.h      \
119         include/wimlib/util.h           \
120         include/wimlib/version.h        \
121         include/wimlib/wildcard.h       \
122         include/wimlib/wim.h            \
123         include/wimlib/write.h          \
124         include/wimlib/xml.h            \
125         include/wimlib/xpress.h
126
127 if WITH_NTFS_3G
128 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
129                      src/ntfs-3g_capture.c      \
130                      include/wimlib/ntfs_3g.h
131 endif
132
133 if WINDOWS_NATIVE_BUILD
134 libwim_la_SOURCES += src/win32_common.c                 \
135                      src/win32_apply.c                  \
136                      src/win32_capture.c                \
137                      src/win32_replacements.c           \
138                      src/wimboot.c                      \
139                      include/wimlib/win32_common.h      \
140                      include/wimlib/win32.h             \
141                      include/wimlib/wimboot.h           \
142                      include/wimlib/wof.h
143 else
144 libwim_la_SOURCES += src/unix_apply.c           \
145                      src/unix_capture.c
146 endif
147
148
149
150 EXTRA_libwim_la_SOURCES = src/sha1-ssse3.asm
151 libwim_la_DEPENDENCIES = $(SSSE3_SHA1_OBJ)
152 STRIP_FPIC = sh $(top_srcdir)/build-aux/strip_fPIC.sh
153
154 sha1-ssse3.lo:src/sha1-ssse3.asm
155         $(LIBTOOL) --mode=compile --tag=CC $(STRIP_FPIC) $(NASM) -f elf64 \
156         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=ssse3_not_found \
157         $<
158
159 libwim_la_LIBADD =              \
160         $(LIBXML2_LIBS)         \
161         $(LIBFUSE_LIBS)         \
162         $(LIBRT_LIBS)           \
163         $(LIBNTFS_3G_LIBS)      \
164         $(LTLIBICONV)           \
165         $(LIBCRYPTO_LIBS)       \
166         $(SSSE3_SHA1_OBJ)       \
167         $(PTHREAD_LDADD)        \
168         $(WINDOWS_LDADD)
169
170 libwim_la_CFLAGS =              \
171         $(AM_CFLAGS)            \
172         $(VISIBILITY_CFLAGS)    \
173         $(LIBXML2_CFLAGS)       \
174         $(LIBFUSE_CFLAGS)       \
175         $(LIBNTFS_3G_CFLAGS)    \
176         $(LIBCRYPTO_CFLAGS)
177
178
179 bin_PROGRAMS     = imagex
180 imagex_SOURCES   = programs/imagex.c    \
181                    include/wimlib.h     \
182                    include/wimlib_tchar.h
183 imagex_LDADD     = $(top_builddir)/libwim.la
184 imagex_CFLAGS    = $(AM_CFLAGS) $(WINDOWS_CFLAGS) -Wno-deprecated-declarations
185
186 if WINDOWS_NATIVE_BUILD
187 imagex_SOURCES += programs/imagex-win32.c       \
188                   programs/imagex-win32.h       \
189                   programs/wgetopt.c            \
190                   programs/wgetopt.h
191 endif
192
193 imagex_cmds =   append  \
194                 apply   \
195                 capture \
196                 delete  \
197                 dir     \
198                 export  \
199                 extract \
200                 info    \
201                 join    \
202                 mount   \
203                 mountrw \
204                 optimize\
205                 split   \
206                 unmount \
207                 update
208
209 install-exec-hook:
210         if [ "@IMAGEX_PROGNAME@" != imagex ]; then                          \
211                 cd $(DESTDIR)$(bindir) && mv -f imagex "@IMAGEX_PROGNAME@"; \
212         fi
213         for cmd in $(imagex_cmds); do                           \
214                 cd $(DESTDIR)$(bindir) &&                       \
215                         ln -f "@IMAGEX_PROGNAME@" wim$${cmd};   \
216         done
217
218 install-data-hook:
219         for cmd in $(imagex_cmds); do                                       \
220                 cd $(DESTDIR)$(mandir)/man1 &&                              \
221                         ln -sf "@IMAGEX_PROGNAME@-$${cmd}.1" wim$${cmd}.1;  \
222         done
223
224 uninstall-hook:
225         if [ "@IMAGEX_PROGNAME@" != imagex ]; then              \
226                 rm -f $(DESTDIR)$(bindir)/"@IMAGEX_PROGNAME@";  \
227                 rm -f $(DESTDIR)$(bindir)/imagex;               \
228         fi
229         for cmd in $(imagex_cmds); do                           \
230                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};           \
231         done
232         for cmd in $(imagex_cmds); do                           \
233                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;    \
234         done
235
236
237 dist_bin_SCRIPTS = programs/mkwinpeimg
238
239 include_HEADERS = include/wimlib.h
240
241 EXTRA_DIST =                                    \
242         build-aux/strip_fPIC.sh                 \
243         archlinux                               \
244         debian                                  \
245         rpm                                     \
246         examples                                \
247         README.WINDOWS                          \
248         tests/common_tests.sh                   \
249         tests/tests-common.sh                   \
250         tests/security_descriptor_1.base64      \
251         tests/security_descriptor_1.bin         \
252         tests/security_descriptor_2.base64      \
253         tests/security_descriptor_2.bin
254
255 pkgconfigdir    = @pkgconfigdir@
256 pkgconfig_DATA  = wimlib.pc
257
258 $(pkgconfig_DATA): config.status
259
260 wimlib_manpages =                               \
261         doc/@IMAGEX_PROGNAME@.1                 \
262         doc/@IMAGEX_PROGNAME@-append.1          \
263         doc/@IMAGEX_PROGNAME@-apply.1           \
264         doc/@IMAGEX_PROGNAME@-capture.1         \
265         doc/@IMAGEX_PROGNAME@-delete.1          \
266         doc/@IMAGEX_PROGNAME@-dir.1             \
267         doc/@IMAGEX_PROGNAME@-export.1          \
268         doc/@IMAGEX_PROGNAME@-extract.1         \
269         doc/@IMAGEX_PROGNAME@-info.1            \
270         doc/@IMAGEX_PROGNAME@-join.1            \
271         doc/@IMAGEX_PROGNAME@-mount.1           \
272         doc/@IMAGEX_PROGNAME@-mountrw.1         \
273         doc/@IMAGEX_PROGNAME@-optimize.1        \
274         doc/@IMAGEX_PROGNAME@-split.1           \
275         doc/@IMAGEX_PROGNAME@-unmount.1         \
276         doc/@IMAGEX_PROGNAME@-update.1          \
277         doc/mkwinpeimg.1
278
279 man1_MANS = $(wimlib_manpages)
280 DISTCLEANFILES = $(wimlib_manpages)
281
282 $(man1_MANS): config.status
283
284 check_PROGRAMS = tests/tree-cmp
285 tests_tree_cmp_SOURCES = tests/tree-cmp.c
286
287 dist_check_SCRIPTS = tests/test-imagex \
288                      tests/test-imagex-capture_and_apply \
289                      tests/test-imagex-update_and_extract
290
291 if WITH_FUSE
292 dist_check_SCRIPTS += tests/test-imagex-mount
293 endif
294
295 if WITH_NTFS_3G
296 dist_check_SCRIPTS += tests/test-imagex-ntfs
297 endif
298
299 if WINDOWS_NATIVE_BUILD
300 # Tests are run manually for Windows builds.
301 TESTS =
302 else
303 TESTS = $(dist_check_SCRIPTS)
304 endif
305