• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Copyright 1999-2020 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  Platforms.txt \
111  README.txt \
112  index.html \
113  version.sh \
114  winpath.sh
115
116# Additional files to distribute
117EXTRA_DIST = \
118  $(TOP_EXTRA_DIST) \
119  $(CONFIG_EXTRA_DIST) \
120  $(MAGICKCORE_EXTRA_DIST) \
121  $(MAGICKWAND_EXTRA_DIST) \
122  $(MAGICKPP_EXTRA_DIST) \
123  $(UTILITIES_EXTRA_DIST) \
124  $(TESTS_EXTRA_DIST)
125
126lib_LTLIBRARIES = $(MAGICKCORE_LIBS) $(MAGICKWAND_LIBS) $(MAGICKPP_LIBS)
127AM_LDFLAGS =
128noinst_LTLIBRARIES =
129EXTRA_LTLIBRARIES =
130BUILT_SOURCES =
131MOSTLYCLEANFILES =
132
133check_PROGRAMS = \
134  $(TESTS_CHECK_PGRMS) \
135  $(MAGICKPP_CHECK_PGRMS) \
136  $(MAGICKWAND_CHECK_PGRMS)
137
138include m4/Makefile.am
139include config/Makefile.am
140include coders/Makefile.am
141include MagickCore/Makefile.am
142include MagickWand/Makefile.am
143include Magick++/Makefile.am
144include filters/Makefile.am
145include 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 = \
154  $(MAGICKCORE_PKGCONFIG) \
155  $(MAGICKWAND_PKGCONFIG) \
156  $(MAGICKPP_PKGCONFIG)
157
158# create a copy for pc file (ideally the non abi should be symlinked)
159%-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@.pc: %.pc
160	cp -f $^ $@
161
162# Architecture independent data files installed in the package's data directory
163docdir = $(DOCUMENTATION_PATH)
164
165# Manual pages to install
166if INSTALL_DOC#
167man_MANS = \
168  $(MAGICKCORE_MANS) \
169  $(MAGICKWAND_MANS) \
170  $(MAGICKPP_MANS) \
171  $(UTILITIES_MANS)
172
173doc_DATA = \
174  LICENSE \
175  ChangeLog \
176  NEWS.txt
177endif
178
179if MAINTAINER_MODE
180MAINTAINER_TARGETS = \
181  magick-version \
182  ImageMagick.spec \
183  $(PERLMAGICK_MAINTAINER_TARGETS)
184endif
185
186all-local: $(MAGICKPP_LOCAL_TARGETS) $(PERLMAGICK_ALL_LOCAL_TARGETS) $(MAINTAINER_TARGETS)
187
188install-exec-local: $(PERLMAGICK_INSTALL_EXEC_LOCAL_TARGETS) \
189	$(UTILITIES_INSTALL_EXEC_LOCAL_TARGETS)
190
191install-data-local: $(PERLMAGICK_INSTALL_DATA_LOCAL_TARGETS) $(HTML_INSTALL_DATA_TARGETS)
192
193uninstall-local: $(PERLMAGICK_UNINSTALL_LOCAL_TARGETS) $(HTML_UNINSTALL_DATA_TARGETS) $(UTILITIES_UNINSTALL_LOCAL_TARGETS)
194
195clean-local: $(PERLMAGICK_CLEAN_LOCAL_TARGETS)
196
197distclean-local: $(PERLMAGICK_DISTCLEAN_LOCAL_TARGETS)
198
199maintainer-clean-local: $(PERLMAGICK_MAINTAINER_CLEAN_LOCAL_TARGETS)
200
201check-local: $(PERLMAGICK_CHECK_LOCAL_TARGETS)
202
203# drd: valgrind's newer thread error detector
204drd:
205	$(MAKE) MEMCHECK='valgrind --tool=drd --check-stack-var=yes --var-info=yes \
206	  --quiet $(VALGRIND_EXTRA_OPTS)' check
207
208# helgrind: valgrind's older thread error detector
209helgrind:
210	$(MAKE) MEMCHECK='valgrind --tool=helgrind --error-exitcode=2 --quiet \
211	$(VALGRIND_EXTRA_OPTS)' check
212
213# memcheck: valgrind's memory access checker
214memcheck:
215	$(MAKE) MEMCHECK='valgrind --tool=memcheck --leak-check=full --read-var-info=yes \
216	--error-exitcode=2 --track-origins=yes --num-callers=12 \
217	--quiet $(VALGRIND_EXTRA_OPTS)' check
218
219# ptrcheck: valgrind's experimental pointer checking tool.
220ptrcheck:
221	$(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check
222
223# Non-Automake subdirectories to distribute
224DISTDIRS = images scripts www PerlMagick
225dist-hook:
226	( \
227	  builddir=`pwd` ; \
228	  cd $(srcdir) && \
229	  ( \
230	    for dir in $(DISTDIRS) ; do \
231	      find $$dir -depth -print | egrep -v '(~$$)|(/.git)|(/\.#)|(/\.deps)|(/\.git)' \
232	        | cpio -pdum $$builddir/$(distdir) 2> /dev/null ; \
233	    done \
234	  ) \
235	)
236
237#
238# Additional install rules
239#
240
241# Install HTML files
242pkgdocdir = $(DOCUMENTATION_PATH)
243DOCDIRSDOXYGEN = www/api/MagickCore www/api/MagickWand
244DOCDIRSMANUAL = images images/patterns www www/assets www/api www/source www/Magick++
245DOCDIRS= $(DOCDIRSMANUAL) $(DOCDIRSDOXYGEN)
246
247if INSTALL_DOC
248HTML_INSTALL_DATA_TARGETS = install-data-html
249endif
250
251install-data-html:
252	$(mkinstalldirs) $(DESTDIR)$(pkgdocdir)
253	$(INSTALL_DATA) $(srcdir)/index.html $(DESTDIR)$(pkgdocdir)
254	@for dir in $(DOCDIRS) ; do \
255	  $(mkinstalldirs) $(DESTDIR)$(pkgdocdir)/$$dir && \
256	  if test -d $(builddir)/$$dir ; then \
257	    docsrcdir=$(builddir)/$$dir; \
258	  else \
259	    docsrcdir=$(srcdir)/$$dir; \
260	  fi; \
261	  for file in $$docsrcdir/*.* ; do \
262	    echo "$(INSTALL_DATA) $$file $(DESTDIR)$(pkgdocdir)/$$dir" ; \
263	    $(INSTALL_DATA) "$$file" $(DESTDIR)$(pkgdocdir)/$$dir ; \
264	  done ; \
265	done
266
267# Uninstall HTML files
268HTML_UNINSTALL_DATA_TARGETS = uninstall-data-html
269uninstall-data-html:
270	rm -f $(DESTDIR)$(pkgdocdir)/index.html
271	for dir in $(DOCDIRS) ; do \
272	  rm -f -r $(DESTDIR)$(pkgdocdir)/$$dir ; \
273	done
274
275# Ensure that version.h at $(srcdir)/MagickCore/version.h is kept up to date.
276magick-version: MagickCore/version.h
277	@if test -f "$(srcdir)/VisualMagick/installer/inc/version.isx.in" ; then \
278	  ./config.status --file="$(srcdir)/../VisualMagick/installer/inc/version.isx" 2> /dev/null ; \
279	fi
280	@if test -n "$(VPATH)" ; then \
281	  cmp MagickCore/version.h $(srcdir)/MagickCore/version.h > /dev/null ; \
282	        if test $$? -eq 1 ; then \
283	    echo "Updating $(srcdir)/MagickCore/version.h ..."; \
284	    cp MagickCore/version.h $(srcdir)/MagickCore/version.h ; \
285	  fi ; \
286	fi ; \
287	touch magick-version
288
289${srcdir}/configure: ${srcdir}/version.sh
290
291# Automagically reconfigure libtool
292LIBTOOL_DEPS = @LIBTOOL_DEPS@
293libtool: $(LIBTOOL_DEPS)
294	$(SHELL) ./config.status --recheck
295
296# Format C API documentation
297html-local:
298# copy static file
299	for dir in $(DOCDIRSMANUAL) ; do \
300		$(mkinstalldirs) $(top_builddir)/$$dir ;\
301		for file in $$dir/*.* ; do \
302			if ! test -f $(top_builddir)/$$file; then \
303				cp -p -f $(top_srcdir)/$$file $(top_builddir)/$$dir ; \
304			fi; \
305		done ; \
306	done;
307# remove old doxygen files
308	for dir in $(DOCDIRDOXYGEN) ; do \
309	    rm -rf $$dir || true; \
310	done;
311# make doxygen doc
312	$(mkinstalldirs) $(top_builddir)/www/api
313	cd config && doxygen MagickCore.dox
314	cd config && doxygen MagickWand.dox
315	cd config && doxygen Magick++.dox
316
317#
318# Build Windows source Zip and 7Zip balls
319#
320if ZIP_DELEGATE
321DIST_WINDOWS_SRC_ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.zip
322else
323DIST_WINDOWS_SRC_ZIP=
324endif
325if P7ZIP_DELEGATE
326DIST_WINDOWS_SRC_7ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.7z
327else
328DIST_WINDOWS_SRC_7ZIP=
329endif
330$(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) windows-dist:
331	if test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; then \
332	  chmod -R u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
333	  rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM) ; \
334	fi
335	git clone git@git.imagemagick.org:repos/ImageMagick.git $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
336if ZIP_DELEGATE
337	rm -f $(DIST_WINDOWS_SRC_ZIP)
338	$(ZIP) -r -9 -q  $(DIST_WINDOWS_SRC_ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
339endif # ZIP_DELEGATE
340if P7ZIP_DELEGATE
341	rm -f $(DIST_WINDOWS_SRC_7ZIP)
342	$(P7ZIP) a -t7z -mx=9 $(DIST_WINDOWS_SRC_7ZIP) $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
343	chmod 644 $(DIST_WINDOWS_SRC_7ZIP)
344endif # P7ZIP_DELEGATE
345	rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
346
347#
348# RPM build support
349#
350if RPM_DELEGATE
351
352DIST_ARCHIVE_SRPM=$(distdir).src.rpm
353.PHONY: srpm
354$(DIST_ARCHIVE_SRPM) srpm: dist-bzip2
355	rm -f $(DIST_ARCHIVE_SRPM)
356	$(RPM) --define="_sourcedir `pwd`" --define="_srcrpmdir `pwd`" --nodeps --bs ImageMagick.spec
357	@echo ==============================================================
358	@echo $(DIST_ARCHIVE_SRPM) is ready for distribution.
359	@echo ==============================================================
360
361RPMDIR=rpmbuild
362RPMARCH=$(MAGICK_TARGET_CPU)
363
364DIST_ARCHIVE_RPM= \
365  $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
366  $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
367  $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-c++-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
368  $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-devel-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm \
369  $(RPMDIR)/$(RPMARCH)/$(PACKAGE_NAME)-perl-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-$(PACKAGE_RELEASE).$(RPMARCH).rpm
370
371.PHONY: rpm
372rpm: dist
373	rm -rf $(RPMDIR)
374	$(mkinstalldirs) $(RPMDIR)
375	$(mkinstalldirs) $(RPMDIR)/BUILD
376	$(mkinstalldirs) $(RPMDIR)/RPMS
377	$(RPM) --define="_sourcedir `pwd`" --define="_rpmdir `pwd`/$(RPMDIR)/RPMS" --define="_builddir `pwd`/$(RPMDIR)/BUILD" --nodeps -bb ImageMagick.spec
378	@echo ==============================================================
379	@echo $(DIST_ARCHIVE_RPM) is ready for distribution.
380	@echo ==============================================================
381
382else
383DIST_ARCHIVE_RPM=
384endif # RPM_DELEGATE
385
386#
387# Build a validated snapshot release and move to the snapshots directory.
388#
389snapshot: distcheck
390	$(MAKE) $(DIST_ARCHIVE_SRPM)
391	$(MAKE) $(DIST_WINDOWS_SRC_ZIP)
392	$(MAKE) $(DIST_WINDOWS_SRC_7ZIP)
393	mv $(DIST_ARCHIVES) $(DIST_WINDOWS_SRC_ZIP) $(DIST_WINDOWS_SRC_7ZIP) $(DIST_ARCHIVE_SRPM) /var/ftp/pub/ImageMagick/beta/
394