1## Copyright (C) 2000 Roger Leigh
2##
3## This program is free software; you can redistribute it and/or modify
4## it under the terms of the GNU General Public License as published by
5## the Free Software Foundation; either version 2, or (at your option)
6## any later version.
7##
8## This program is distributed in the hope that it will be useful,
9## but WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11## GNU General Public License for more details.
12##
13## You should have received a copy of the GNU General Public License
14## along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16## Process this file with automake to produce Makefile.in.
17
18@SET_MAKE@
19
20include $(top_srcdir)/scripts/global.mk
21
22
23## Variables
24
25empty=
26PACKAGE = cups
27
28BASE_VERSION = \"@GUTENPRINT_BASE_VERSION@\"
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
39
40if BUILD_LIBUSB_BACKENDS
41cupsexec_backenddir = $(pkglibdir)/backend
42cupsdata_blacklistdir = $(pkgdatadir)/usb/
43endif
44
45if CUPS_PPDS_AT_TOP_LEVEL
46cups_modeldir = $(pkgdatadir)/model/
47DONT_UNINSTALL_PPDS=true
48else
49cups_modeldir = $(pkgdatadir)/model/gutenprint/@GUTENPRINT_RELEASE_VERSION@/
50endif
51
52LOCAL_CPPFLAGS = $(GUTENPRINT_CFLAGS) $(CUPS_CFLAGS) -DBASE_VERSION=$(BASE_VERSION) -DSBINDIR=\"$(sbindir)/\"
53
54PPD_DIR=ppd
55
56STP_NONLS_ENV= STP_MODULE_PATH=$(top_builddir)/src/main/.libs:$(top_builddir)/src/main STP_DATA_PATH=$(top_srcdir)/src/xml STP_LOCALEDIR=
57
58STP_ENV= $(STP_NONLS_ENV) STP_LOCALEDIR=$(top_builddir)/src/cups/$(PPD_DIR)catalog
59
60## Programs
61if BUILD_TRANSLATED_CUPS_PPDS
62if BUILD_GLOBALIZED_CUPS_PPDS
63PPD = ppd-global
64else
65PPD = $(PPD_NLS_1)
66endif
67LINGUAS = $(ALL_LINGUAS)
68TRANSLATE_PPDS = -DCUPS_TRANSLATED_PPDS
69else
70PPD = ppd-nonls
71endif
72
73if BUILD_SIMPLIFIED_CUPS_PPDS
74BUILD_SIMPLE_PPDS=-DGENERATE_SIMPLIFIED_PPDS
75endif
76
77if BUILD_CUPS_1_2
78cupsexec_driver_PROGRAMS = gutenprint.@GUTENPRINT_RELEASE_VERSION@
79endif
80
81if BUILD_CUPS
82bin_PROGRAMS = cups-calibrate
83sbin_PROGRAMS = cups-genppd.@GUTENPRINT_RELEASE_VERSION@
84sbin_SCRIPTS = cups-genppdupdate
85cupsexec_filter_PROGRAMS = rastertogutenprint.@GUTENPRINT_RELEASE_VERSION@ commandtoepson commandtocanon
86
87if BUILD_LIBUSB_BACKENDS
88cupsexec_backend_PROGRAMS = backend_gutenprint
89endif
90
91## CUPS backends require no world-execute permissions if they are to be
92## executed as root, and the backend must be run as root.
93## See http://www.cups.org/documentation.php/doc-1.6/man-backend.html
94if BUILD_LIBUSB_BACKENDS
95install-exec-hook:
96	chmod 700 $(DESTDIR)$(pkglibdir)/backend/backend_gutenprint
97	mv $(DESTDIR)$(pkglibdir)/backend/backend_gutenprint "$(DESTDIR)$(pkglibdir)/backend/gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb"
98endif
99
100AM_TESTS_ENVIRONMENT=$(STP_ENV)
101test-rastertogutenprint: min-pagesize
102test-rastertogutenprint.test: test-rastertogutenprint
103TESTS= test-ppds.test test-rastertogutenprint.test
104test-rastertogutenprint.log: test-ppds.log
105
106noinst_SCRIPTS=test-ppds.test \
107	test-rastertogutenprint \
108	test-rastertogutenprint.test \
109	min-pagesize
110endif
111
112if BUILD_GENPPD_STATIC
113STATIC_LDOPTS=-static -export-dynamic
114endif
115
116cups_calibrate_SOURCES = cups-calibrate.c
117cups_calibrate_LDADD = -lm
118
119commandtocanon_SOURCES = commandtocanon.c
120commandtocanon_LDADD = $(CUPS_LIBS)
121
122commandtoepson_SOURCES = commandtoepson.c
123commandtoepson_LDADD = $(CUPS_LIBS)
124
125if BUILD_LIBUSB_BACKENDS
126backend_gutenprint_SOURCES = backend_canonselphy.c backend_canonselphyneo.c backend_kodak1400.c backend_kodak6800.c backend_kodak605.c backend_shinkos2145.c backend_sonyupd.c backend_dnpds40.c backend_mitsu70x.c backend_mitsu9550.c backend_sinfonia.c backend_sinfonia.h backend_common.c backend_common.h backend_shinkos1245.c backend_shinkos6145.c backend_shinkos6245.c backend_mitsup95d.c backend_magicard.c backend_mitsud90.c
127
128backend_gutenprint_LDADD = $(LIBUSB_LIBS) $(LIBUSB_BACKEND_LIBDEPS)
129backend_gutenprint_CPPFLAGS = $(LIBUSB_CFLAGS) -DURI_PREFIX=\"gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb\" -DLIBUSB_PRE_1_0_10
130endif
131
132cups_genppd_@GUTENPRINT_RELEASE_VERSION@_SOURCES = cups-genppd.c genppd.c genppd.h i18n.c i18n.h
133cups_genppd_@GUTENPRINT_RELEASE_VERSION@_CFLAGS = -DALL_LINGUAS='"$(ALL_LINGUAS)"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS)
134cups_genppd_@GUTENPRINT_RELEASE_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS) @LIBICONV@
135cups_genppd_@GUTENPRINT_RELEASE_VERSION@_LDFLAGS = $(STATIC_LDOPTS)
136
137gutenprint_@GUTENPRINT_RELEASE_VERSION@_SOURCES = gutenprint.c genppd.c genppd.h i18n.c i18n.h
138gutenprint_@GUTENPRINT_RELEASE_VERSION@_CFLAGS = -DALL_LINGUAS='"$(ALL_LINGUAS)"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS)
139gutenprint_@GUTENPRINT_RELEASE_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS) @LIBICONV@
140gutenprint_@GUTENPRINT_RELEASE_VERSION@_LDFLAGS = $(STATIC_LDOPTS)
141
142rastertogutenprint_@GUTENPRINT_RELEASE_VERSION@_SOURCES = rastertogutenprint.c i18n.c i18n.h
143rastertogutenprint_@GUTENPRINT_RELEASE_VERSION@_LDADD = $(CUPS_LIBS) $(GUTENPRINT_LIBS) @LIBICONV@
144rastertogutenprint_@GUTENPRINT_RELEASE_VERSION@_LDFLAGS = $(STATIC_LDOPTS)
145
146
147## Data
148
149if BUILD_CUPS
150CUPS_PKG = calibrate.ppm
151endif
152if BUILD_CUPS
153CUPS_CONF = command.types
154endif
155
156pkgdata_DATA = $(CUPS_PKG)
157pkgsysconf_DATA = $(CUPS_CONF)
158
159if BUILD_CUPS_PPDS
160INSTALL_DATA_LOCAL_DEPS = ppd-stamp
161endif
162
163if USE_NLS
164PPD_NLS_1 = ppd-nls
165endif
166
167if BUILD_LIBUSB_BACKENDS
168INSTALL_BLACKLIST=install-blacklist
169install-blacklist:
170	$(MKDIR_P) $(DESTDIR)$(cupsdata_blacklistdir)
171	$(INSTALL_DATA) $(srcdir)/blacklist $(DESTDIR)$(cupsdata_blacklistdir)/net.sf.gimp-print.usb-quirks
172endif
173
174install-data-local: $(INSTALL_DATA_LOCAL_DEPS) $(INSTALL_BLACKLIST)
175	if test -n "$(CUPS_PKG)" -a -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
176	  $(MKDIR_P) $(DESTDIR)$(cups_modeldir); \
177	  cd ppd ; \
178	  for language in * ; do \
179	    cd ..; \
180	    $(MKDIR_P) $(DESTDIR)$(cups_modeldir)/$$language; \
181	    cd ppd/$$language; \
182	    for ppdfile in * ; do \
183	      (cd ../..; $(INSTALL_DATA) ppd/$$language/$$ppdfile $(DESTDIR)$(cups_modeldir)/$$language) ; \
184	    done; \
185	  cd ..; \
186	  done \
187	fi
188	$(MKDIR_P) "$(DESTDIR)$(localedir)"
189	for file in $(srcdir)/../../po/*.po; do \
190	  lang=`basename $$file .po`; \
191	  $(MKDIR_P) "$(DESTDIR)$(localedir)/$$lang"; \
192	  $(INSTALL_DATA) $$file "$(DESTDIR)$(localedir)/$$lang/gutenprint_$$lang.po"; \
193	done
194
195uninstall-local: $(INSTALL_DATA_LOCAL_DEPS) $(INSTALL_BLACKLIST)
196# Remove PPDs installed in new PPD location
197	if test -z "DONT_UNINSTALL_PPDS" ; then \
198	  if test -n "$(INSTALL_DATA_LOCAL_DEPS)" ; then \
199	    $(RM) -fr $(DESTDIR)$(cups_modeldir)/* ; \
200	  fi ; \
201	fi
202	for file in $(srcdir)/../../po/*.po; do \
203	  lang=`basename $$file .po`; \
204	  $(RM) "$(DESTDIR)$(localedir)/$$lang/gutenprint_$$lang.po"; \
205	done
206	$(RM) -f "$(DESTDIR)$(cupsdata_blacklistdir)/net.sf.gimp-print.usb-quirks"
207	$(RM) -f "$(DESTDIR)$(pkglibdir)/backend/gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb"
208
209install-data-hook:
210# Remove unused directories in install tree
211	-@echo 'Expect a number of "rmdir: Directory not empty" warnings'
212	-@echo 'These messages are harmless and should be ignored.'
213	-rmdir $(DESTDIR)$(cups_modeldir)
214	-rmdir $(DESTDIR)$(pkgdatadir)
215	-rmdir $(DESTDIR)$(cupsexec_driverdir)
216	-rmdir $(DESTDIR)$(cupsexec_filterdir)
217	-rmdir $(DESTDIR)$(cupsexec_backenddir)
218	-rmdir $(DESTDIR)$(cupsdata_blacklistdir)
219	-rmdir $(DESTDIR)$(bindir)
220	-rmdir $(DESTDIR)$(sbindir)
221	-rmdir $(DESTDIR)$(pkglibdir)
222	-rmdir $(DESTDIR)$(pkgsysconfdir)
223	-rmdir `dirname $(DESTDIR)$(pkgdatadir)`
224	-rmdir `dirname $(DESTDIR)$(pkglibdir)`
225	-rmdir `dirname $(DESTDIR)$(pkgsysconfdir)`
226
227.PHONY: ppd ppd-stamp-pre ppd-stamp-nonls ppd-stamp-nls ppd-stamp-phony \
228	ppd-catalog-clean ppd-clean $(INSTALL_BLACKLIST)
229
230all-local: $(INSTALL_DATA_LOCAL_DEPS)
231
232ppd: ppd-stamp
233
234ppd-stamp: cups-genppd.@GUTENPRINT_RELEASE_VERSION@ $(top_srcdir)/src/xml/xml-stamp ppd-stamp-pre
235	$(MAKE) ppd-stamp-pre
236	$(MAKE) ppd-stamp-phony
237	touch ppd-stamp
238
239ppd-stamp-phony: $(PPD)
240
241ppd-catalog-clean:
242	$(RM) -rf $(PPD_DIR)catalog
243
244ppd-clean:
245	$(RM) -rf $(PPD_DIR)
246
247ppd-stamp-pre: ppd-catalog-clean ppd-clean
248
249ppd-catalog: ppd-catalog-clean
250	$(MKDIR_P) catalog
251	for file in $(top_srcdir)/po/*.po; do \
252	  lang=`basename $$file .po`; \
253	  $(MKDIR_P) "$(PPD_DIR)catalog/$$lang"; \
254	  $(INSTALL_DATA) $$file "$(PPD_DIR)catalog/$$lang/gutenprint_$$lang.po"; \
255	done
256
257ppd-nonls: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
258	@echo "Non-localized PPDs:"
259	$(MKDIR_P) $(PPD_DIR)/C
260	$(MAKE) ppd-catalog-clean
261	LC_ALL= LANG= LANGUAGE= $(STP_NONLS_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -l C -p $(PPD_DIR)/C @WHICH_PPDS@ $(EXTRA_GENPPD_OPTS)
262
263ppd-nonls-a: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
264	@echo "Non-localized PPDs (all):"
265	$(MKDIR_P) $(PPD_DIR)/C
266	$(MAKE) ppd-catalog-clean
267	LC_ALL= LANG= LANGUAGE= $(STP_NONLS_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -l C -p $(PPD_DIR)/C -a $(EXTRA_GENPPD_OPTS)
268
269ppd-nonls-s: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
270	@echo "Non-localized PPDs (simplified):"
271	$(MKDIR_P) $(PPD_DIR)/C
272	$(MAKE) ppd-catalog-clean
273	LC_ALL= LANG= LANGUAGE= $(STP_NONLS_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -l C -p $(PPD_DIR)/C -s $(EXTRA_GENPPD_OPTS)
274
275ppd-global: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
276	@echo "Global PPDs:"
277	$(MKDIR_P) $(PPD_DIR)/Global
278	$(MAKE) ppd-catalog
279	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -p $(PPD_DIR)/Global @WHICH_PPDS@ $(EXTRA_GENPPD_OPTS)
280	$(MAKE) ppd-catalog-clean
281
282ppd-global-a: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
283	@echo "Global PPDs (all):"
284	$(MKDIR_P) $(PPD_DIR)/Global
285	$(MAKE) ppd-catalog
286	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -p $(PPD_DIR)/Global -a $(EXTRA_GENPPD_OPTS)
287	$(MAKE) ppd-catalog-clean
288
289ppd-global-s: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
290	@echo "Global PPDs (simplified):"
291	$(MKDIR_P) $(PPD_DIR)/Global
292	$(MAKE) ppd-catalog
293	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -p $(PPD_DIR)/Global -s $(EXTRA_GENPPD_OPTS)
294	$(MAKE) ppd-catalog-clean
295
296ppd-global-ln: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
297	@echo "Global PPDs (localized numbers for testing):"
298	$(MKDIR_P) $(PPD_DIR)/Global
299	$(MAKE) ppd-catalog
300	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -p $(PPD_DIR)/Global -N @WHICH_PPDS@ $(EXTRA_GENPPD_OPTS)
301	$(MAKE) ppd-catalog-clean
302
303ppd-global-ln-a: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
304	@echo "Global PPDs (all, localized numbers for testing):"
305	$(MKDIR_P) $(PPD_DIR)/Global
306	$(MAKE) ppd-catalog
307	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -p $(PPD_DIR)/Global -N -a $(EXTRA_GENPPD_OPTS)
308	$(MAKE) ppd-catalog-clean
309
310ppd-global-ln-s: cups-genppd.@GUTENPRINT_RELEASE_VERSION@
311	@echo "Global PPDs (all, localized numbers for testing):"
312	$(MKDIR_P) $(PPD_DIR)/Global
313	$(MAKE) ppd-catalog
314	LC_ALL= LANG= LANGUAGE= $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -p $(PPD_DIR)/Global -N -s $(EXTRA_GENPPD_OPTS)
315	$(MAKE) ppd-catalog-clean
316
317ppd-nls: cups-genppd.@GUTENPRINT_RELEASE_VERSION@ ppd-nonls
318	@echo "Localized PPD files:"
319	$(MKDIR_P) ppd
320	$(MAKE) ppd-catalog
321	for language in `$(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ @WHICH_PPDS@ -L` ; do \
322	  $(MKDIR_P) $(PPD_DIR)/$$language ; \
323	  echo -n "$$language: " ; \
324	  LC_ALL=$$language LANG=$$language LANGUAGE=$$language $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ -l $$language -p $(PPD_DIR)/$$language $(EXTRA_GENPPD_OPTS); \
325	done
326	$(MAKE) ppd-catalog-clean
327
328ppd-nls-a: cups-genppd.@GUTENPRINT_RELEASE_VERSION@ @WHICH_PPDS@ ppd-nonls
329	@echo "Localized PPD files (all):"
330	$(MKDIR_P) ppd
331	$(MAKE) ppd-catalog
332	for language in `$(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ @WHICH_PPDS@ -L` ; do \
333	  $(MKDIR_P) $(PPD_DIR)/$$language ; \
334	  echo -n "$$language: " ; \
335	  LC_ALL=$$language LANG=$$language LANGUAGE=$$language $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ @WHICH_PPDS@ -l $$language -p $(PPD_DIR)/$$language -a $(EXTRA_GENPPD_OPTS); \
336	done
337	$(MAKE) ppd-catalog-clean
338
339ppd-nls-s: cups-genppd.@GUTENPRINT_RELEASE_VERSION@ @WHICH_PPDS@ ppd-nonls
340	@echo "Localized PPD files (simplified):"
341	$(MKDIR_P) ppd
342	$(MAKE) ppd-catalog
343	for language in `$(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ @WHICH_PPDS@ -L` ; do \
344	  $(MKDIR_P) $(PPD_DIR)/$$language ; \
345	  echo -n "$$language: " ; \
346	  LC_ALL=$$language LANG=$$language LANGUAGE=$$language $(STP_ENV) ./cups-genppd.@GUTENPRINT_RELEASE_VERSION@ @WHICH_PPDS@ -l $$language -p $(PPD_DIR)/$$language -s $(EXTRA_GENPPD_OPTS); \
347	done
348	$(MAKE) ppd-catalog-clean
349
350dist-hook:
351	for dir in commands ; do \
352	  if test -d $(srcdir)/$$dir ; then \
353	    mkdir $(distdir)/$$dir; \
354	    for dirfile in $(srcdir)/$$dir/*; do \
355	      if test -f $$dirfile ; then \
356	        cp -p $$dirfile $(distdir)/$$dir; \
357	      fi \
358	    done \
359	  fi \
360	done
361
362clean-local: ppd-catalog-clean ppd-clean
363
364
365## Clean
366
367CLEANFILES = ppd-stamp
368DISTCLEANFILES = cups-genppdupdate test-ppds.test
369MAINTAINERCLEANFILES = Makefile.in
370
371EXTRA_DIST = \
372	COPYING \
373	blacklist \
374	calibrate.ppm \
375	command.txt \
376	command.types
377