summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 083eaf801503cf256f62e8cbcbc55b778baa84fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
## Process this file with automake to produce Makefile.in
## Copyright (C) 2000-2004 Roger Leigh
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <https://www.gnu.org/licenses/>.

## Process this file with automake to produce Makefile.in.

@SET_MAKE@

ACLOCAL_AMFLAGS = -I m4 -I m4local

include $(top_srcdir)/scripts/global.mk


## Variables

BUILT_SOURCES = src/xml/xmli18n-tmp.h
SUBDIRS = include src samples test po man doc scripts
DISTDIRS = m4 m4extra
CONFIGSUMMARYDIR=$(pkglibdir)/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@

docdir = $(datadir)/$(PACKAGE)/doc

src/xml/xmli18n-tmp.h:
	$(MAKE) -C src/xml

## Rules

# Libtool dependency
libtool: $(LIBTOOL_DEPS)
	cd $(srcdir); \
	$(SHELL) ./config.status --recheck

# Don't list ChangeLog as a dependency here because it forces network
# access, and because it usually runs as superuser rather than the user
# who normally builds Gutenprint.
# Don't list config.summary either because it's generated by configure.
install-data-local: NEWS AUTHORS COPYING README
	$(MKDIR_P) $(DESTDIR)$(docdir)
	$(INSTALL_DATA) $(srcdir)/NEWS $(DESTDIR)$(docdir)
	$(INSTALL_DATA) $(srcdir)/ChangeLog $(DESTDIR)$(docdir)
	$(INSTALL_DATA) $(srcdir)/AUTHORS $(DESTDIR)$(docdir)
	$(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(docdir)
	$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(docdir)
	$(MKDIR_P) $(DESTDIR)$(CONFIGSUMMARYDIR)
	$(INSTALL_DATA) config.summary $(DESTDIR)$(CONFIGSUMMARYDIR)

# git log is local, so it's fast enough that we don't need to
# engage in any subterfuge like we did with CVS.  It's really fast
# when we use a static file from the pre-Git era (since there are no
# live branches from that time) to save a lot of diffs.

# This isn't really the right spot for these checks.
# It's perfectly legal to update the change log even if NEWS
# or configure is out of date.  But it greatly reduces build spew
# to do it here, and manually updating the changelog is not a
# normal thing to do.
ChangeLog: dist-time-check dist-news-check
	if [ -d .git -a -f ChangeLog.pre-5.2.11 ] ; then \
	  $(MAKE) -C scripts mkgitlog; \
	  scripts/mkgitlog -i ChangeLog.pre-5.2.11 -r gutenprint-5_2_11 > ChangeLog; \
	fi

dist: src/xml/xmli18n-tmp.h

dist-time-check:
	@if [ "$(top_srcdir)/configure" -ot "$(top_srcdir)/configure.ac" ] ; then \
	  echo 1>&2; \
	  echo "****************************************************************" 1>&2; \
	  echo "*** configure is out of date (older than configure.ac) -- rerun ./autogen.sh first!" 1>&2; \
	  echo "****************************************************************" 1>&2; \
	  echo 1>&2; \
	  exit 1; \
	fi

# This would normally be done by AM_INIT_AUTOMAKE.  However,
# we don't want to do this if we're building a snapshot, because
# we don't want to update the NEWS file for each snapshot and
# there's no convenient way I've found to conditionalize the
# automake options.
dist-news-check:
	@if [ "$$STP_BUILD_SNAPSHOT" = "" ] ; then \
	  case "`sed 15q $(srcdir)/NEWS`" in \
	    *$(VERSION)*) : ;; \
	    *) \
	      echo 1>&2; \
	      echo "****************************************************************" 1>&2; \
	      echo "*** NEWS not updated to $(VERSION); not releasing" 1>&2; \
	      echo "****************************************************************" 1>&2; \
	      echo 1>&2; \
	      exit 1; \
	  esac ; \
	fi

git-version-stamp:
	if [ -d .git ] ; then scripts/gversion > /dev/null; fi

dist-hook: dist-time-check dist-news-check git-version-stamp
	for dir in $(DISTDIRS) ; do \
	  if test -d $(srcdir)/$$dir ; then \
	    mkdir $(distdir)/$$dir; \
	    for dirfile in $(srcdir)/$$dir/*; do \
	      if test -f $$dirfile ; then \
	        cp -p $$dirfile $(distdir)/$$dir; \
	      fi \
	    done \
	  fi \
	done
# Remove any backup files found in distdir
	$(FIND) $(distdir) -name '.*' -print | xargs $(RM) -rf
	$(FIND) $(distdir) -name '#*' -print | xargs $(RM) -rf
	$(FIND) $(distdir) -name '*~' -print | xargs $(RM) -rf

snapshot: scripts/gversion git-version-stamp
	$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d%H%M%S"`

#################################################################
#			       TESTING				#
#################################################################

CPUS=`scripts/count-cpus`

# STP_PROFILE=full
MAKECHECK=STP_TEST_SUITE=1 /usr/bin/time $(MAKE) -k -s -j$(CPUS) DISTCHECK_CONFIGURE_FLAGS=NO_PKGCONFIG_PATHS=1 check
MAKEDISTCHECK=STP_TEST_SUITE=1 STP_TEST_DIST=1 /usr/bin/time $(MAKE) -k -s -j$(CPUS) DISTCHECK_CONFIGURE_FLAGS=NO_PKGCONFIG_PATHS=1 distcheck
MAKECHECK_PARALLEL=STP_PARALLEL=$(CPUS) $(MAKECHECK)
MAKEDISTCHECK_PARALLEL=STP_PARALLEL=$(CPUS) $(MAKEDISTCHECK)

# ...but we can't do
# AM_TESTS_ENVIRONMENT=STP_PARALLEL=$(shell scripts/count-cpus)
# because $(shell...) is (still only) a GNU extension, which we
# want to avoid.  And we can't do
# AM_TESTS_ENVIRONMENT=STP_PARALLEL=`scripts/count-cpus`
# because all expansions are lazy, so anything not in the root directory
# won't find the script.  And we can't even do
# AM_TESTS_ENVIRONMENT=STP_PARALLEL=`(at)TOP_BUILDDIR(at)scripts/count-cpus`
# because TOP_BUILDDIR itself is a relative path.  And, just to make it
# even more fun, we won't be able to do
# AM_TESTS_ENVIRONMENT!=
# syntax even if POSIX approves it because it's only present in GNU make 4,
# but Apple doesn't use that.

# check-%: is a GNU make extension, so we have to explicitly list the targets
# of interest.  Bah humbug.

CHECK_TARGETS=check-parallel check-minimal check-fast check-full
CHECK_VALGRIND_TARGETS=check-valgrind check-valgrind-minimal check-valgrind-fast

$(CHECK_TARGETS) $(CHECK_VALGRIND_TARGETS):
	STP_TEST_PROFILE=`echo $@ |sed -e s/check-// -e s/-/_/g -e s/parallel//` $(MAKECHECK_PARALLEL)


DISTCHECK_TARGETS=distcheck-parallel distcheck-minimal distcheck-fast distcheck-full
DISTCHECK_VALGRIND_TARGETS=distcheck-valgrind distcheck-valgrind-minimal distcheck-valgrind-fast

$(DISTCHECK_TARGETS) $(DISTCHECK_VALGRIND_TARGETS):
	STP_TEST_PROFILE=`echo $@ |sed -e s/distcheck-// -e s/-/_/g -e s/parallel//` $(MAKEDISTCHECK_PARALLEL)


checksums: scripts/count-cpus
	STP_PARALLEL=$(CPUS) $(MAKE) -j$(CPUS) -C src/testpattern checksums-release

build-release: scripts/build-release scripts/count-cpus
	STP_PARALLEL=$(CPUS) /usr/bin/time scripts/build-release

sanity: scripts/build-release scripts/count-cpus
	STP_PARALLEL=$(CPUS) /usr/bin/time scripts/build-release preflight check_git check_git_builds

## Clean

CLEANMFOUR = \
	m4/*

CLEANPO = \
	po/ChangeLog \
	po/gutenprint.pot \
	po/Makefile.in.in \
	po/boldquot.sed \
	po/en@boldquot.header \
	po/en@quot.header \
	po/insert-header.sin \
	po/Makevars.template \
	po/quot.sed \
	po/remove-potcdate.sin \
	po/Rules-quot \
	po/*~

CLEANFILES = .noupdate

MAINTAINERCLEANFILES = \
	ABOUT-NLS \
	ChangeLog \
	INSTALL \
	aclocal.m4 \
	config.h.in \
	config.h.in~ \
	config.rpath \
	configure \
	git-version-stamp \
	Makefile.in \
	stamp-h.in \
	stamp-h1.in \
	stamp-h2.in \
	stamp-h3.in \
	stamp-h4.in \
	$(CLEANMFOUR) \
	$(CLEANPO)

distclean-local:
	-rm -f config.summary

uninstall-local:
	-rm -f $(DESTDIR)$(CONFIGSUMMARYDIR)/config.summary

EXTRA_DIST = autogen.sh README.package git-version-stamp

.PHONY: deb html install-cups install-gimp snapshot ChangeLog Phony dist-time-check git-version-stamp