blob: 857f28fd8d458ff357b0a33a65dc35e84b7bc79b [file] [log] [blame]
cristy1454be72011-12-19 01:52:48 +00001# Copyright 1999-2012 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
26# Options to pass when running configure in the distcheck target.
27#
28# We want to preserve user-provided option variables so the same
29# compiler, headers, and libraries are used as for a normal build.
30DISTCHECK_CONFIGURE_FLAGS=$(DISTCHECK_CONFIG_FLAGS)
31
cristy4c08aed2011-07-01 19:47:50 +000032DISTCLEANFILES = _configs.sed MagickCore/magick-config.h
cristy50620792010-02-09 00:42:32 +000033
cristy3ed852e2009-09-05 21:47:34 +000034## Make sure these will be cleaned even when they're not built by default.
35CLEANFILES = \
36 $(LTDL_CLEANFILES) \
cristy4c08aed2011-07-01 19:47:50 +000037 $(MAGICKWAND_CLEANFILES) \
cristy3ed852e2009-09-05 21:47:34 +000038 $(MAGICKPP_CLEANFILES) \
39 $(UTILITIES_CLEANFILES) \
cristy52cf7f12010-02-07 18:07:56 +000040 $(TESTS_CLEANFILES)
cristy3ed852e2009-09-05 21:47:34 +000041
42bin_PROGRAMS = \
43 $(UTILITIES_PGMS)
44
45# Binary scripts
46bin_SCRIPTS = \
cristy4c08aed2011-07-01 19:47:50 +000047 $(MAGICKCORE_BIN_SCRPTS) \
48 $(MAGICKWAND_BIN_SCRPTS) \
cristy3ed852e2009-09-05 21:47:34 +000049 $(MAGICKPP_SCRPTS)
50
51include_HEADERS = \
52 $(LTDL_INSTALLHEADERS)
53
54# Headers which are not installed but which are distributed
55noinst_HEADERS = \
56 $(LIBLTDL_NOINST_HDRS) \
cristy4c08aed2011-07-01 19:47:50 +000057 $(MAGICKCORE_NOINST_HDRS)
cristy3ed852e2009-09-05 21:47:34 +000058
59if WIN32_NATIVE_BUILD
60SRCDIR='$(shell @WinPathScript@ $(srcdir)/)'
61else
62SRCDIR="$(srcdir)/"
63endif
64
cristybc556452012-08-17 19:44:03 +000065# Tests with .tap extensions use the TAP protocol and TAP driver
cristy9e524dc2012-08-21 00:07:27 +000066LOG_COMPILER = $(SHELL)
67
68SH_LOG_COMPILER = $(LOG_COMPILER)
69TAP_LOG_COMPILER = $(LOG_COMPILER)
70
71# Test extensions
72TEST_EXTENSIONS = .sh .tap
73
cristybc556452012-08-17 19:44:03 +000074TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
75 $(top_srcdir)/config/tap-driver.sh
76
cristy3ed852e2009-09-05 21:47:34 +000077# Environment parameters to be used during tests
78TESTS_ENVIRONMENT = \
cristy3ed852e2009-09-05 21:47:34 +000079 MAKE="$(MAKE)" \
80 MAKEFLAGS="$(MAKEFLAGS)" \
cristy0cf6da52012-08-25 00:35:24 +000081 MEMCHECK="$(MEMCHECK)"
cristy3ed852e2009-09-05 21:47:34 +000082
cristy3ed852e2009-09-05 21:47:34 +000083# Tests to run
84TESTS = \
cristy3ed852e2009-09-05 21:47:34 +000085 $(TESTS_TESTS) \
86 $(MAGICKPP_TESTS) \
cristy4c08aed2011-07-01 19:47:50 +000087 $(MAGICKWAND_TESTS) \
cristy3ed852e2009-09-05 21:47:34 +000088 $(UTILITIES_TESTS)
89
90# Tests which are expected to fail
91XFAIL_TESTS = \
92 $(TESTS_XFAIL_TESTS) \
93 $(UTILITIES_XFAIL_TESTS)
94
95TOP_EXTRA_DIST = \
96 AUTHORS.txt \
97 ChangeLog \
98 LICENSE \
99 QuickStart.txt \
100 NOTICE \
101 Install-mac.txt \
102 Install-unix.txt \
103 Install-vms.txt \
104 Install-windows.txt \
105 magick.sh.in \
106 Magickshr.opt \
107 Make.com \
108 NEWS.txt \
109 Platforms.txt \
110 README.txt \
111 index.html \
112 version.sh \
113 winpath.sh
114
115# Additional files to distribute
116EXTRA_DIST = \
117 $(TOP_EXTRA_DIST) \
118 $(CONFIG_EXTRA_DIST) \
cristy4c08aed2011-07-01 19:47:50 +0000119 $(MAGICKCORE_EXTRA_DIST) \
120 $(MAGICKWAND_EXTRA_DIST) \
cristy3ed852e2009-09-05 21:47:34 +0000121 $(MAGICKPP_EXTRA_DIST) \
122 $(UTILITIES_EXTRA_DIST) \
123 $(TESTS_EXTRA_DIST)
124
125lib_LTLIBRARIES = $(MAGICKCORE_LIBS) $(MAGICKWAND_LIBS) $(MAGICKPP_LIBS)
126AM_LDFLAGS =
127noinst_LTLIBRARIES =
128EXTRA_LTLIBRARIES =
129BUILT_SOURCES =
130MOSTLYCLEANFILES =
131
132check_PROGRAMS = \
133 $(TESTS_CHECK_PGRMS) \
134 $(MAGICKPP_CHECK_PGRMS) \
cristy4c08aed2011-07-01 19:47:50 +0000135 $(MAGICKWAND_CHECK_PGRMS)
cristy3ed852e2009-09-05 21:47:34 +0000136
137include m4/Makefile.am
138include config/Makefile.am
139include ltdl/Makefile.inc
140include coders/Makefile.am
cristy4c08aed2011-07-01 19:47:50 +0000141include MagickCore/Makefile.am
142include MagickWand/Makefile.am
cristy3ed852e2009-09-05 21:47:34 +0000143include Magick++/Makefile.am
cristy4c08aed2011-07-01 19:47:50 +0000144include filters/Makefile.am
cristy3ed852e2009-09-05 21:47:34 +0000145include utilities/Makefile.am
146include tests/Makefile.am
147include PerlMagick/Makefile.am
148
149# Pkgconfig directory
150pkgconfigdir = $(libdir)/pkgconfig
151
152# Files to install in Pkgconfig directory
153pkgconfig_DATA = \
cristy4c08aed2011-07-01 19:47:50 +0000154 $(MAGICKCORE_PKGCONFIG) \
155 $(MAGICKWAND_PKGCONFIG) \
cristy3ed852e2009-09-05 21:47:34 +0000156 $(MAGICKPP_PKGCONFIG)
157
158# Manual pages to install
159man_MANS = \
cristy4c08aed2011-07-01 19:47:50 +0000160 $(MAGICKCORE_MANS) \
161 $(MAGICKWAND_MANS) \
cristy3ed852e2009-09-05 21:47:34 +0000162 $(MAGICKPP_MANS) \
163 $(UTILITIES_MANS)
164
165# Architecture independent data files installed in the package's data directory
cristy986d3c22011-03-30 14:11:37 +0000166docdir = $(DOCUMENTATION_PATH)
cristy3ed852e2009-09-05 21:47:34 +0000167doc_DATA = \
168 LICENSE \
169 ChangeLog \
170 NEWS.txt
171
172if MAINTAINER_MODE
cristye6922d42010-03-04 01:56:45 +0000173MAINTAINER_TARGETS = \
cristy999b6472010-04-15 01:18:53 +0000174 magick-version \
175 ImageMagick.spec \
176 $(PERLMAGICK_MAINTAINER_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000177endif
178
179all-local: $(MAGICKPP_LOCAL_TARGETS) $(PERLMAGICK_ALL_LOCAL_TARGETS) $(MAINTAINER_TARGETS)
180
cristy9ebfdfb2012-03-26 12:55:00 +0000181install-exec-local: $(PERLMAGICK_INSTALL_EXEC_LOCAL_TARGETS) \
182 $(UTILITIES_INSTALL_EXEC_LOCAL_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000183
cristy9ebfdfb2012-03-26 12:55:00 +0000184install-data-local: $(MAGICK_INSTALL_DATA_LOCAL_TARGETS) \
185 $(PERLMAGICK_INSTALL_DATA_LOCAL_TARGETS) \
186 $(HTML_INSTALL_DATA_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000187
cristy9ebfdfb2012-03-26 12:55:00 +0000188uninstall-local: $(MAGICK_UNINSTALL_LOCAL_TARGETS) \
189 $(PERLMAGICK_UNINSTALL_LOCAL_TARGETS) \
190 $(HTML_UNINSTALL_DATA_TARGETS) \
191 $(UTILITIES_UNINSTALL_LOCAL_TARGETS)
cristy3ed852e2009-09-05 21:47:34 +0000192
193clean-local: $(PERLMAGICK_CLEAN_LOCAL_TARGETS)
194
195distclean-local: $(PERLMAGICK_DISTCLEAN_LOCAL_TARGETS)
196
197maintainer-clean-local: $(PERLMAGICK_MAINTAINER_CLEAN_LOCAL_TARGETS)
198
199check-local: $(PERLMAGICK_CHECK_LOCAL_TARGETS)
200
cristy2d9c0312010-04-17 23:58:07 +0000201# drd: valgrind's newer thread error detector
cristy3ed852e2009-09-05 21:47:34 +0000202drd:
cristy9c7e2af2010-05-23 23:13:27 +0000203 $(MAKE) MEMCHECK='valgrind --tool=drd --check-stack-var=yes --var-info=yes \
204 --quiet $(VALGRIND_EXTRA_OPTS)' check
205
cristy2d9c0312010-04-17 23:58:07 +0000206# helgrind: valgrind's older thread error detector
cristy3ed852e2009-09-05 21:47:34 +0000207helgrind:
cristy9c7e2af2010-05-23 23:13:27 +0000208 $(MAKE) MEMCHECK='valgrind --tool=helgrind --error-exitcode=2 --quiet \
209 $(VALGRIND_EXTRA_OPTS)' check
cristy3ed852e2009-09-05 21:47:34 +0000210
cristy2d9c0312010-04-17 23:58:07 +0000211# memcheck: valgrind's memory access checker
cristy3ed852e2009-09-05 21:47:34 +0000212memcheck:
cristy9c7e2af2010-05-23 23:13:27 +0000213 $(MAKE) MEMCHECK='valgrind --tool=memcheck --leak-check=full --read-var-info=yes \
214 --error-exitcode=2 --track-origins=yes --num-callers=12 \
215 --quiet $(VALGRIND_EXTRA_OPTS)' check
cristy3ed852e2009-09-05 21:47:34 +0000216
cristy2d9c0312010-04-17 23:58:07 +0000217# ptrcheck: valgrind's experimental pointer checking tool.
cristy3ed852e2009-09-05 21:47:34 +0000218ptrcheck:
cristy9c7e2af2010-05-23 23:13:27 +0000219 $(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check
cristy3ed852e2009-09-05 21:47:34 +0000220
221# Non-Automake subdirectories to distribute
222DISTDIRS = images scenes scripts www PerlMagick
223dist-hook:
224 ( \
225 builddir=`pwd` ; \
226 cd $(srcdir) && \
227 ( \
228 for dir in $(DISTDIRS) ; do \
229 find $$dir -depth -print | egrep -v '(~$$)|(/CVS)|(/\.#)|(/\.deps)|(/\.svn)' \
230 | cpio -pdum $$builddir/$(distdir) 2> /dev/null ; \
231 done \
232 ) \
233 )
234
235#
236# Additional install rules
237#
238
239# Install HTML files
240pkgdocdir = $(DOCUMENTATION_PATH)
cristy0e496242011-03-19 13:00:57 +0000241DOCDIRS = images images/patterns www www/api www/source www/api/MagickCore www/api/MagickWand www/Magick++
cristy3ed852e2009-09-05 21:47:34 +0000242HTML_INSTALL_DATA_TARGETS = install-data-html
243install-data-html:
244 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
245 $(INSTALL_DATA) $(srcdir)/index.html $(DESTDIR)$(pkgdocdir)
246 @for dir in $(DOCDIRS) ; do \
247 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
248 for file in $(srcdir)/$$dir/*.* ; do \
249 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \
250 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \
251 done ; \
252 done
253
254# Uninstall HTML files
255HTML_UNINSTALL_DATA_TARGETS = uninstall-data-html
256uninstall-data-html:
257 rm -f $(DESTDIR)$(pkgdocdir)/index.html
258 for dir in $(DOCDIRS) ; do \
259 rm -f -r $(DESTDIR)$(pkgdocdir)/$$dir ; \
260 done
261
cristy4c08aed2011-07-01 19:47:50 +0000262# Ensure that version.h at $(srcdir)/MagickCore/version.h is kept up to date.
263magick-version: MagickCore/version.h
cristy3ed852e2009-09-05 21:47:34 +0000264 @if test -f "$(srcdir)/VisualMagick/installer/inc/version.isx.in" ; then \
265 ./config.status --file="$(srcdir)/../VisualMagick/installer/inc/version.isx" 2> /dev/null ; \
266 fi
267 @if test -n "$(VPATH)" ; then \
cristy4c08aed2011-07-01 19:47:50 +0000268 cmp MagickCore/version.h $(srcdir)/MagickCore/version.h > /dev/null ; \
cristy3ed852e2009-09-05 21:47:34 +0000269 if test $$? -eq 1 ; then \
cristy4c08aed2011-07-01 19:47:50 +0000270 echo "Updating $(srcdir)/MagickCore/version.h ..."; \
271 cp MagickCore/version.h $(srcdir)/MagickCore/version.h ; \
cristy3ed852e2009-09-05 21:47:34 +0000272 fi ; \
273 fi ; \
274 touch magick-version
275
276${srcdir}/configure: ${srcdir}/version.sh
277
278# Automagically reconfigure libtool
279LIBTOOL_DEPS = @LIBTOOL_DEPS@
280libtool: $(LIBTOOL_DEPS)
281 $(SHELL) ./config.status --recheck
282
283# Format C API documentation
284html:
285 doxygen config/MagickCore.dox
286 doxygen config/MagickWand.dox
287
288#
289# Build Windows source Zip and 7Zip balls
290#
291if ZIP_DELEGATE
cristy15a88782010-01-31 23:24:49 +0000292DIST_WINDOWS_SRC_ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.zip
cristy3ed852e2009-09-05 21:47:34 +0000293else
294DIST_WINDOWS_SRC_ZIP=
295endif
296if P7ZIP_DELEGATE
cristy15a88782010-01-31 23:24:49 +0000297DIST_WINDOWS_SRC_7ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.7z
cristy3ed852e2009-09-05 21:47:34 +0000298else
299DIST_WINDOWS_SRC_7ZIP=
300endif
301$(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) windows-dist:
cristy15a88782010-01-31 23:24:49 +0000302 if test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; then \
303 chmod -R u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
304 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
cristy3ed852e2009-09-05 21:47:34 +0000305 fi
cristy15a88782010-01-31 23:24:49 +0000306 svn export https://subversion.imagemagick.org/subversion/ImageMagick-Windows/trunk $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000307if ZIP_DELEGATE
308 rm -f $(DIST_WINDOWS_SRC_ZIP)
cristy15a88782010-01-31 23:24:49 +0000309 $(ZIP) -r -9 -q $(DIST_WINDOWS_SRC_ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000310endif # ZIP_DELEGATE
311if P7ZIP_DELEGATE
312 rm -f $(DIST_WINDOWS_SRC_7ZIP)
cristy15a88782010-01-31 23:24:49 +0000313 $(P7ZIP) a -t7z -mx=9 $(DIST_WINDOWS_SRC_7ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000314 chmod 644 $(DIST_WINDOWS_SRC_7ZIP)
315endif # P7ZIP_DELEGATE
cristy15a88782010-01-31 23:24:49 +0000316 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy3ed852e2009-09-05 21:47:34 +0000317
318#
319# RPM build support
320#
321if RPM_DELEGATE
322
cristy2d9c0312010-04-17 23:58:07 +0000323DIST_ARCHIVE_SRPM=$(distdir)-1.src.rpm
cristy3ed852e2009-09-05 21:47:34 +0000324.PHONY: srpm
anthony1e3d36d2012-02-23 12:29:17 +0000325$(DIST_ARCHIVE_SRPM) srpm: dist-bzip2
cristy3ed852e2009-09-05 21:47:34 +0000326 rm -f $(DIST_ARCHIVE_SRPM)
327 $(RPM) --define="_sourcedir `pwd`" --define="_srcrpmdir `pwd`" --nodeps --bs ImageMagick.spec
328 @echo ==============================================================
329 @echo $(DIST_ARCHIVE_SRPM) is ready for distribution.
330 @echo ==============================================================
331
cristy3225a072010-04-17 01:47:28 +0000332RPMDIR=rpmbuild
333RPMARCH=$(MAGICK_TARGET_CPU)
cristy3ed852e2009-09-05 21:47:34 +0000334
335DIST_ARCHIVE_RPM= \
cristy15a88782010-01-31 23:24:49 +0000336 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
337 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
338 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
339 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
340 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-perl-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm
cristy3ed852e2009-09-05 21:47:34 +0000341
342.PHONY: rpm
cristy2d9c0312010-04-17 23:58:07 +0000343rpm: dist
cristy3ed852e2009-09-05 21:47:34 +0000344 rm -rf $(RPMDIR)
cristy78cd7652010-04-17 22:50:03 +0000345 $(MKDIR_P) $(RPMDIR)
346 $(MKDIR_P) $(RPMDIR)/BUILD
347 $(MKDIR_P) $(RPMDIR)/RPMS
cristy3ed852e2009-09-05 21:47:34 +0000348 $(RPM) --define="_sourcedir `pwd`" --define="_rpmdir `pwd`/$(RPMDIR)/RPMS" --define="_builddir `pwd`/$(RPMDIR)/BUILD" --nodeps -bb ImageMagick.spec
cristy3ed852e2009-09-05 21:47:34 +0000349 @echo ==============================================================
350 @echo $(DIST_ARCHIVE_RPM) is ready for distribution.
351 @echo ==============================================================
352
353else
354DIST_ARCHIVE_RPM=
355endif # RPM_DELEGATE
356
357#
358# Build a validated snapshot release and move to the snapshots directory.
359#
360snapshot: distcheck
361 $(MAKE) $(DIST_ARCHIVE_SRPM)
362 $(MAKE) $(DIST_WINDOWS_SRC_ZIP)
363 $(MAKE) $(DIST_WINDOWS_SRC_7ZIP)
cristy72ab5002011-07-07 18:33:45 +0000364 mv $(DIST_ARCHIVES) $(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) $(DIST_ARCHIVE_SRPM) /var/ftp/pub/ImageMagick/alpha/