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