82a1b5d8e53902481db5e15e385a88d8998735fa
[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 15:0:0 $(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/encoding.c          \
33         src/export_image.c      \
34         src/extract.c           \
35         src/file_io.c           \
36         src/header.c            \
37         src/inode.c             \
38         src/inode_fixup.c       \
39         src/integrity.c         \
40         src/iterate_dir.c       \
41         src/join.c              \
42         src/lookup_table.c      \
43         src/lzms-common.c       \
44         src/lzms-compress.c     \
45         src/lzms-decompress.c   \
46         src/lz_hash.c           \
47         src/lz_sarray.c         \
48         src/divsufsort/divsufsort.c             \
49         src/divsufsort/divsufsort.h             \
50         src/divsufsort/divsufsort_private.h     \
51         src/divsufsort/sssort.c \
52         src/divsufsort/trsort.c \
53         src/lzx-common.c        \
54         src/lzx-compress.c      \
55         src/lzx-decompress.c    \
56         src/metadata_resource.c \
57         src/mount_image.c       \
58         src/pathlist.c          \
59         src/paths.c             \
60         src/resource.c          \
61         src/reference.c         \
62         src/security.c          \
63         src/sha1.c              \
64         src/split.c             \
65         src/reparse.c           \
66         src/template.c          \
67         src/textfile.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/textfile.h       \
117         include/wimlib/timestamp.h      \
118         include/wimlib/types.h          \
119         include/wimlib/unix_data.h      \
120         include/wimlib/util.h           \
121         include/wimlib/version.h        \
122         include/wimlib/wildcard.h       \
123         include/wimlib/wim.h            \
124         include/wimlib/write.h          \
125         include/wimlib/xml.h            \
126         include/wimlib/xpress.h
127
128 if WITH_NTFS_3G
129 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
130                      src/ntfs-3g_capture.c      \
131                      include/wimlib/ntfs_3g.h
132 endif
133
134 if WINDOWS_NATIVE_BUILD
135 libwim_la_SOURCES += src/win32_common.c                 \
136                      src/win32_apply.c                  \
137                      src/win32_capture.c                \
138                      src/win32_replacements.c           \
139                      src/wimboot.c                      \
140                      include/wimlib/win32_common.h      \
141                      include/wimlib/win32.h             \
142                      include/wimlib/wimboot.h           \
143                      include/wimlib/wof.h
144 else
145 libwim_la_SOURCES += src/unix_apply.c           \
146                      src/unix_capture.c
147 endif
148
149
150
151 EXTRA_libwim_la_SOURCES = src/sha1-ssse3.asm
152 libwim_la_DEPENDENCIES = $(SSSE3_SHA1_OBJ)
153 STRIP_FPIC = sh $(top_srcdir)/build-aux/strip_fPIC.sh
154
155 sha1-ssse3.lo:src/sha1-ssse3.asm
156         $(LIBTOOL) --mode=compile --tag=CC $(STRIP_FPIC) $(NASM) -f elf64 \
157         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=ssse3_not_found \
158         $<
159
160 libwim_la_LIBADD =              \
161         $(LIBXML2_LIBS)         \
162         $(LIBFUSE_LIBS)         \
163         $(LIBRT_LIBS)           \
164         $(LIBNTFS_3G_LIBS)      \
165         $(LTLIBICONV)           \
166         $(LIBCRYPTO_LIBS)       \
167         $(SSSE3_SHA1_OBJ)       \
168         $(PTHREAD_LDADD)        \
169         $(WINDOWS_LDADD)
170
171 libwim_la_CFLAGS =              \
172         $(AM_CFLAGS)            \
173         $(VISIBILITY_CFLAGS)    \
174         $(LIBXML2_CFLAGS)       \
175         $(LIBFUSE_CFLAGS)       \
176         $(LIBNTFS_3G_CFLAGS)    \
177         $(LIBCRYPTO_CFLAGS)
178
179
180 bin_PROGRAMS     = imagex
181 imagex_SOURCES   = programs/imagex.c    \
182                    include/wimlib.h     \
183                    include/wimlib_tchar.h
184 imagex_LDADD     = $(top_builddir)/libwim.la
185 imagex_CFLAGS    = $(AM_CFLAGS) $(WINDOWS_CFLAGS) -Wno-deprecated-declarations
186
187 if WINDOWS_NATIVE_BUILD
188 imagex_SOURCES += programs/imagex-win32.c       \
189                   programs/imagex-win32.h       \
190                   programs/wgetopt.c            \
191                   programs/wgetopt.h
192 endif
193
194 imagex_cmds =   append  \
195                 apply   \
196                 capture \
197                 delete  \
198                 dir     \
199                 export  \
200                 extract \
201                 info    \
202                 join    \
203                 mount   \
204                 mountrw \
205                 optimize\
206                 split   \
207                 unmount \
208                 update
209
210 install-exec-hook:
211         if [ "@IMAGEX_PROGNAME@" != imagex ]; then                          \
212                 cd $(DESTDIR)$(bindir) && mv -f imagex "@IMAGEX_PROGNAME@"; \
213         fi
214         for cmd in $(imagex_cmds); do                           \
215                 cd $(DESTDIR)$(bindir) &&                       \
216                         ln -f "@IMAGEX_PROGNAME@" wim$${cmd};   \
217         done
218
219 install-data-hook:
220         for cmd in $(imagex_cmds); do                                       \
221                 cd $(DESTDIR)$(mandir)/man1 &&                              \
222                         ln -sf "@IMAGEX_PROGNAME@-$${cmd}.1" wim$${cmd}.1;  \
223         done
224
225 uninstall-hook:
226         if [ "@IMAGEX_PROGNAME@" != imagex ]; then              \
227                 rm -f $(DESTDIR)$(bindir)/"@IMAGEX_PROGNAME@";  \
228                 rm -f $(DESTDIR)$(bindir)/imagex;               \
229         fi
230         for cmd in $(imagex_cmds); do                           \
231                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};           \
232         done
233         for cmd in $(imagex_cmds); do                           \
234                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;    \
235         done
236
237
238 dist_bin_SCRIPTS = programs/mkwinpeimg
239
240 include_HEADERS = include/wimlib.h
241
242 EXTRA_DIST =                                    \
243         build-aux/strip_fPIC.sh                 \
244         archlinux                               \
245         debian                                  \
246         rpm                                     \
247         examples                                \
248         README.WINDOWS                          \
249         tests/common_tests.sh                   \
250         tests/tests-common.sh                   \
251         tests/security_descriptor_1.base64      \
252         tests/security_descriptor_1.bin         \
253         tests/security_descriptor_2.base64      \
254         tests/security_descriptor_2.bin
255
256 pkgconfigdir    = @pkgconfigdir@
257 pkgconfig_DATA  = wimlib.pc
258
259 $(pkgconfig_DATA): config.status
260
261 wimlib_manpages =                               \
262         doc/man1/@IMAGEX_PROGNAME@.1                    \
263         doc/man1/@IMAGEX_PROGNAME@-append.1             \
264         doc/man1/@IMAGEX_PROGNAME@-apply.1              \
265         doc/man1/@IMAGEX_PROGNAME@-capture.1            \
266         doc/man1/@IMAGEX_PROGNAME@-delete.1             \
267         doc/man1/@IMAGEX_PROGNAME@-dir.1                \
268         doc/man1/@IMAGEX_PROGNAME@-export.1             \
269         doc/man1/@IMAGEX_PROGNAME@-extract.1            \
270         doc/man1/@IMAGEX_PROGNAME@-info.1               \
271         doc/man1/@IMAGEX_PROGNAME@-join.1               \
272         doc/man1/@IMAGEX_PROGNAME@-mount.1              \
273         doc/man1/@IMAGEX_PROGNAME@-mountrw.1            \
274         doc/man1/@IMAGEX_PROGNAME@-optimize.1   \
275         doc/man1/@IMAGEX_PROGNAME@-split.1              \
276         doc/man1/@IMAGEX_PROGNAME@-unmount.1            \
277         doc/man1/@IMAGEX_PROGNAME@-update.1             \
278         doc/man1/mkwinpeimg.1
279
280 man1_MANS = $(wimlib_manpages)
281 DISTCLEANFILES = $(wimlib_manpages)
282
283 $(man1_MANS): config.status
284
285 check_PROGRAMS = tests/tree-cmp
286 tests_tree_cmp_SOURCES = tests/tree-cmp.c
287
288 dist_check_SCRIPTS = tests/test-imagex \
289                      tests/test-imagex-capture_and_apply \
290                      tests/test-imagex-update_and_extract
291
292 if WITH_FUSE
293 dist_check_SCRIPTS += tests/test-imagex-mount
294 endif
295
296 if WITH_NTFS_3G
297 dist_check_SCRIPTS += tests/test-imagex-ntfs
298 endif
299
300 if WINDOWS_NATIVE_BUILD
301 # Tests are run manually for Windows builds.
302 TESTS =
303 else
304 TESTS = $(dist_check_SCRIPTS)
305 endif
306