Makefile.am 11.2 KB
Newer Older
Cristy's avatar
Cristy committed
1
#  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization
cristy's avatar
cristy committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#  dedicated to making software imaging solutions freely available.
#
#  You may not use this file except in compliance with the License.  You may
#  obtain a copy of the License at
#
#    http://www.imagemagick.org/script/license.php
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
#  Copyright (C) 2003 - 2008 GraphicsMagick Group
#
#  Top-Level Makefile for building ImageMagick.
#

cristy's avatar
cristy committed
20 21
topincludedir = @includedir@/magick

cristy's avatar
cristy committed
22 23 24 25
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)

ACLOCAL_AMFLAGS = -I m4

cristy's avatar
cristy committed
26
MODULECOMMONFLAGS = -no-undefined -export-symbols-regex ".*" -shared -module -avoid-version
cristy's avatar
cristy committed
27
MODULECOMMONCPPFLAGS = $(AM_CPPFLAGS)
cristy's avatar
cristy committed
28 29 30 31 32 33 34

# Options to pass when running configure in the distcheck target.
#
# We want to preserve user-provided option variables so the same
# compiler, headers, and libraries are used as for a normal build.
DISTCHECK_CONFIGURE_FLAGS=$(DISTCHECK_CONFIG_FLAGS)

cristy's avatar
cristy committed
35
DISTCLEANFILES = _configs.sed magick/magick-baseconfig.h
cristy's avatar
cristy committed
36

cristy's avatar
cristy committed
37 38 39 40 41
## Make sure these will be cleaned even when they're not built by default.
CLEANFILES = \
	$(WAND_CLEANFILES) \
	$(MAGICKPP_CLEANFILES) \
	$(UTILITIES_CLEANFILES) \
cristy's avatar
cristy committed
42
	$(TESTS_CLEANFILES)
cristy's avatar
cristy committed
43

cristy's avatar
cristy committed
44
bin_PROGRAMS = \
cristy's avatar
cristy committed
45 46 47
	$(UTILITIES_PGMS)

# Binary scripts
cristy's avatar
cristy committed
48
bin_SCRIPTS = \
cristy's avatar
cristy committed
49 50 51 52
	$(MAGICK_BIN_SCRPTS) \
	$(WAND_BIN_SCRPTS) \
	$(MAGICKPP_SCRPTS)

cristy's avatar
cristy committed
53
include_HEADERS =
cristy's avatar
cristy committed
54 55 56 57 58 59 60 61 62 63 64

# Headers which are not installed but which are distributed
noinst_HEADERS = \
	$(MAGICK_NOINST_HDRS)

if WIN32_NATIVE_BUILD
SRCDIR='$(shell @WinPathScript@ $(srcdir)/)'
else
SRCDIR="$(srcdir)/"
endif

cristy's avatar
cristy committed
65
# Tests with .tap extensions use the TAP protocol and TAP driver
cristy's avatar
cristy committed
66 67 68 69 70 71 72 73
LOG_COMPILER = $(SHELL)

SH_LOG_COMPILER = $(LOG_COMPILER)
TAP_LOG_COMPILER = $(LOG_COMPILER)

# Test extensions
TEST_EXTENSIONS = .sh .tap

cristy's avatar
cristy committed
74 75 76
TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
	$(top_srcdir)/config/tap-driver.sh

cristy's avatar
cristy committed
77 78 79 80
# Environment parameters to be used during tests
TESTS_ENVIRONMENT = \
	MAKE="$(MAKE)" \
	MAKEFLAGS="$(MAKEFLAGS)" \
cristy's avatar
cristy committed
81
	MEMCHECK="$(MEMCHECK)"
cristy's avatar
cristy committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155

# Tests to run
TESTS = \
	$(TESTS_TESTS) \
	$(MAGICKPP_TESTS) \
	$(WAND_TESTS) \
	$(UTILITIES_TESTS)

# Tests which are expected to fail
XFAIL_TESTS = \
	$(TESTS_XFAIL_TESTS) \
	$(UTILITIES_XFAIL_TESTS)

TOP_EXTRA_DIST = \
  AUTHORS.txt \
	ChangeLog \
	LICENSE \
	QuickStart.txt \
	NOTICE \
	Install-mac.txt \
	Install-unix.txt \
	Install-vms.txt \
	Install-windows.txt \
	magick.sh.in \
	Magickshr.opt \
	NEWS.txt \
	Platforms.txt \
	README.txt \
	index.html \
	version.sh \
	winpath.sh

# Additional files to distribute
EXTRA_DIST = \
	$(TOP_EXTRA_DIST) \
	$(CONFIG_EXTRA_DIST) \
	$(MAGICK_EXTRA_DIST) \
	$(WAND_EXTRA_DIST) \
	$(MAGICKPP_EXTRA_DIST) \
	$(UTILITIES_EXTRA_DIST) \
	$(TESTS_EXTRA_DIST)

lib_LTLIBRARIES = $(MAGICKCORE_LIBS) $(MAGICKWAND_LIBS) $(MAGICKPP_LIBS)
AM_LDFLAGS =
noinst_LTLIBRARIES =
EXTRA_LTLIBRARIES =
BUILT_SOURCES =
MOSTLYCLEANFILES =

check_PROGRAMS = \
	$(TESTS_CHECK_PGRMS) \
	$(MAGICKPP_CHECK_PGRMS) \
	$(WAND_CHECK_PGRMS)

include m4/Makefile.am
include config/Makefile.am
include coders/Makefile.am
include magick/Makefile.am
include filters/Makefile.am
include wand/Makefile.am
include Magick++/Makefile.am
include utilities/Makefile.am
include tests/Makefile.am
include PerlMagick/Makefile.am

# Pkgconfig directory
pkgconfigdir = $(libdir)/pkgconfig

# Files to install in Pkgconfig directory
pkgconfig_DATA = \
	$(MAGICK_PKGCONFIG) \
	$(WAND_PKGCONFIG) \
	$(MAGICKPP_PKGCONFIG)

cristy's avatar
cristy committed
156
# create a copy for pc file (ideally the non abi should be symlinked)
cristy's avatar
cristy committed
157
%-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@.pc: %.pc
cristy's avatar
cristy committed
158
	cp -f $^ $@
cristy's avatar
cristy committed
159

cristy's avatar
cristy committed
160 161 162
# Architecture independent data files installed in the package's data directory
docdir = $(DOCUMENTATION_PATH)

cristy's avatar
cristy committed
163
# Manual pages to install
cristy's avatar
cristy committed
164
if INSTALL_DOC
cristy's avatar
cristy committed
165 166 167 168 169 170 171 172 173 174
man_MANS = \
	$(MAGICK_MANS) \
	$(WAND_MANS) \
	$(MAGICKPP_MANS) \
	$(UTILITIES_MANS)

doc_DATA = \
	LICENSE \
	ChangeLog \
	NEWS.txt
cristy's avatar
cristy committed
175
endif
cristy's avatar
cristy committed
176 177

if MAINTAINER_MODE
cristy's avatar
cristy committed
178
MAINTAINER_TARGETS = \
cristy's avatar
cristy committed
179 180 181
	magick-version \
  ImageMagick.spec \
  $(PERLMAGICK_MAINTAINER_TARGETS)
cristy's avatar
cristy committed
182 183 184 185 186 187
endif

all-local: $(MAGICKPP_LOCAL_TARGETS) $(PERLMAGICK_ALL_LOCAL_TARGETS) $(MAINTAINER_TARGETS)

install-exec-local: $(PERLMAGICK_INSTALL_EXEC_LOCAL_TARGETS)

cristy's avatar
cristy committed
188
install-data-local: $(PERLMAGICK_INSTALL_DATA_LOCAL_TARGETS) $(HTML_INSTALL_DATA_TARGETS)
cristy's avatar
cristy committed
189

cristy's avatar
cristy committed
190
uninstall-local: $(PERLMAGICK_UNINSTALL_LOCAL_TARGETS) $(HTML_UNINSTALL_DATA_TARGETS)
cristy's avatar
cristy committed
191 192 193 194 195 196 197 198 199

clean-local: $(PERLMAGICK_CLEAN_LOCAL_TARGETS)

distclean-local: $(PERLMAGICK_DISTCLEAN_LOCAL_TARGETS)

maintainer-clean-local: $(PERLMAGICK_MAINTAINER_CLEAN_LOCAL_TARGETS)

check-local: $(PERLMAGICK_CHECK_LOCAL_TARGETS)

cristy's avatar
cristy committed
200 201 202 203 204
# drd: valgrind's newer thread error detector
drd:
	$(MAKE) MEMCHECK='valgrind --tool=drd --check-stack-var=yes --var-info=yes \
	  --quiet $(VALGRIND_EXTRA_OPTS)' check

cristy's avatar
cristy committed
205
# helgrind: valgrind's older thread error detector
cristy's avatar
cristy committed
206
helgrind:
cristy's avatar
cristy committed
207 208
	$(MAKE) MEMCHECK='valgrind --tool=helgrind --error-exitcode=2 --quiet \
	$(VALGRIND_EXTRA_OPTS)' check
cristy's avatar
cristy committed
209

cristy's avatar
cristy committed
210
# memcheck: valgrind's memory access checker
cristy's avatar
cristy committed
211
memcheck:
cristy's avatar
cristy committed
212 213 214
	$(MAKE) MEMCHECK='valgrind --tool=memcheck --leak-check=full --read-var-info=yes \
	--error-exitcode=2 --track-origins=yes --num-callers=12 \
	--quiet $(VALGRIND_EXTRA_OPTS)' check
cristy's avatar
cristy committed
215

cristy's avatar
cristy committed
216
# ptrcheck: valgrind's experimental pointer checking tool.
cristy's avatar
cristy committed
217
ptrcheck:
cristy's avatar
cristy committed
218
	$(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check
cristy's avatar
cristy committed
219 220

# Non-Automake subdirectories to distribute
cristy's avatar
cristy committed
221
DISTDIRS = images scripts www PerlMagick
cristy's avatar
cristy committed
222 223 224 225 226 227
dist-hook:
	( \
	  builddir=`pwd` ; \
	  cd $(srcdir) && \
	  ( \
	    for dir in $(DISTDIRS) ; do \
228
	      find $$dir -depth -print | egrep -v '(~$$)|(/.git)|(/\.#)|(/\.deps)|(/\.git)' \
cristy's avatar
cristy committed
229 230 231 232 233 234 235 236 237 238 239
	        | cpio -pdum $$builddir/$(distdir) 2> /dev/null ; \
	    done \
	  ) \
	)

#
# Additional install rules
#

# Install HTML files
pkgdocdir = $(DOCUMENTATION_PATH)
cristy's avatar
cristy committed
240
DOCDIRSDOXYGEN = www/api/MagickCore www/api/MagickWand
cristy's avatar
cristy committed
241
DOCDIRSMANUAL = images images/patterns www www/css www/js www/api www/source www/Magick++
cristy's avatar
cristy committed
242
DOCDIRS= $(DOCDIRSMANUAL) $(DOCDIRSDOXYGEN)
cristy's avatar
cristy committed
243 244

if INSTALL_DOC
cristy's avatar
cristy committed
245
HTML_INSTALL_DATA_TARGETS = install-data-html
cristy's avatar
cristy committed
246
endif
cristy's avatar
cristy committed
247

cristy's avatar
cristy committed
248 249 250 251 252
install-data-html:
	$(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
	$(INSTALL_DATA) $(srcdir)/index.html $(DESTDIR)$(pkgdocdir)
	@for dir in $(DOCDIRS) ; do \
	  $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
cristy's avatar
cristy committed
253 254 255 256 257 258
	  if test -d $(builddir)/$$dir ; then \
  		docsrcdir=$(builddir)/$$dir; \
	  else \
  		docsrcdir=$(srcdir)/$$dir; \
	  fi; \
	  for file in $$docsrcdir/*.* ; do \
cristy's avatar
cristy committed
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
	    echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \
	    $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \
	  done ; \
	done

# Uninstall HTML files
HTML_UNINSTALL_DATA_TARGETS = uninstall-data-html
uninstall-data-html:
	rm -f $(DESTDIR)$(pkgdocdir)/index.html
	for dir in $(DOCDIRS) ; do \
	  rm -f -r $(DESTDIR)$(pkgdocdir)/$$dir ; \
	done

# Ensure that version.h at $(srcdir)/magick/version.h is kept up to date.
magick-version: magick/version.h
	@if test -f "$(srcdir)/VisualMagick/installer/inc/version.isx.in" ; then \
	  ./config.status --file="$(srcdir)/../VisualMagick/installer/inc/version.isx" 2> /dev/null ; \
	fi
	@if test -n "$(VPATH)" ; then \
	  cmp magick/version.h $(srcdir)/magick/version.h > /dev/null ; \
          if test $$? -eq 1 ; then \
	    echo "Updating $(srcdir)/magick/version.h ..."; \
	    cp magick/version.h $(srcdir)/magick/version.h ; \
	  fi ; \
	fi ; \
	touch magick-version

${srcdir}/configure: ${srcdir}/version.sh

# Automagically reconfigure libtool
LIBTOOL_DEPS = @LIBTOOL_DEPS@
libtool: $(LIBTOOL_DEPS)
	$(SHELL) ./config.status --recheck

# Format C API documentation
Cristy's avatar
Cristy committed
294
html-local:
295
# copy static file
cristy's avatar
cristy committed
296 297 298 299
	for dir in $(DOCDIRSMANUAL) ; do \
		$(MKDIR_P) $(top_builddir)/$$dir ;\
		for file in $$dir/*.* ; do \
			if ! test -f $(top_builddir)/$$file; then \
300
				cp -p -f $(top_srcdir)/$$file $(top_builddir)/$$dir ; \
cristy's avatar
cristy committed
301 302 303
			fi; \
		done ; \
	done;
304 305 306 307 308 309 310 311 312
# remove old doxygen files
	for dir in $(DOCDIRDOXYGEN) ; do \
	    rm -rf $$dir || true; \
	done;
# make doxygen doc
	$(MKDIR_P) $(top_builddir)/www/api
	cd config && doxygen MagickCore.dox
	cd config && doxygen MagickWand.dox
	cd config && doxygen Magick++.dox
cristy's avatar
cristy committed
313 314 315 316 317

#
# Build Windows source Zip and 7Zip balls
#
if ZIP_DELEGATE
cristy's avatar
cristy committed
318
DIST_WINDOWS_SRC_ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.zip
cristy's avatar
cristy committed
319 320 321 322
else
DIST_WINDOWS_SRC_ZIP=
endif
if P7ZIP_DELEGATE
cristy's avatar
cristy committed
323
DIST_WINDOWS_SRC_7ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.7z
cristy's avatar
cristy committed
324 325 326 327
else
DIST_WINDOWS_SRC_7ZIP=
endif
$(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) windows-dist:
cristy's avatar
cristy committed
328 329 330
	if test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; then \
	  chmod -R u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
	  rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
cristy's avatar
cristy committed
331
	fi
332
  git clone -b ImageMagick-6 --single-branch git@git.imagemagick.org:repos/ImageMagick.git $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy's avatar
cristy committed
333 334
if ZIP_DELEGATE
	rm -f $(DIST_WINDOWS_SRC_ZIP)
cristy's avatar
cristy committed
335
	$(ZIP) -r -9 -q  $(DIST_WINDOWS_SRC_ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy's avatar
cristy committed
336 337 338
endif # ZIP_DELEGATE
if P7ZIP_DELEGATE
	rm -f $(DIST_WINDOWS_SRC_7ZIP)
cristy's avatar
cristy committed
339
	$(P7ZIP) a -t7z -mx=9 $(DIST_WINDOWS_SRC_7ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy's avatar
cristy committed
340 341
	chmod 644 $(DIST_WINDOWS_SRC_7ZIP)
endif # P7ZIP_DELEGATE
cristy's avatar
cristy committed
342
	rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
cristy's avatar
cristy committed
343 344 345 346 347 348

#
# RPM build support
#
if RPM_DELEGATE

cristy's avatar
cristy committed
349
DIST_ARCHIVE_SRPM=$(distdir)-1.src.rpm
cristy's avatar
cristy committed
350
.PHONY: srpm
anthony's avatar
anthony committed
351
$(DIST_ARCHIVE_SRPM) srpm: dist-bzip2
cristy's avatar
cristy committed
352 353 354 355 356 357
	rm -f $(DIST_ARCHIVE_SRPM)
	$(RPM) --define="_sourcedir `pwd`" --define="_srcrpmdir `pwd`" --nodeps --bs ImageMagick.spec
	@echo ==============================================================
	@echo $(DIST_ARCHIVE_SRPM) is ready for distribution.
	@echo ==============================================================

cristy's avatar
cristy committed
358 359
RPMDIR=rpmbuild
RPMARCH=$(MAGICK_TARGET_CPU)
cristy's avatar
cristy committed
360 361

DIST_ARCHIVE_RPM= \
cristy's avatar
cristy committed
362 363 364 365 366
	$(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
	$(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
	$(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
	$(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
	$(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-perl-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm
cristy's avatar
cristy committed
367 368

.PHONY: rpm
cristy's avatar
cristy committed
369
rpm:	dist
cristy's avatar
cristy committed
370
	rm -rf $(RPMDIR)
cristy's avatar
cristy committed
371 372 373
	$(MKDIR_P) $(RPMDIR)
	$(MKDIR_P) $(RPMDIR)/BUILD
	$(MKDIR_P) $(RPMDIR)/RPMS
cristy's avatar
cristy committed
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
	$(RPM) --define="_sourcedir `pwd`" --define="_rpmdir `pwd`/$(RPMDIR)/RPMS" --define="_builddir `pwd`/$(RPMDIR)/BUILD" --nodeps -bb ImageMagick.spec
	@echo ==============================================================
	@echo $(DIST_ARCHIVE_RPM) is ready for distribution.
	@echo ==============================================================

else
DIST_ARCHIVE_RPM=
endif # RPM_DELEGATE

#
# Build a validated snapshot release and move to the snapshots directory.
#
snapshot: distcheck
	$(MAKE) $(DIST_ARCHIVE_SRPM)
	$(MAKE) $(DIST_WINDOWS_SRC_ZIP)
	$(MAKE) $(DIST_WINDOWS_SRC_7ZIP)
	mv $(DIST_ARCHIVES) $(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) $(DIST_ARCHIVE_SRPM) /var/ftp/pub/ImageMagick/beta/