blob: 1758ccbab36009d2eeb5b466fb5dbb460a5ac776 [file] [log] [blame]
cristy45ef08f2012-12-07 13:13:34 +00001# Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
cristy3ed852e2009-09-05 21:47:34 +00002# dedicated to making software imaging solutions freely available.
3#
4# You may not use this file except in compliance with the License. You may
5# obtain a copy of the License at
6#
7# http://www.imagemagick.org/script/license.php
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# Copyright (C) 2003 - 2008 GraphicsMagick Group
16#
17# Top-Level Makefile for building ImageMagick.
18#
19
cristy3ed852e2009-09-05 21:47:34 +000020AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
21
22ACLOCAL_AMFLAGS = -I m4
23
cristyf5ee5be2009-11-06 02:22:56 +000024MODULECOMMONFLAGS = -no-undefined -export-symbols-regex ".*" -shared -module -avoid-version
cristy3ed852e2009-09-05 21:47:34 +000025
cristy9b86f202012-11-28 21:55:35 +000026SUBDIRS = .
27
cristy3ed852e2009-09-05 21:47:34 +000028# Options to pass when running configure in the distcheck target.
29#
30# We want to preserve user-provided option variables so the same
31# compiler, headers, and libraries are used as for a normal build.
32DISTCHECK_CONFIGURE_FLAGS=$(DISTCHECK_CONFIG_FLAGS)
33
cristy4c08aed2011-07-01 19:47:50 +000034DISTCLEANFILES = _configs.sed MagickCore/magick-config.h
cristy50620792010-02-09 00:42:32 +000035
cristy3ed852e2009-09-05 21:47:34 +000036## Make sure these will be cleaned even when they're not built by default.
37CLEANFILES = \
cristy4c08aed2011-07-01 19:47:50 +000038 $(MAGICKWAND_CLEANFILES) \
cristy3ed852e2009-09-05 21:47:34 +000039 $(MAGICKPP_CLEANFILES) \
40 $(UTILITIES_CLEANFILES) \
cristy52cf7f12010-02-07 18:07:56 +000041 $(TESTS_CLEANFILES)
cristy3ed852e2009-09-05 21:47:34 +000042
43bin_PROGRAMS = \
44 $(UTILITIES_PGMS)
45
46# Binary scripts
47bin_SCRIPTS = \
cristy4c08aed2011-07-01 19:47:50 +000048 $(MAGICKCORE_BIN_SCRPTS) \
49 $(MAGICKWAND_BIN_SCRPTS) \
cristy3ed852e2009-09-05 21:47:34 +000050 $(MAGICKPP_SCRPTS)
51
cristy5eef09f2012-10-16 12:08:28 +000052include_HEADERS =
cristy3ed852e2009-09-05 21:47:34 +000053
54# Headers which are not installed but which are distributed
55noinst_HEADERS = \
cristy4c08aed2011-07-01 19:47:50 +000056 $(MAGICKCORE_NOINST_HDRS)
cristy3ed852e2009-09-05 21:47:34 +000057
58if WIN32_NATIVE_BUILD
59SRCDIR='$(shell @WinPathScript@ $(srcdir)/)'
60else
61SRCDIR="$(srcdir)/"
62endif
63
cristybc556452012-08-17 19:44:03 +000064# Tests with .tap extensions use the TAP protocol and TAP driver
cristy9e524dc2012-08-21 00:07:27 +000065LOG_COMPILER = $(SHELL)
66
67SH_LOG_COMPILER = $(LOG_COMPILER)
68TAP_LOG_COMPILER = $(LOG_COMPILER)
69
70# Test extensions
71TEST_EXTENSIONS = .sh .tap
72
cristybc556452012-08-17 19:44:03 +000073TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
74 $(top_srcdir)/config/tap-driver.sh
75
cristy3ed852e2009-09-05 21:47:34 +000076# Environment parameters to be used during tests
77TESTS_ENVIRONMENT = \
cristy3ed852e2009-09-05 21:47:34 +000078 MAKE="$(MAKE)" \
79 MAKEFLAGS="$(MAKEFLAGS)" \
cristy0cf6da52012-08-25 00:35:24 +000080 MEMCHECK="$(MEMCHECK)"
cristy3ed852e2009-09-05 21:47:34 +000081
cristy3ed852e2009-09-05 21:47:34 +000082# Tests to run
83TESTS = \
cristy3ed852e2009-09-05 21:47:34 +000084 $(TESTS_TESTS) \
85 $(MAGICKPP_TESTS) \
cristy4c08aed2011-07-01 19:47:50 +000086 $(MAGICKWAND_TESTS) \
cristy3ed852e2009-09-05 21:47:34 +000087 $(UTILITIES_TESTS)
88
89# Tests which are expected to fail
90XFAIL_TESTS = \
91 $(TESTS_XFAIL_TESTS) \
92 $(UTILITIES_XFAIL_TESTS)
93
94TOP_EXTRA_DIST = \
95 AUTHORS.txt \
96 ChangeLog \
97 LICENSE \
98 QuickStart.txt \
99 NOTICE \
100 Install-mac.txt \
101 Install-unix.txt \
102 Install-vms.txt \
103 Install-windows.txt \
104 magick.sh.in \
105 Magickshr.opt \
cristy3ed852e2009-09-05 21:47:34 +0000106 NEWS.txt \
107 Platforms.txt \
108 README.txt \
109 index.html \
110 version.sh \
111 winpath.sh
112
113# Additional files to distribute
114EXTRA_DIST = \
115 $(TOP_EXTRA_DIST) \
116 $(CONFIG_EXTRA_DIST) \
cristy4c08aed2011-07-01 19:47:50 +0000117 $(MAGICKCORE_EXTRA_DIST) \
118 $(MAGICKWAND_EXTRA_DIST) \
cristy3ed852e2009-09-05 21:47:34 +0000119 $(MAGICKPP_EXTRA_DIST) \
120 $(UTILITIES_EXTRA_DIST) \
121 $(TESTS_EXTRA_DIST)
122
123lib_LTLIBRARIES = $(MAGICKCORE_LIBS) $(MAGICKWAND_LIBS) $(MAGICKPP_LIBS)
124AM_LDFLAGS =
125noinst_LTLIBRARIES =
126EXTRA_LTLIBRARIES =
127BUILT_SOURCES =
128MOSTLYCLEANFILES =
129
130check_PROGRAMS = \
131 $(TESTS_CHECK_PGRMS) \
132 $(MAGICKPP_CHECK_PGRMS) \
cristy4c08aed2011-07-01 19:47:50 +0000133 $(MAGICKWAND_CHECK_PGRMS)
cristy3ed852e2009-09-05 21:47:34 +0000134
135include m4/Makefile.am
136include config/Makefile.am
cristy3ed852e2009-09-05 21:47:34 +0000137include coders/Makefile.am
cristy4c08aed2011-07-01 19:47:50 +0000138include MagickCore/Makefile.am
139include MagickWand/Makefile.am
cristy3ed852e2009-09-05 21:47:34 +0000140include Magick++/Makefile.am
cristy4c08aed2011-07-01 19:47:50 +0000141include filters/Makefile.am
cristy3ed852e2009-09-05 21:47:34 +0000142include utilities/Makefile.am
143include tests/Makefile.am
144include PerlMagick/Makefile.am
145
146# Pkgconfig directory
147pkgconfigdir = $(libdir)/pkgconfig
148
149# Files to install in Pkgconfig directory
150pkgconfig_DATA = \
cristy4c08aed2011-07-01 19:47:50 +0000151 $(MAGICKCORE_PKGCONFIG) \
152 $(MAGICKWAND_PKGCONFIG) \
cristy3ed852e2009-09-05 21:47:34 +0000153 $(MAGICKPP_PKGCONFIG)
154
cristycc22d1d2012-12-10 13:03:25 +0000155# create a copy for pc file (ideally the non abi should be symlinked)
156%-@MAGICK_ABI_SUFFIX@.pc: %.pc
157 cp -f $^ $@
158
cristy3ed852e2009-09-05 21:47:34 +0000159# Manual pages to install
160man_MANS = \
cristy4c08aed2011-07-01 19:47:50 +0000161 $(MAGICKCORE_MANS) \
162 $(MAGICKWAND_MANS) \
cristy3ed852e2009-09-05 21:47:34 +0000163 $(MAGICKPP_MANS) \
164 $(UTILITIES_MANS)
165
166# Architecture independent data files installed in the package's data directory
cristy986d3c22011-03-30 14:11:37 +0000167docdir = $(DOCUMENTATION_PATH)
cristy3ed852e2009-09-05 21:47:34 +0000168doc_DATA = \
169 LICENSE \
170 ChangeLog \
171 NEWS.txt
172
173if MAINTAINER_MODE
cristye6922d42010-03-04 01:56:45 +0000174MAINTAINER_TARGETS = \
cristy999b6472010-04-15 01:18:53 +0000175 magick-version \
176 ImageMagick.spec \
177 $(PERLMAGICK_MAINTAINER_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000178endif
179
180all-local: $(MAGICKPP_LOCAL_TARGETS) $(PERLMAGICK_ALL_LOCAL_TARGETS) $(MAINTAINER_TARGETS)
181
cristy9ebfdfb2012-03-26 12:55:00 +0000182install-exec-local: $(PERLMAGICK_INSTALL_EXEC_LOCAL_TARGETS) \
183 $(UTILITIES_INSTALL_EXEC_LOCAL_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000184
cristy9ebfdfb2012-03-26 12:55:00 +0000185install-data-local: $(MAGICK_INSTALL_DATA_LOCAL_TARGETS) \
186 $(PERLMAGICK_INSTALL_DATA_LOCAL_TARGETS) \
187 $(HTML_INSTALL_DATA_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000188
cristy9ebfdfb2012-03-26 12:55:00 +0000189uninstall-local: $(MAGICK_UNINSTALL_LOCAL_TARGETS) \
190 $(PERLMAGICK_UNINSTALL_LOCAL_TARGETS) \
191 $(HTML_UNINSTALL_DATA_TARGETS) \
192 $(UTILITIES_UNINSTALL_LOCAL_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000193
194clean-local: $(PERLMAGICK_CLEAN_LOCAL_TARGETS)
195
196distclean-local: $(PERLMAGICK_DISTCLEAN_LOCAL_TARGETS)
197
198maintainer-clean-local: $(PERLMAGICK_MAINTAINER_CLEAN_LOCAL_TARGETS)
199
200check-local: $(PERLMAGICK_CHECK_LOCAL_TARGETS)
201
cristy2d9c0312010-04-17 23:58:07 +0000202# drd: valgrind's newer thread error detector
cristy3ed852e2009-09-05 21:47:34 +0000203drd:
cristy9c7e2af2010-05-23 23:13:27 +0000204 $(MAKE) MEMCHECK='valgrind --tool=drd --check-stack-var=yes --var-info=yes \
205 --quiet $(VALGRIND_EXTRA_OPTS)' check
206
cristy2d9c0312010-04-17 23:58:07 +0000207# helgrind: valgrind's older thread error detector
cristy3ed852e2009-09-05 21:47:34 +0000208helgrind:
cristy9c7e2af2010-05-23 23:13:27 +0000209 $(MAKE) MEMCHECK='valgrind --tool=helgrind --error-exitcode=2 --quiet \
210 $(VALGRIND_EXTRA_OPTS)' check
cristy3ed852e2009-09-05 21:47:34 +0000211
cristy2d9c0312010-04-17 23:58:07 +0000212# memcheck: valgrind's memory access checker
cristy3ed852e2009-09-05 21:47:34 +0000213memcheck:
cristy9c7e2af2010-05-23 23:13:27 +0000214 $(MAKE) MEMCHECK='valgrind --tool=memcheck --leak-check=full --read-var-info=yes \
215 --error-exitcode=2 --track-origins=yes --num-callers=12 \
216 --quiet $(VALGRIND_EXTRA_OPTS)' check
cristy3ed852e2009-09-05 21:47:34 +0000217
cristy2d9c0312010-04-17 23:58:07 +0000218# ptrcheck: valgrind's experimental pointer checking tool.
cristy3ed852e2009-09-05 21:47:34 +0000219ptrcheck:
cristy9c7e2af2010-05-23 23:13:27 +0000220 $(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check
cristy3ed852e2009-09-05 21:47:34 +0000221
222# Non-Automake subdirectories to distribute
cristy922bc2e2013-01-01 17:43:33 +0000223DISTDIRS = images scripts www PerlMagick
cristy3ed852e2009-09-05 21:47:34 +0000224dist-hook:
225 ( \
226 builddir=`pwd` ; \
227 cd $(srcdir) && \
228 ( \
229 for dir in $(DISTDIRS) ; do \
cristy922bc2e2013-01-01 17:43:33 +0000230 find $$dir -depth -print | egrep -v '(~$$)|(/.svn)|(/\.#)|(/\.deps)|(/\.svn)' \
cristy3ed852e2009-09-05 21:47:34 +0000231 | cpio -pdum $$builddir/$(distdir) 2> /dev/null ; \
232 done \
233 ) \
234 )
235
236#
237# Additional install rules
238#
239
240# Install HTML files
241pkgdocdir = $(DOCUMENTATION_PATH)
cristy0e496242011-03-19 13:00:57 +0000242DOCDIRS = images images/patterns www www/api www/source www/api/MagickCore www/api/MagickWand www/Magick++
cristy3ed852e2009-09-05 21:47:34 +0000243HTML_INSTALL_DATA_TARGETS = install-data-html
244install-data-html:
245 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
246 $(INSTALL_DATA) $(srcdir)/index.html $(DESTDIR)$(pkgdocdir)
247 @for dir in $(DOCDIRS) ; do \
248 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
249 for file in $(srcdir)/$$dir/*.* ; do \
250 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \
251 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \
252 done ; \
253 done
254
255# Uninstall HTML files
256HTML_UNINSTALL_DATA_TARGETS = uninstall-data-html
257uninstall-data-html:
258 rm -f $(DESTDIR)$(pkgdocdir)/index.html
259 for dir in $(DOCDIRS) ; do \
260 rm -f -r $(DESTDIR)$(pkgdocdir)/$$dir ; \
261 done
262
cristy4c08aed2011-07-01 19:47:50 +0000263# Ensure that version.h at $(srcdir)/MagickCore/version.h is kept up to date.
264magick-version: MagickCore/version.h
cristy3ed852e2009-09-05 21:47:34 +0000265 @if test -f "$(srcdir)/VisualMagick/installer/inc/version.isx.in" ; then \
266 ./config.status --file="$(srcdir)/../VisualMagick/installer/inc/version.isx" 2> /dev/null ; \
267 fi
268 @if test -n "$(VPATH)" ; then \
cristy4c08aed2011-07-01 19:47:50 +0000269 cmp MagickCore/version.h $(srcdir)/MagickCore/version.h > /dev/null ; \
cristy3ed852e2009-09-05 21:47:34 +0000270 if test $$? -eq 1 ; then \
cristy4c08aed2011-07-01 19:47:50 +0000271 echo "Updating $(srcdir)/MagickCore/version.h ..."; \
272 cp MagickCore/version.h $(srcdir)/MagickCore/version.h ; \
cristy3ed852e2009-09-05 21:47:34 +0000273 fi ; \
274 fi ; \
275 touch magick-version
276
277${srcdir}/configure: ${srcdir}/version.sh
278
279# Automagically reconfigure libtool
280LIBTOOL_DEPS = @LIBTOOL_DEPS@
281libtool: $(LIBTOOL_DEPS)
282 $(SHELL) ./config.status --recheck
283
284# Format C API documentation
285html:
286 doxygen config/MagickCore.dox
287 doxygen config/MagickWand.dox
288
289#
290# Build Windows source Zip and 7Zip balls
291#
292if ZIP_DELEGATE
cristy15a88782010-01-31 23:24:49 +0000293DIST_WINDOWS_SRC_ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.zip
cristy3ed852e2009-09-05 21:47:34 +0000294else
295DIST_WINDOWS_SRC_ZIP=
296endif
297if P7ZIP_DELEGATE
cristy15a88782010-01-31 23:24:49 +0000298DIST_WINDOWS_SRC_7ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.7z
cristy3ed852e2009-09-05 21:47:34 +0000299else
300DIST_WINDOWS_SRC_7ZIP=
301endif
302$(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) windows-dist:
cristy15a88782010-01-31 23:24:49 +0000303 if test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; then \
304 chmod -R u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
305 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
cristy3ed852e2009-09-05 21:47:34 +0000306 fi
cristy15a88782010-01-31 23:24:49 +0000307 svn export https://subversion.imagemagick.org/subversion/ImageMagick-Windows/trunk $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000308if ZIP_DELEGATE
309 rm -f $(DIST_WINDOWS_SRC_ZIP)
cristy15a88782010-01-31 23:24:49 +0000310 $(ZIP) -r -9 -q $(DIST_WINDOWS_SRC_ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000311endif # ZIP_DELEGATE
312if P7ZIP_DELEGATE
313 rm -f $(DIST_WINDOWS_SRC_7ZIP)
cristy15a88782010-01-31 23:24:49 +0000314 $(P7ZIP) a -t7z -mx=9 $(DIST_WINDOWS_SRC_7ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000315 chmod 644 $(DIST_WINDOWS_SRC_7ZIP)
316endif # P7ZIP_DELEGATE
cristy15a88782010-01-31 23:24:49 +0000317 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000318
319#
320# RPM build support
321#
322if RPM_DELEGATE
323
cristy2d9c0312010-04-17 23:58:07 +0000324DIST_ARCHIVE_SRPM=$(distdir)-1.src.rpm
cristy3ed852e2009-09-05 21:47:34 +0000325.PHONY: srpm
anthony1e3d36d2012-02-23 12:29:17 +0000326$(DIST_ARCHIVE_SRPM) srpm: dist-bzip2
cristy3ed852e2009-09-05 21:47:34 +0000327 rm -f $(DIST_ARCHIVE_SRPM)
328 $(RPM) --define="_sourcedir `pwd`" --define="_srcrpmdir `pwd`" --nodeps --bs ImageMagick.spec
329 @echo ==============================================================
330 @echo $(DIST_ARCHIVE_SRPM) is ready for distribution.
331 @echo ==============================================================
332
cristy3225a072010-04-17 01:47:28 +0000333RPMDIR=rpmbuild
334RPMARCH=$(MAGICK_TARGET_CPU)
cristy3ed852e2009-09-05 21:47:34 +0000335
336DIST_ARCHIVE_RPM= \
cristy15a88782010-01-31 23:24:49 +0000337 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
338 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
339 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
340 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
341 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-perl-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm
cristy3ed852e2009-09-05 21:47:34 +0000342
343.PHONY: rpm
cristy2d9c0312010-04-17 23:58:07 +0000344rpm: dist
cristy3ed852e2009-09-05 21:47:34 +0000345 rm -rf $(RPMDIR)
cristy78cd7652010-04-17 22:50:03 +0000346 $(MKDIR_P) $(RPMDIR)
347 $(MKDIR_P) $(RPMDIR)/BUILD
348 $(MKDIR_P) $(RPMDIR)/RPMS
cristy3ed852e2009-09-05 21:47:34 +0000349 $(RPM) --define="_sourcedir `pwd`" --define="_rpmdir `pwd`/$(RPMDIR)/RPMS" --define="_builddir `pwd`/$(RPMDIR)/BUILD" --nodeps -bb ImageMagick.spec
cristy3ed852e2009-09-05 21:47:34 +0000350 @echo ==============================================================
351 @echo $(DIST_ARCHIVE_RPM) is ready for distribution.
352 @echo ==============================================================
353
354else
355DIST_ARCHIVE_RPM=
356endif # RPM_DELEGATE
357
358#
359# Build a validated snapshot release and move to the snapshots directory.
360#
361snapshot: distcheck
362 $(MAKE) $(DIST_ARCHIVE_SRPM)
363 $(MAKE) $(DIST_WINDOWS_SRC_ZIP)
364 $(MAKE) $(DIST_WINDOWS_SRC_7ZIP)
cristy72ab5002011-07-07 18:33:45 +0000365 mv $(DIST_ARCHIVES) $(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) $(DIST_ARCHIVE_SRPM) /var/ftp/pub/ImageMagick/alpha/