Improve use of pkg-config
[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 8:0:1 $(WINDOWS_LDFLAGS)
19
20 libwim_la_SOURCES =             \
21         src/add_image.c         \
22         src/capture_common.c    \
23         src/compress.c          \
24         src/decompress.c        \
25         src/delete_image.c      \
26         src/dentry.c            \
27         src/encoding.c          \
28         src/export_image.c      \
29         src/extract.c           \
30         src/file_io.c           \
31         src/hardlink.c          \
32         src/header.c            \
33         src/integrity.c         \
34         src/join.c              \
35         src/lookup_table.c      \
36         src/lz77.c              \
37         src/lzx-common.c        \
38         src/lzx-compress.c      \
39         src/lzx-decompress.c    \
40         src/metadata_resource.c \
41         src/mount_image.c       \
42         src/paths.c             \
43         src/resource.c          \
44         src/rbtree.c            \
45         src/security.c          \
46         src/sha1.c              \
47         src/split.c             \
48         src/swm.c               \
49         src/reparse.c           \
50         src/timestamp.c         \
51         src/update_image.c      \
52         src/util.c              \
53         src/verify.c            \
54         src/wim.c               \
55         src/write.c             \
56         src/xml.c               \
57         src/xpress-compress.c   \
58         src/xpress-decompress.c \
59         include/wimlib/apply.h          \
60         include/wimlib/assert.h         \
61         include/wimlib/callback.h       \
62         include/wimlib/capture.h        \
63         include/wimlib/compiler.h       \
64         include/wimlib/compress.h       \
65         include/wimlib/decompress.h     \
66         include/wimlib/dentry.h         \
67         include/wimlib/encoding.h       \
68         include/wimlib/endianness.h     \
69         include/wimlib/error.h          \
70         include/wimlib/file_io.h        \
71         include/wimlib/header.h         \
72         include/wimlib/integrity.h      \
73         include/wimlib/list.h           \
74         include/wimlib/lookup_table.h   \
75         include/wimlib/lzx.h            \
76         include/wimlib/metadata.h       \
77         include/wimlib/paths.h          \
78         include/wimlib/rbtree.h         \
79         include/wimlib/reparse.h        \
80         include/wimlib/resource.h       \
81         include/wimlib/security.h       \
82         include/wimlib/sha1.h           \
83         include/wimlib/swm.h            \
84         include/wimlib/timestamp.h      \
85         include/wimlib/types.h          \
86         include/wimlib/util.h           \
87         include/wimlib/version.h        \
88         include/wimlib/wim.h            \
89         include/wimlib/write.h          \
90         include/wimlib/xml.h            \
91         include/wimlib/xpress.h
92
93 if WITH_NTFS_3G
94 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
95                      src/ntfs-3g_capture.c      \
96                      include/wimlib/ntfs_3g.h
97 endif
98
99 if WINDOWS_NATIVE_BUILD
100 libwim_la_SOURCES += src/win32_common.c                 \
101                      src/win32_apply.c                  \
102                      src/win32_capture.c                \
103                      src/win32_replacements.c           \
104                      include/wimlib/win32_common.h      \
105                      include/wimlib/win32.h
106 else
107 libwim_la_SOURCES += src/unix_apply.c           \
108                      src/unix_capture.c
109 endif
110
111
112
113 EXTRA_libwim_la_SOURCES = src/sha1-ssse3.asm
114 libwim_la_DEPENDENCIES = $(SSSE3_SHA1_OBJ)
115 STRIP_FPIC = sh $(top_srcdir)/build-aux/strip_fPIC.sh
116
117 sha1-ssse3.lo:src/sha1-ssse3.asm
118         $(LIBTOOL) --mode=compile --tag=CC $(STRIP_FPIC) $(NASM) -f elf64 \
119         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=ssse3_not_found \
120         $<
121
122 libwim_la_LIBADD =              \
123         $(LIBXML2_LIBS)         \
124         $(LIBFUSE_LIBS)         \
125         $(LIBRT_LIBS)           \
126         $(LIBNTFS_3G_LIBS)      \
127         $(LTLIBICONV)           \
128         $(LIBCRYPTO_LIBS)       \
129         $(SSSE3_SHA1_OBJ)       \
130         $(PTHREAD_LDADD)        \
131         $(WINDOWS_LDADD)
132
133 libwim_la_CFLAGS =              \
134         $(AM_CFLAGS)            \
135         $(VISIBILITY_CFLAGS)    \
136         $(LIBXML2_CFLAGS)       \
137         $(LIBFUSE_CFLAGS)       \
138         $(LIBNTFS_3G_CFLAGS)    \
139         $(LIBCRYPTO_CFLAGS)
140
141
142 bin_PROGRAMS     = imagex
143 imagex_SOURCES   = programs/imagex.c    \
144                    include/wimlib.h     \
145                    include/wimlib_tchar.h
146 imagex_LDADD     = $(top_builddir)/libwim.la
147 imagex_CFLAGS    = $(AM_CFLAGS) $(WINDOWS_CFLAGS) -Wno-deprecated-declarations
148
149 if WINDOWS_NATIVE_BUILD
150 imagex_SOURCES += programs/imagex-win32.c       \
151                   programs/imagex-win32.h       \
152                   programs/wgetopt.c            \
153                   programs/wgetopt.h
154 endif
155
156 install-exec-hook:
157         if [ "@IMAGEX_PROGNAME@" != imagex ]; then \
158                 cd $(DESTDIR)$(bindir) && mv -f imagex "@IMAGEX_PROGNAME@"; \
159                 cd $(DESTDIR)$(bindir) && ln -s "@IMAGEX_PROGNAME@" imagex; \
160         fi
161
162 uninstall-hook:
163         if [ "@IMAGEX_PROGNAME@" != imagex ]; then \
164                 cd $(DESTDIR)$(bindir) && rm -f "@IMAGEX_PROGNAME@"; \
165                 cd $(DESTDIR)$(bindir) && rm -f imagex; \
166         fi
167
168 dist_bin_SCRIPTS = programs/mkwinpeimg
169
170 include_HEADERS = include/wimlib.h
171
172 EXTRA_DIST =                                    \
173         build-aux/strip_fPIC.sh                 \
174         archlinux                               \
175         debian                                  \
176         rpm                                     \
177         examples                                \
178         README.WINDOWS                          \
179         programs/install.cmd                    \
180         programs/wimapply.c                     \
181         tests/common_tests.sh                   \
182         tests/tests-common.sh                   \
183         tests/security_descriptor_1.base64      \
184         tests/security_descriptor_1.bin         \
185         tests/security_descriptor_2.base64      \
186         tests/security_descriptor_2.bin
187
188 pkgconfigdir    = @pkgconfigdir@
189 pkgconfig_DATA  = wimlib.pc
190
191 $(pkgconfig_DATA): config.status
192
193 wimlib_manpages =                               \
194         doc/@IMAGEX_PROGNAME@.1                 \
195         doc/@IMAGEX_PROGNAME@-append.1          \
196         doc/@IMAGEX_PROGNAME@-apply.1           \
197         doc/@IMAGEX_PROGNAME@-capture.1         \
198         doc/@IMAGEX_PROGNAME@-delete.1          \
199         doc/@IMAGEX_PROGNAME@-dir.1             \
200         doc/@IMAGEX_PROGNAME@-export.1          \
201         doc/@IMAGEX_PROGNAME@-extract.1         \
202         doc/@IMAGEX_PROGNAME@-info.1            \
203         doc/@IMAGEX_PROGNAME@-join.1            \
204         doc/@IMAGEX_PROGNAME@-mount.1           \
205         doc/@IMAGEX_PROGNAME@-mountrw.1         \
206         doc/@IMAGEX_PROGNAME@-optimize.1        \
207         doc/@IMAGEX_PROGNAME@-split.1           \
208         doc/@IMAGEX_PROGNAME@-unmount.1         \
209         doc/@IMAGEX_PROGNAME@-update.1          \
210         doc/mkwinpeimg.1
211
212 man1_MANS = $(wimlib_manpages)
213 DISTCLEANFILES = $(wimlib_manpages)
214
215 $(man1_MANS): config.status
216
217 check_PROGRAMS = tests/tree-cmp
218 tests_tree_cmp_SOURCES = tests/tree-cmp.c
219
220 dist_check_SCRIPTS = tests/test-imagex \
221                      tests/test-imagex-capture_and_apply \
222                      tests/test-imagex-update_and_extract
223
224 if WITH_FUSE
225 dist_check_SCRIPTS += tests/test-imagex-mount
226 endif
227
228 if WITH_NTFS_3G
229 dist_check_SCRIPTS += tests/test-imagex-ntfs
230 endif
231
232 if WINDOWS_NATIVE_BUILD
233 # Tests are run manually for Windows builds.
234 TESTS =
235 else
236 TESTS = $(dist_check_SCRIPTS)
237 endif
238