1# Copyright 1999-2021 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# https://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 $(MAGICKWAND_NOINST_HDRS) \ 59 $(CODERS_NOINST_HDRS) 60 61if WIN32_NATIVE_BUILD 62SRCDIR='$(shell @WinPathScript@ $(srcdir)/)' 63else 64SRCDIR="$(srcdir)/" 65endif 66 67# Tests with .tap extensions use the TAP protocol and TAP driver 68LOG_COMPILER = $(SHELL) 69 70SH_LOG_COMPILER = $(LOG_COMPILER) 71TAP_LOG_COMPILER = $(LOG_COMPILER) 72 73# Test extensions 74TEST_EXTENSIONS = .sh .tap 75 76TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ 77 $(top_srcdir)/config/tap-driver.sh 78 79# Environment parameters to be used during tests 80TESTS_ENVIRONMENT = \ 81 MAKE="$(MAKE)" \ 82 MAKEFLAGS="$(MAKEFLAGS)" \ 83 MEMCHECK="$(MEMCHECK)" 84 85# Tests to run 86TESTS = \ 87 $(TESTS_TESTS) \ 88 $(MAGICKPP_TESTS) \ 89 $(MAGICKWAND_TESTS) \ 90 $(UTILITIES_TESTS) 91 92# Tests which are expected to fail 93XFAIL_TESTS = \ 94 $(TESTS_XFAIL_TESTS) \ 95 $(UTILITIES_XFAIL_TESTS) 96 97TOP_EXTRA_DIST = \ 98 AUTHORS.txt \ 99 ChangeLog \ 100 LICENSE \ 101 QuickStart.txt \ 102 NOTICE \ 103 Install-mac.txt \ 104 Install-unix.txt \ 105 Install-vms.txt \ 106 Install-windows.txt \ 107 magick.sh.in \ 108 Magickshr.opt \ 109 NEWS.txt \ 110 README.txt \ 111 index.html \ 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) 241DOCDIRS = images images/patterns www www/assets www/api www/source www/Magick++ 242 243if INSTALL_DOC 244HTML_INSTALL_DATA_TARGETS = install-data-html 245endif 246 247install-data-html: 248 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir) 249 $(INSTALL_DATA) $(srcdir)/index.html $(DESTDIR)$(pkgdocdir) 250 @for dir in $(DOCDIRS) ; do \ 251 $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \ 252 if test -d $(builddir)/$$dir ; then \ 253 docsrcdir=$(builddir)/$$dir; \ 254 else \ 255 docsrcdir=$(srcdir)/$$dir; \ 256 fi; \ 257 for file in $$docsrcdir/*.* ; do \ 258 echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \ 259 $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \ 260 done ; \ 261 done 262 263# Uninstall HTML files 264HTML_UNINSTALL_DATA_TARGETS = uninstall-data-html 265uninstall-data-html: 266 rm -f $(DESTDIR)$(pkgdocdir)/index.html 267 for dir in $(DOCDIRS) ; do \ 268 rm -f -r $(DESTDIR)$(pkgdocdir)/$$dir ; \ 269 done 270 271# Ensure that version.h at $(srcdir)/MagickCore/version.h is kept up to date. 272magick-version: MagickCore/version.h 273 @if test -f "$(srcdir)/VisualMagick/installer/inc/version.isx.in" ; then \ 274 ./config.status --file="$(srcdir)/../VisualMagick/installer/inc/version.isx" 2> /dev/null ; \ 275 fi 276 @if test -n "$(VPATH)" ; then \ 277 cmp MagickCore/version.h $(srcdir)/MagickCore/version.h > /dev/null ; \ 278 if test $$? -eq 1 ; then \ 279 echo "Updating $(srcdir)/MagickCore/version.h ..."; \ 280 cp MagickCore/version.h $(srcdir)/MagickCore/version.h ; \ 281 fi ; \ 282 fi ; \ 283 touch magick-version 284 285MagickCore/version.h: $(top_srcdir)/ChangeLog $(top_srcdir)/m4/version.m4 286 287# Automagically reconfigure libtool 288LIBTOOL_DEPS = @LIBTOOL_DEPS@ 289libtool: $(LIBTOOL_DEPS) 290 $(SHELL) ./config.status --recheck 291 292# Format C API documentation 293html-local: 294# copy static file 295 for dir in $(DOCDIRSMANUAL) ; do \ 296 $(mkinstalldirs) $(top_builddir)/$$dir ;\ 297 for file in $$dir/*.* ; do \ 298 if ! test -f $(top_builddir)/$$file; then \ 299 cp -p -f $(top_srcdir)/$$file $(top_builddir)/$$dir ; \ 300 fi; \ 301 done ; \ 302 done; 303# remove old doxygen files 304 for dir in $(DOCDIRDOXYGEN) ; do \ 305 rm -rf $$dir || true; \ 306 done; 307# make doxygen doc 308 $(mkinstalldirs) $(top_builddir)/www/api 309 cd config && doxygen MagickCore.dox 310 cd config && doxygen MagickWand.dox 311 cd config && doxygen Magick++.dox 312 313# 314# Build Windows source Zip and 7Zip balls 315# 316if ZIP_DELEGATE 317DIST_WINDOWS_SRC_ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)-windows.zip 318else 319DIST_WINDOWS_SRC_ZIP= 320endif 321if P7ZIP_DELEGATE 322DIST_WINDOWS_SRC_7ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)-windows.7z 323else 324DIST_WINDOWS_SRC_7ZIP= 325endif 326$(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) windows-dist: 327 if test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION) ; then \ 328 chmod -R u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION) ; \ 329 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION) ; \ 330 fi 331 git clone -b main https://github.com/ImageMagick/ImageMagick.git $(PACKAGE_NAME)-$(PACKAGE_VERSION) 332if ZIP_DELEGATE 333 rm -f $(DIST_WINDOWS_SRC_ZIP) 334 $(ZIP) -r -9 -q $(DIST_WINDOWS_SRC_ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION) 335endif # ZIP_DELEGATE 336if P7ZIP_DELEGATE 337 rm -f $(DIST_WINDOWS_SRC_7ZIP) 338 $(P7ZIP) a -t7z -mx=9 $(DIST_WINDOWS_SRC_7ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION) 339 chmod 644 $(DIST_WINDOWS_SRC_7ZIP) 340endif # P7ZIP_DELEGATE 341 rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION) 342 343# 344# RPM build support 345# 346if RPM_DELEGATE 347 348DIST_ARCHIVE_SRPM=$(distdir).src.rpm 349.PHONY: srpm 350$(DIST_ARCHIVE_SRPM) srpm: dist-bzip2 351 rm -f $(DIST_ARCHIVE_SRPM) 352 $(RPM) --define="_sourcedir `pwd`" --define="_srcrpmdir `pwd`" --nodeps --bs ImageMagick.spec 353 @echo ============================================================== 354 @echo $(DIST_ARCHIVE_SRPM) is ready for distribution. 355 @echo ============================================================== 356 357RPMDIR=rpmbuild 358RPMARCH=$(MAGICK_TARGET_CPU) 359 360DIST_ARCHIVE_RPM= \ 361 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-$(PACKAGE_PATCHLEVEL_VERSION).$(RPMARCH).rpm \ 362 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-$(PACKAGE_VERSION)-$(PACKAGE_PATCHLEVEL_VERSION).$(RPMARCH).rpm \ 363 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-devel-$(PACKAGE_VERSION)-$(PACKAGE_PATCHLEVEL_VERSION).$(RPMARCH).rpm \ 364 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-devel-$(PACKAGE_VERSION)-$(PACKAGE_PATCHLEVEL_VERSION).$(RPMARCH).rpm \ 365 $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-perl-$(PACKAGE_VERSION)-$(PACKAGE_PATCHLEVEL_VERSION).$(RPMARCH).rpm 366 367.PHONY: rpm 368rpm: dist 369 rm -rf $(RPMDIR) 370 $(mkinstalldirs) $(RPMDIR) 371 $(mkinstalldirs) $(RPMDIR)/BUILD 372 $(mkinstalldirs) $(RPMDIR)/RPMS 373 $(RPM) --define="_sourcedir `pwd`" --define="_rpmdir `pwd`/$(RPMDIR)/RPMS" --define="_builddir `pwd`/$(RPMDIR)/BUILD" --nodeps -bb ImageMagick.spec 374 @echo ============================================================== 375 @echo $(DIST_ARCHIVE_RPM) is ready for distribution. 376 @echo ============================================================== 377 378else 379DIST_ARCHIVE_RPM= 380endif # RPM_DELEGATE 381 382# 383# Build a validated snapshot release and move to the snapshots directory. 384# 385snapshot: distcheck 386 $(MAKE) $(DIST_ARCHIVE_SRPM) 387 $(MAKE) $(DIST_WINDOWS_SRC_ZIP) 388 $(MAKE) $(DIST_WINDOWS_SRC_7ZIP) 389 mv $(DIST_ARCHIVES) $(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) $(DIST_ARCHIVE_SRPM) /var/ftp/pub/ImageMagick/beta/ 390