1# Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization 2# 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 20topincludedir = @includedir@/MagickCore 21 22AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) 23 24ACLOCAL_AMFLAGS = -I m4 25 26MODULECOMMONFLAGS = -no-undefined -export-symbols-regex ".*" -shared -module -avoid-version 27MODULECOMMONCPPFLAGS = $(AM_CPPFLAGS) 28 29# Options to pass when running configure in the distcheck target. 30# 31# We want to preserve user-provided option variables so the same 32# compiler, headers, and libraries are used as for a normal build. 33DISTCHECK_CONFIGURE_FLAGS=$(DISTCHECK_CONFIG_FLAGS) 34 35DISTCLEANFILES = _configs.sed MagickCore/magick-baseconfig.h 36 37## Make sure these will be cleaned even when they're not built by default. 38CLEANFILES = \ 39 $(MAGICKWAND_CLEANFILES) \ 40 $(MAGICKPP_CLEANFILES) \ 41 $(UTILITIES_CLEANFILES) \ 42 $(TESTS_CLEANFILES) 43 44bin_PROGRAMS = \ 45 $(UTILITIES_PGMS) 46 47# Binary scripts 48bin_SCRIPTS = \ 49 $(MAGICKCORE_BIN_SCRPTS) \ 50 $(MAGICKWAND_BIN_SCRPTS) \ 51 $(MAGICKPP_SCRPTS) 52 53include_HEADERS = 54 55# Headers which are not installed but which are distributed 56noinst_HEADERS = \ 57 $(MAGICKCORE_NOINST_HDRS) 58 59if WIN32_NATIVE_BUILD 60SRCDIR='$(shell @WinPathScript@ $(srcdir)/)' 61else 62SRCDIR="$(srcdir)/" 63endif 64 65# Tests with .tap extensions use the TAP protocol and TAP driver 66LOG_COMPILER = $(SHELL) 67 68SH_LOG_COMPILER = $(LOG_COMPILER) 69TAP_LOG_COMPILER = $(LOG_COMPILER) 70 71# Test extensions 72TEST_EXTENSIONS = .sh .tap 73 74TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ 75 $(top_srcdir)/config/tap-driver.sh 76 77# Environment parameters to be used during tests 78TESTS_ENVIRONMENT = \ 79 MAKE="$(MAKE)" \ 80 MAKEFLAGS="$(MAKEFLAGS)" \ 81 MEMCHECK="$(MEMCHECK)" 82 83# Tests to run 84TESTS = \ 85 $(TESTS_TESTS) \ 86 $(MAGICKPP_TESTS) \ 87 $(MAGICKWAND_TESTS) \ 88 $(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 NEWS.txt \ 108 Platforms.txt \ 109 README.txt \ 110 index.html \ 111 version.sh \ 112 winpath.sh 113 114# Additional files to distribute 115EXTRA_DIST = \ 116 $(TOP_EXTRA_DIST) \ 117 $(CONFIG_EXTRA_DIST) \ 118 $(MAGICKCORE_EXTRA_DIST) \ 119 $(MAGICKWAND_EXTRA_DIST) \ 120 $(MAGICKPP_EXTRA_DIST) \ 121 $(UTILITIES_EXTRA_DIST) \ 122 $(TESTS_EXTRA_DIST) 123 124lib_LTLIBRARIES = $(MAGICKCORE_LIBS) $(MAGICKWAND_LIBS) $(MAGICKPP_LIBS) 125AM_LDFLAGS = 126noinst_LTLIBRARIES = 127EXTRA_LTLIBRARIES = 128BUILT_SOURCES = 129MOSTLYCLEANFILES = 130 131check_PROGRAMS = \ 132 $(TESTS_CHECK_PGRMS) \ 133 $(MAGICKPP_CHECK_PGRMS) \ 134 $(MAGICKWAND_CHECK_PGRMS) 135 136include m4/Makefile.am 137include config/Makefile.am 138include coders/Makefile.am 139include MagickCore/Makefile.am 140include MagickWand/Makefile.am 141include Magick++/Makefile.am 142include filters/Makefile.am 143include utilities/Makefile.am 144include tests/Makefile.am 145include PerlMagick/Makefile.am 146 147# Pkgconfig directory 148pkgconfigdir = $(libdir)/pkgconfig 149 150# Files to install in Pkgconfig directory 151pkgconfig_DATA = \ 152 $(MAGICKCORE_PKGCONFIG) \ 153 $(MAGICKWAND_PKGCONFIG) \ 154 $(MAGICKPP_PKGCONFIG) 155 156# create a copy for pc file (ideally the non abi should be symlinked) 157%-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@.pc: %.pc 158 cp -f $^ $@ 159 160# Architecture independent data files installed in the package's data directory 161docdir = $(DOCUMENTATION_PATH) 162 163# Manual pages to install 164if INSTALL_DOC# 165man_MANS = \ 166 $(MAGICKCORE_MANS) \ 167 $(MAGICKWAND_MANS) \ 168 $(MAGICKPP_MANS) \ 169 $(UTILITIES_MANS) 170 171doc_DATA = \ 172 LICENSE \ 173 ChangeLog \ 174 NEWS.txt 175endif 176 177if MAINTAINER_MODE 178MAINTAINER_TARGETS = \ 179 magick-version \ 180 ImageMagick.spec \ 181 $(PERLMAGICK_MAINTAINER_TARGETS) 182endif 183 184all-local: $(MAGICKPP_LOCAL_TARGETS) $(PERLMAGICK_ALL_LOCAL_TARGETS) $(MAINTAINER_TARGETS) 185 186install-exec-local: $(PERLMAGICK_INSTALL_EXEC_LOCAL_TARGETS) \ 187 $(UTILITIES_INSTALL_EXEC_LOCAL_TARGETS) 188 189install-data-local: $(PERLMAGICK_INSTALL_DATA_LOCAL_TARGETS) $(HTML_INSTALL_DATA_TARGETS) 190 191uninstall-local: $(PERLMAGICK_UNINSTALL_LOCAL_TARGETS) $(HTML_UNINSTALL_DATA_TARGETS) $(UTILITIES_UNINSTALL_LOCAL_TARGETS) 192 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 201# drd: valgrind's newer thread error detector 202drd: 203 $(MAKE) MEMCHECK='valgrind --tool=drd --check-stack-var=yes --var-info=yes \ 204 --quiet $(VALGRIND_EXTRA_OPTS)' check 205 206# helgrind: valgrind's older thread error detector 207helgrind: 208 $(MAKE) MEMCHECK='valgrind --tool=helgrind --error-exitcode=2 --quiet \ 209 $(VALGRIND_EXTRA_OPTS)' check 210 211# memcheck: valgrind's memory access checker 212memcheck: 213 $(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 216 217# ptrcheck: valgrind's experimental pointer checking tool. 218ptrcheck: 219 $(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check 220 221# Non-Automake subdirectories to distribute 222DISTDIRS = images 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 '(~$$)|(/.git)|(/\.#)|(/\.deps)|(/\.git)' \ 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) 241DOCDIRSDOXYGEN = www/api/MagickCore www/api/MagickWand 242DOCDIRSMANUAL = images images/patterns www www/css www/js www/api www/source www/Magick++ 243DOCDIRS= $(DOCDIRSMANUAL) $(DOCDIRSDOXYGEN) 244 245if INSTALL_DOC 246HTML_INSTALL_DATA_TARGETS = install-data-html 247endif 248 249install-data-html: 250 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir) 251 $(INSTALL_DATA) $(srcdir)/index.html $(DESTDIR)$(pkgdocdir) 252 @for dir in $(DOCDIRS) ; do \ 253 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ 254 if test -d $(builddir)/$$dir ; then \ 255 docsrcdir=$(builddir)/$$dir; \ 256 else \ 257 docsrcdir=$(srcdir)/$$dir; \ 258 fi; \ 259 for file in $$docsrcdir/*.* ; do \ 260 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \ 261 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \ 262 done ; \ 263 done 264 265# Uninstall HTML files 266HTML_UNINSTALL_DATA_TARGETS = uninstall-data-html 267uninstall-data-html: 268 rm -f $(DESTDIR)$(pkgdocdir)/index.html 269 for dir in $(DOCDIRS) ; do \ 270 rm -f -r $(DESTDIR)$(pkgdocdir)/$$dir ; \ 271 done 272 273# Ensure that version.h at $(srcdir)/MagickCore/version.h is kept up to date. 274magick-version: MagickCore/version.h 275 @if test -f "$(srcdir)/VisualMagick/installer/inc/version.isx.in" ; then \ 276 ./config.status --file="$(srcdir)/../VisualMagick/installer/inc/version.isx" 2> /dev/null ; \ 277 fi 278 @if test -n "$(VPATH)" ; then \ 279 cmp MagickCore/version.h $(srcdir)/MagickCore/version.h > /dev/null ; \ 280 if test $$? -eq 1 ; then \ 281 echo "Updating $(srcdir)/MagickCore/version.h ..."; \ 282 cp MagickCore/version.h $(srcdir)/MagickCore/version.h ; \ 283 fi ; \ 284 fi ; \ 285 touch magick-version 286 287${srcdir}/configure: ${srcdir}/version.sh 288 289# Automagically reconfigure libtool 290LIBTOOL_DEPS = @LIBTOOL_DEPS@ 291libtool: $(LIBTOOL_DEPS) 292 $(SHELL) ./config.status --recheck 293 294# Format C API documentation 295html-local: 296# copy static file 297 for dir in $(DOCDIRSMANUAL) ; do \ 298 $(MKDIR_P) $(top_builddir)/$$dir ;\ 299 for file in $$dir/*.* ; do \ 300 if ! test -f $(top_builddir)/$$file; then \ 301 cp -p -f $(top_srcdir)/$$file $(top_builddir)/$$dir ; \ 302 fi; \ 303 done ; \ 304 done; 305# remove old doxygen files 306 for dir in $(DOCDIRDOXYGEN) ; do \ 307 rm -rf $$dir || true; \ 308 done; 309# make doxygen doc 310 $(MKDIR_P) $(top_builddir)/www/api 311 cd config && doxygen MagickCore.dox 312 cd config && doxygen MagickWand.dox 313 cd config && doxygen Magick++.dox 314 315# 316# Build Windows source Zip and 7Zip balls 317# 318if ZIP_DELEGATE 319DIST_WINDOWS_SRC_ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.zip 320else 321DIST_WINDOWS_SRC_ZIP= 322endif 323if P7ZIP_DELEGATE 324DIST_WINDOWS_SRC_7ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.7z 325else 326DIST_WINDOWS_SRC_7ZIP= 327endif 328$(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) windows-dist: 329 if test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; then \ 330 chmod -R u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \ 331 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \ 332 fi 333 git clone git@git.imagemagick.org:repos/ImageMagick.git $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) 334if ZIP_DELEGATE 335 rm -f $(DIST_WINDOWS_SRC_ZIP) 336 $(ZIP) -r -9 -q $(DIST_WINDOWS_SRC_ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) 337endif # ZIP_DELEGATE 338if P7ZIP_DELEGATE 339 rm -f $(DIST_WINDOWS_SRC_7ZIP) 340 $(P7ZIP) a -t7z -mx=9 $(DIST_WINDOWS_SRC_7ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) 341 chmod 644 $(DIST_WINDOWS_SRC_7ZIP) 342endif # P7ZIP_DELEGATE 343 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) 344 345# 346# RPM build support 347# 348if RPM_DELEGATE 349 350DIST_ARCHIVE_SRPM=$(distdir)-1.src.rpm 351.PHONY: srpm 352$(DIST_ARCHIVE_SRPM) srpm: dist-bzip2 353 rm -f $(DIST_ARCHIVE_SRPM) 354 $(RPM) --define="_sourcedir `pwd`" --define="_srcrpmdir `pwd`" --nodeps --bs ImageMagick.spec 355 @echo ============================================================== 356 @echo $(DIST_ARCHIVE_SRPM) is ready for distribution. 357 @echo ============================================================== 358 359RPMDIR=rpmbuild 360RPMARCH=$(MAGICK_TARGET_CPU) 361 362DIST_ARCHIVE_RPM= \ 363 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \ 364 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \ 365 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \ 366 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \ 367 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-perl-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm 368 369.PHONY: rpm 370rpm: dist 371 rm -rf $(RPMDIR) 372 $(MKDIR_P) $(RPMDIR) 373 $(MKDIR_P) $(RPMDIR)/BUILD 374 $(MKDIR_P) $(RPMDIR)/RPMS 375 $(RPM) --define="_sourcedir `pwd`" --define="_rpmdir `pwd`/$(RPMDIR)/RPMS" --define="_builddir `pwd`/$(RPMDIR)/BUILD" --nodeps -bb ImageMagick.spec 376 @echo ============================================================== 377 @echo $(DIST_ARCHIVE_RPM) is ready for distribution. 378 @echo ============================================================== 379 380else 381DIST_ARCHIVE_RPM= 382endif # RPM_DELEGATE 383 384# 385# Build a validated snapshot release and move to the snapshots directory. 386# 387snapshot: distcheck 388 $(MAKE) $(DIST_ARCHIVE_SRPM) 389 $(MAKE) $(DIST_WINDOWS_SRC_ZIP) 390 $(MAKE) $(DIST_WINDOWS_SRC_7ZIP) 391 mv $(DIST_ARCHIVES) $(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) $(DIST_ARCHIVE_SRPM) /var/ftp/pub/ImageMagick/alpha/ 392