• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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	gitversion.sh \
114	version.sh \
115	winpath.sh
116
117# Additional files to distribute
118EXTRA_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
127lib_LTLIBRARIES = $(MAGICKCORE_LIBS) $(MAGICKWAND_LIBS) $(MAGICKPP_LIBS)
128AM_LDFLAGS =
129noinst_LTLIBRARIES =
130EXTRA_LTLIBRARIES =
131BUILT_SOURCES =
132MOSTLYCLEANFILES =
133
134check_PROGRAMS = \
135	$(TESTS_CHECK_PGRMS) \
136	$(MAGICKPP_CHECK_PGRMS) \
137	$(MAGICKWAND_CHECK_PGRMS)
138
139include m4/Makefile.am
140include config/Makefile.am
141include coders/Makefile.am
142include MagickCore/Makefile.am
143include MagickWand/Makefile.am
144include Magick++/Makefile.am
145include filters/Makefile.am
146include utilities/Makefile.am
147include tests/Makefile.am
148include PerlMagick/Makefile.am
149
150# Pkgconfig directory
151pkgconfigdir = $(libdir)/pkgconfig
152
153# Files to install in Pkgconfig directory
154pkgconfig_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
164docdir = $(DOCUMENTATION_PATH)
165
166# Manual pages to install
167if INSTALL_DOC#
168man_MANS = \
169	$(MAGICKCORE_MANS) \
170	$(MAGICKWAND_MANS) \
171	$(MAGICKPP_MANS) \
172	$(UTILITIES_MANS)
173
174doc_DATA = \
175	LICENSE \
176	ChangeLog \
177	NEWS.txt
178endif
179
180if MAINTAINER_MODE
181MAINTAINER_TARGETS = \
182	magick-version \
183  ImageMagick.spec \
184  $(PERLMAGICK_MAINTAINER_TARGETS)
185endif
186
187all-local: $(MAGICKPP_LOCAL_TARGETS) $(PERLMAGICK_ALL_LOCAL_TARGETS) $(MAINTAINER_TARGETS)
188
189install-exec-local: $(PERLMAGICK_INSTALL_EXEC_LOCAL_TARGETS) \
190	$(UTILITIES_INSTALL_EXEC_LOCAL_TARGETS)
191
192install-data-local: $(PERLMAGICK_INSTALL_DATA_LOCAL_TARGETS) $(HTML_INSTALL_DATA_TARGETS)
193
194uninstall-local: $(PERLMAGICK_UNINSTALL_LOCAL_TARGETS) $(HTML_UNINSTALL_DATA_TARGETS) $(UTILITIES_UNINSTALL_LOCAL_TARGETS)
195
196clean-local: $(PERLMAGICK_CLEAN_LOCAL_TARGETS)
197
198distclean-local: $(PERLMAGICK_DISTCLEAN_LOCAL_TARGETS)
199
200maintainer-clean-local: $(PERLMAGICK_MAINTAINER_CLEAN_LOCAL_TARGETS)
201
202check-local: $(PERLMAGICK_CHECK_LOCAL_TARGETS)
203
204# drd: valgrind's newer thread error detector
205drd:
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
210helgrind:
211	$(MAKE) MEMCHECK='valgrind --tool=helgrind --error-exitcode=2 --quiet \
212	$(VALGRIND_EXTRA_OPTS)' check
213
214# memcheck: valgrind's memory access checker
215memcheck:
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.
221ptrcheck:
222	$(MAKE) MEMCHECK='valgrind --tool=exp-ptrcheck --quiet $(VALGRIND_EXTRA_OPTS)' check
223
224# Non-Automake subdirectories to distribute
225DISTDIRS = images scripts www PerlMagick
226dist-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
243pkgdocdir = $(DOCUMENTATION_PATH)
244DOCDIRSDOXYGEN = www/api/MagickCore www/api/MagickWand
245DOCDIRSMANUAL = images images/patterns www www/assets www/api www/source www/Magick++
246DOCDIRS= $(DOCDIRSMANUAL) $(DOCDIRSDOXYGEN)
247
248if INSTALL_DOC
249HTML_INSTALL_DATA_TARGETS = install-data-html
250endif
251
252install-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
269HTML_UNINSTALL_DATA_TARGETS = uninstall-data-html
270uninstall-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.
277magick-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
293LIBTOOL_DEPS = @LIBTOOL_DEPS@
294libtool: $(LIBTOOL_DEPS)
295	$(SHELL) ./config.status --recheck
296
297# Format C API documentation
298html-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#
321if ZIP_DELEGATE
322DIST_WINDOWS_SRC_ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.zip
323else
324DIST_WINDOWS_SRC_ZIP=
325endif
326if P7ZIP_DELEGATE
327DIST_WINDOWS_SRC_7ZIP=$(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)-windows.7z
328else
329DIST_WINDOWS_SRC_7ZIP=
330endif
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@git.imagemagick.org:repos/ImageMagick.git $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
337if 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)
340endif # ZIP_DELEGATE
341if 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)
345endif # P7ZIP_DELEGATE
346	rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)$(PACKAGE_VERSION_ADDENDUM)
347
348#
349# RPM build support
350#
351if RPM_DELEGATE
352
353DIST_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
362RPMDIR=rpmbuild
363RPMARCH=$(MAGICK_TARGET_CPU)
364
365DIST_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
373rpm:	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
383else
384DIST_ARCHIVE_RPM=
385endif # RPM_DELEGATE
386
387#
388# Build a validated snapshot release and move to the snapshots directory.
389#
390snapshot: 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