1## $Id: Makefile.am,v 1.120 2011/01/17 23:20:51 rlk Exp $
2## Copyright (C) 2000 Roger Leigh
3##
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2, or (at your option)
7## any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18## Process this file with automake to produce Makefile.in.
19
20@SET_MAKE@
21
22include $(top_srcdir)/scripts/global.mk
23
24
25## Variables
26
27empty=
28PACKAGE = cups
29
30bindir = @cups_bindir@
31sbindir = @cups_sbindir@
32
33pkgdatadir = $(cups_conf_datadir)
34pkglibdir = $(cups_conf_serverbin)
35pkgsysconfdir = $(cups_conf_serverroot)
36
37cupsexec_driverdir = $(pkglibdir)/driver
38cupsexec_filterdir = $(pkglibdir)/filter
39if CUPS_PPDS_AT_TOP_LEVEL
40cups_modeldir = $(pkgdatadir)/model/
41DONT_UNINSTALL_PPDS=true
42else
43cups_modeldir = $(pkgdatadir)/model/gutenprint/@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@/
44endif
45
46LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) $(CUPS_CFLAGS)
47
48STP_NONLS_ENV= STP_MODULE_PATH=$(top_builddir)/src/main/.libs:$(top_builddir)/src/main STP_DATA_PATH=$(top_srcdir)/src/xml
49
50STP_ENV= $(STP_NONLS_ENV) STP_LOCALEDIR=$(top_srcdir)/src/cups/catalog
51
52## Programs
53
54if BUILD_TRANSLATED_CUPS_PPDS
55if BUILD_GLOBALIZED_CUPS_PPDS
56PPD = ppd-global
57else
58PPD = $(PPD_NLS_1)
59endif
60LINGUAS = $(ALL_LINGUAS)
61TRANSLATE_PPDS = -DCUPS_TRANSLATED_PPDS
62else
63PPD = ppd-nonls
64endif
65
66if BUILD_SIMPLIFIED_CUPS_PPDS
67BUILD_SIMPLE_PPDS=-DGENERATE_SIMPLIFIED_PPDS
68endif
69
70if BUILD_CUPS_1_2
71cupsexec_driver_PROGRAMS = gutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
72endif
73
74if BUILD_CUPS
75bin_PROGRAMS = cups-calibrate
76sbin_PROGRAMS = cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
77sbin_SCRIPTS = cups-genppdupdate
78cupsexec_filter_PROGRAMS = rastertogutenprint.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ commandtoepson commandtocanon
79
80TESTS= test-ppds test-rastertogutenprint
81noinst_SCRIPTS=test-rastertogutenprint
82endif
83
84if BUILD_GENPPD_STATIC
85STATIC_LDOPTS=-static -export-dynamic
86endif
87
88cups_calibrate_SOURCES = cups-calibrate.c
89cups_calibrate_LDADD = -lm
90
91commandtocanon_SOURCES = commandtocanon.c
92commandtocanon_LDADD = $(CUPS_LIBS)
93
94commandtoepson_SOURCES = commandtoepson.c
95commandtoepson_LDADD = $(CUPS_LIBS)
96
97cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = genppd.c i18n.c i18n.h
98cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_CFLAGS = -DALL_LINGUAS='"@ALL_LINGUAS@"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS)
99cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS) @LIBICONV@
100cups_genppd_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDFLAGS = $(STATIC_LDOPTS)
101
102gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = genppd.c i18n.c i18n.h
103gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_CFLAGS = -DCUPS_DRIVER_INTERFACE -DALL_LINGUAS='"@ALL_LINGUAS@"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS)
104gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GUTENPRINT_LIBS) @LIBICONV@
105gutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDFLAGS = $(STATIC_LDOPTS)
106
107rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_SOURCES = rastertoprinter.c i18n.c i18n.h
108rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDADD = $(CUPS_LIBS) $(GUTENPRINT_LIBS) @LIBICONV@
109rastertogutenprint_@GUTENPRINT_MAJOR_VERSION@_@GUTENPRINT_MINOR_VERSION@_LDFLAGS = $(STATIC_LDOPTS)
110
111## Data
112
113if BUILD_CUPS
114CUPS_PKG = calibrate.ppm
115endif
116if BUILD_CUPS
117CUPS_CONF = command.types
118endif
119
120pkgdata_DATA = $(CUPS_PKG)
121pkgsysconf_DATA = $(CUPS_CONF)
122
123if BUILD_CUPS_PPDS
124INSTALL_DATA_LOCAL_DEPS = ppd-stamp
125endif
126
127if USE_NLS
128PPD_NLS_1 = ppd-nls
129endif
130
131
132install-data-local: $(INSTALL_DATA_LOCAL_DEPS)
133	if test -n "$(CUPS_PKG)" -a -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
134	  $(mkdir_p) $(DESTDIR)$(cups_modeldir); \
135	  cd ppd ; \
136	  for language in * ; do \
137	    cd ..; \
138	    $(mkdir_p) $(DESTDIR)$(cups_modeldir)/$$language; \
139	    cd ppd/$$language; \
140	    for ppdfile in * ; do \
141	      (cd ../..; $(INSTALL_DATA) ppd/$$language/$$ppdfile $(DESTDIR)$(cups_modeldir)/$$language) ; \
142	    done; \
143	  cd ..; \
144	  done \
145	fi
146	$(mkdir_p) "$(DESTDIR)$(localedir)"
147	for file in $(srcdir)/../../po/*.po; do \
148	  lang=`basename $$file .po`; \
149	  $(mkdir_p) "$(DESTDIR)$(localedir)/$$lang"; \
150	  $(INSTALL_DATA) $$file "$(DESTDIR)$(localedir)/$$lang/gutenprint_$$lang.po"; \
151	done
152
153uninstall-local: $(INSTALL_DATA_LOCAL_DEPS)
154# Remove PPDs installed in new PPD location
155	if test -z "DONT_UNINSTALL_PPDS" ; then \
156	  if test -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
157	    $(RM) -fr $(DESTDIR)$(cups_modeldir)/* ; \
158	  fi ; \
159	fi
160	for file in $(srcdir)/../../po/*.po; do \
161	  lang=`basename $$file .po`; \
162	  $(RM) "$(DESTDIR)$(localedir)/$$lang/gutenprint_$$lang.po"; \
163	done
164
165install-data-hook:
166# Remove unused directories in install tree
167	-@echo 'Expect a number of "rmdir: Directory not empty" warnings'
168	-@echo 'These messages are harmless and should be ignored.'
169	-rmdir $(DESTDIR)$(cups_modeldir)
170	-rmdir $(DESTDIR)$(pkgdatadir)
171	-rmdir $(DESTDIR)$(cupsexec_driverdir)
172	-rmdir $(DESTDIR)$(cupsexec_filterdir)
173	-rmdir $(DESTDIR)$(bindir)
174	-rmdir $(DESTDIR)$(pkglibdir)
175	-rmdir $(DESTDIR)$(pkgsysconfdir)
176	-rmdir `dirname $(DESTDIR)$(pkgdatadir)`
177	-rmdir `dirname $(DESTDIR)$(pkglibdir)`
178	-rmdir `dirname $(DESTDIR)$(pkgsysconfdir)`
179
180.PHONY: ppd ppd-stamp-pre ppd-stamp-nonls ppd-stamp-nls ppd-stamp-phony ppd-catalog-clean ppd-clean
181
182all-local: $(INSTALL_DATA_LOCAL_DEPS)
183
184ppd: ppd-stamp
185
186ppd-stamp: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ $(top_srcdir)/src/xml/xml-stamp
187	$(MAKE) ppd-stamp-pre
188	$(MAKE) ppd-stamp-phony
189	touch ppd-stamp
190
191ppd-stamp-phony: $(PPD)
192
193ppd-catalog-clean:
194	-$(RM) -r catalog
195
196ppd-clean:
197	-$(RM) -r ppd
198
199ppd-stamp-pre: ppd-catalog-clean ppd-clean
200
201ppd-catalog: ppd-catalog-clean
202	$(mkdir_p) catalog
203	for file in $(srcdir)/../../po/*.po; do \
204	  lang=`basename $$file .po`; \
205	  $(mkdir_p) "catalog/$$lang"; \
206	  $(INSTALL_DATA) $$file "catalog/$$lang/gutenprint_$$lang.po"; \
207	done
208
209ppd-nonls: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
210	$(mkdir_p) ppd/C
211	$(MAKE) ppd-catalog-clean
212	LC_ALL= LANG= LANGUAGE= $(STP_NONLS_ENV) ./cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ @WHICH_PPDS@ -l C -p ppd/C
213
214ppd-global: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
215	@echo "Global PPDs:"
216	$(mkdir_p) ppd/Global
217	$(MAKE) ppd-catalog
218	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ @WHICH_PPDS@ -p ppd/Global
219	$(MAKE) ppd-catalog-clean
220
221ppd-global-ln: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@
222	@echo "Global PPDs (localized numbers for testing):"
223	$(mkdir_p) ppd/Global
224	$(MAKE) ppd-catalog
225	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ @WHICH_PPDS@ -p ppd/Global -N
226	$(MAKE) ppd-catalog-clean
227
228ppd-nls: cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ ppd-nonls
229	$(mkdir_p) ppd
230	$(MAKE) ppd-catalog
231	for language in `$(STP_ENV) ./cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ -L` ; do \
232	  mkdir ppd/$$language ; \
233	  echo "$$language:" ; \
234	  LC_ALL=$$language LANG=$$language LANGUAGE=$$language $(STP_ENV) ./cups-genppd.@GUTENPRINT_MAJOR_VERSION@.@GUTENPRINT_MINOR_VERSION@ @WHICH_PPDS@ -l $$language -p ppd/$$language; \
235	done
236	$(MAKE) ppd-catalog-clean
237
238dist-hook:
239	for dir in commands ; do \
240	  if test -d $(srcdir)/$$dir ; then \
241	    mkdir $(distdir)/$$dir; \
242	    for dirfile in $(srcdir)/$$dir/*; do \
243	      if test -f $$dirfile ; then \
244	        cp -p $$dirfile $(distdir)/$$dir; \
245	      fi \
246	    done \
247	  fi \
248	done
249
250clean-local: ppd-catalog-clean ppd-clean
251
252
253## Clean
254
255CLEANFILES = ppd-stamp
256DISTCLEANFILES = cups-genppdupdate
257MAINTAINERCLEANFILES = Makefile.in
258
259EXTRA_DIST = \
260	COPYING \
261	README \
262	calibrate.ppm \
263	command.txt \
264	command.types \
265	test-ppds
266