summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 1f12fbbaa0b5dbea094fdf6fe41e4a21a297ed83 (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

# 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=

bin_PROGRAMS = foomatic-rip

foomatic_ripdir = .
foomatic_rip_SOURCES = \
	foomaticrip.c \
	foomaticrip.h \
	options.c \
	options.h \
	pdf.c \
	pdf.h \
	postscript.c \
	postscript.h \
	util.c \
	util.h \
	spooler.h \
	spooler.c \
	process.h \
	process.c \
	renderer.c \
	renderer.h \
	fileconverter.c \
	fileconverter.h

if BUILD_DBUS
foomatic_rip_SOURCES += \
	colord.c \
	colord.h

foomatic_rip_CFLAGS = $(DBUS_CFLAGS) -DHAVE_DBUS
foomatic_rip_LDADD = $(DBUS_LIBS)
endif

AM_CPPFLAGS = -DCONFIG_PATH='"$(sysconfdir)/foomatic"'

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

# 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-cups:	install-bin
	${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:	install-bin
	${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:	install-etc
	${SRC}/mkinstalldirs $(DESTDIR)$(BINDIR)
	(for FILE in $(bin_PROGRAMS) ; do \
		${INSTALL} -m 755 $$FILE $(DESTDIR)$(BINDIR) ; done)

install-etc:
	${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:
	${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)
	${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)/man1
	(for FILE in *.1 ; do \
		${INSTALL} -m 444 $$FILE $(DESTDIR)$(MANDIR)/man1 ; done)

# Clean up the source directory
clean:	remove-trash
	rm -f *.o foomatic-rip foomatic-rip.1 beh 
	rm -f .testing-stamp stamp-h1
	rm -f test/*.out

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

maintainer-clean:	distclean
	rm -f configure config.h.in Makefile.in aclocal.m4 INSTALL VERSION.full
	rm -f depcomp missing 
# Remove editor backup and temporary files
remove-trash:
	for m in $(TRASHFILES); do \
	  find . -name "$$m" -xtype f -exec rm -f "{}" \; ; \
	done

# Uninstall an installed Foomatic

uninstall:	uninstall-cups uninstall-ppr uninstall-main

uninstall-main:	uninstall-bin uninstall-man

uninstall-bin:
	( cd $(DESTDIR)$(BINDIR) && \
	  rm -f $(bin_PROGRAMS) \
	)

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

uninstall-cups:
	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:
	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 $(bin_PROGRAMS); do \
	  rm -f $(DESTDIR)$(MANDIR)/man1/$$m.*; \
	done

# Various testing/debugging/etc targets
inplace:	all
	chmod a+rx $(bin_PROGRAMS)

testing tests:	inplace
	cd tests ; $(MAKE)

.PHONY:	all install install-bin clean distclean maintainer-clean tests inplace