summaryrefslogtreecommitdiff
path: root/Makefile.in
blob: f70d2fffb098255e0bf74eadbf758c6a66634a4b (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

# Makefile to install foomatic-filters
# $Revision: 3.4.2.6 $

# PREFIX defaults to /usr/local for manually installed progs, so that they
# are not messed up on a system upgrade.
#
# `architecture independent', static data files i.e. perl libs go into
#   $(PREFIX)/share/foomatic
# (user) executables into $(PREFIX)/bin/
# system binaries go into $(PREFIX)/sbin
# configuration files into /etc/foomatic/*.
#

# Variables

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
bindir=@bindir@
sbindir=@sbindir@
mandir=@mandir@
sysconfdir=@sysconfdir@

PREFIX=$(prefix)
SRC=@srcdir@

BINDIR=$(bindir)
SBINDIR=$(sbindir)
MANDIR=$(mandir)
ETCDIR=$(sysconfdir)/foomatic
INSTALL=@INSTALL@

# Paths for CUPS
CUPS=@CUPS@
CUPS_FILTERS=@CUPS_FILTERS@
CUPS_BACKENDS=@CUPS_BACKENDS@

# Paths for PPR
PPR=@PPR@
PPR_INTERFACES=@PPR_INTERFACES@
PPR_LIB=@PPR_LIB@

# This is mainly useful for building a binary foomatic package
DESTDIR=

### Probably nothing to fiddle past here

# Files generated by the AC_OUTPUT call of "./configure"
AC_OUTPUT_FILES:=Makefile makeMan foomatic-gswrapper \
	foomatic-rip beh

# User programs and helper programs
BINFILES:=foomatic-gswrapper foomatic-rip

# Filters, only useful for admins
SBINFILES:=

# Masks for trash files which have to be removed before packaging Foomatic
TRASHFILES:="*~" "*\#*" ".??*" "*.rej"

all: build

# The install rule should check for kitloads and avoid stomping.  It doesn't
install: install-main install-cups install-ppr

install-main: install-bin install-man install-etc

check-config:
	@if [ -f .testing-stamp ] ; then \
	  echo 'Cowardly refusing to install inplace-built filters.' ;\
	  echo 'Use "make inplace_clean; make" to get proper ones.' ;\
	  exit 1 ;\
	fi

install-cups: check-config
	${SRC}/mkinstalldirs $(DESTDIR)$(CUPS_FILTERS)
	${SRC}/mkinstalldirs $(DESTDIR)$(CUPS_BACKENDS)
	ln -sf $(BINDIR)/foomatic-rip $(DESTDIR)$(CUPS_FILTERS)
	${INSTALL} -m 755 beh $(DESTDIR)$(CUPS_BACKENDS)

install-ppr: check-config
	${SRC}/mkinstalldirs $(DESTDIR)$(PPR_INTERFACES)
	${SRC}/mkinstalldirs $(DESTDIR)$(PPR_LIB)
	ln -sf $(BINDIR)/foomatic-rip $(DESTDIR)$(PPR_INTERFACES)
	ln -sf $(BINDIR)/foomatic-rip $(DESTDIR)$(PPR_LIB)

install-bin: check-config
	${SRC}/mkinstalldirs $(DESTDIR)$(BINDIR)
	${INSTALL} -m 755 $(BINFILES) $(DESTDIR)$(BINDIR)
#	${INSTALL} -m 755 $(SBINFILES) $(DESTDIR)$(SBINDIR)

install-etc: check-config
	${SRC}/mkinstalldirs $(DESTDIR)$(ETCDIR)/direct
	${INSTALL} -m 644 ${SRC}/filter.conf $(DESTDIR)$(ETCDIR)/filter.conf.sample
	if [ ! -f  $(DESTDIR)$(ETCDIR)/filter.conf ] ; then ${INSTALL} -m 644 ${SRC}/filter.conf $(DESTDIR)$(ETCDIR); fi;

install-man: check-config
	${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)
	${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)/man1
#	${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)/man8
	${INSTALL} -m 644 *.1 $(DESTDIR)$(MANDIR)/man1
#	cp -f *.8 $(DESTDIR)$(MANDIR)/man8

build:  man
	chmod a+rx foomatic-rip foomatic-gswrapper beh

man:
	chmod a+rx ./makeMan
	if [ "$(INPLACE)" = "--inplace" ]; then \
	  FOOMATIC_RIP=`pwd`/foomatic-rip; \
	  FOO_ETC=`pwd`/etc/foomatic; \
	  PRINTCAP=@PRINTCAP@; \
	else \
	  FOOMATIC_RIP=$(BINDIR)/foomatic-rip; \
	  FOO_ETC=$(ETCDIR); \
	  PRINTCAP=@PRINTCAP@; \
	fi; \
	export FOOMATIC_RIP FOO_ETC PRINTCAP; \
	./makeMan ${SRC}/*[0-9].in

# Clean up the source directory
clean: remove-trash
	rm -f .testing-stamp
	rm -f $(BINFILES:=.1) $(SBINFILES:=.8) test/*.out

distclean: clean
	rm -f $(AC_OUTPUT_FILES) config.log config.status config.cache configure.lineno
	rm -rf autom*.cache confdefs.h

maintainer-clean: distclean
	rm -f configure aclocal.m4

# Remove editor backup and temporary files
remove-trash:
	for m in $(TRASHFILES); do \
	  find . -name "$$m" -exec rm "{}" \; ; \
	done

# Uninstall an installed Foomatic

uninstall: uninstall-cups uninstall-ppr uninstall-main

uninstall-main: uninstall-bin uninstall-man

uninstall-bin: check-config
	( cd $(DESTDIR)$(BINDIR) && \
	  rm -f $(BINFILES) \
	)
#	( cd $(DESTDIR)$(SBINDIR) && \
#	  rm -f $(SBINFILES) \
#	)

uninstall-etc: check-config
	rm -f $(DESTDIR)$(ETCDIR)/filter.conf
	rm -f $(DESTDIR)$(ETCDIR)/filter.conf.sample
	rmdir $(DESTDIR)$(ETCDIR)/direct || :
	rmdir $(DESTDIR)$(ETCDIR) || :

uninstall-cups: check-config
	rm -f $(DESTDIR)$(CUPS_FILTERS)/foomatic-rip
	rm -f $(DESTDIR)$(CUPS_BACKENDS)/beh
	rmdir $(DESTDIR)$(CUPS_FILTERS) || :
	rmdir $(DESTDIR)$(CUPS_BACKENDS) || :
	rmdir $(DESTDIR)$(CUPS) || :

uninstall-ppr: check-config
	rm -f $(DESTDIR)$(PPR_INTERFACES)/foomatic-rip
	rmdir $(DESTDIR)$(PPR_INTERFACES) || :
	rm -f $(DESTDIR)$(PPR_LIB)/foomatic-rip
	rmdir $(DESTDIR)$(PPR_LIB) || :
	rmdir $(DESTDIR)$(PPR) || :

uninstall-man: check-config
	for m in $(BINFILES); do \
	  rm -f $(DESTDIR)$(MANDIR)/man1/$$m.*; \
	done
#	for m in $(SBINFILES); do \
#	  rm -f $(DESTDIR)$(MANDIR)/man8/$$m.*; \
#	done

# Various testing/debugging/etc targets
inplace: testing
testing: INPLACE = --inplace
testing: build
	touch .testing-stamp

inplace-clean: testing_clean
testing-clean: clean

# We need to export all Variables for makeDefaults and the scripts target to
# work.
.EXPORT_ALL_VARIABLES:

# Use INPLACE=--inplace to get the special run-in-place Defaults.

.PHONY: all check-config build install install-bin \
	man inplace testing clean inplace-clean testing-clean distclean \
	maintainer-clean