1#
2# "$Id: Makefile 11158 2013-07-17 18:31:56Z msweet $"
3#
4#   Backend makefile for CUPS.
5#
6#   Copyright 2007-2013 by Apple Inc.
7#   Copyright 1997-2007 by Easy Software Products, all rights reserved.
8#
9#   These coded instructions, statements, and computer programs are the
10#   property of Apple Inc. and are protected by Federal copyright
11#   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
12#   which should have been included with this file.  If this file is
13#   file is missing or damaged, see the license at "http://www.cups.org/".
14#
15#   This file is subject to the Apple OS-Developed Software exception.
16#
17
18include ../Makedefs
19
20#
21# Object files...
22#
23
24# RBACKENDS are installed mode 0700 so cupsd will run them as root...
25#
26# UBACKENDS are installed mode 0755 so cupsd will run them as an unprivileged
27# user...
28#
29# See http://www.cups.org/documentation.php/api-filter.html for more info...
30RBACKENDS =	\
31		ipp \
32		lpd \
33		$(DNSSD_BACKEND)
34UBACKENDS =	\
35		snmp \
36		socket \
37		usb
38UNITTESTS =	\
39		test1284 \
40		testbackend \
41		testsupplies
42TARGETS =	\
43		libbackend.a \
44		$(RBACKENDS) \
45		$(UBACKENDS)
46LIBOBJS	=	\
47		ieee1284.o \
48		network.o \
49		runloop.o \
50		snmp-supplies.o
51OBJS	=	\
52		ipp.o \
53		lpd.o \
54		dnssd.o \
55		snmp.o \
56		socket.o \
57		test1284.o \
58		testbackend.o \
59		testsupplies.o \
60		usb.o
61
62
63#
64# Make all targets...
65#
66
67all:	$(TARGETS)
68
69
70#
71# Make library targets...
72#
73
74libs:
75
76
77#
78# Make unit tests...
79#
80
81unittests:	$(UNITTESTS)
82
83
84#
85# Clean all object files...
86#
87
88clean:
89	$(RM) $(OBJS) $(TARGETS) $(UNITTESTS) $(LIBOBJS) http https ipps mdns
90
91
92#
93# Update dependencies (without system header dependencies...)
94#
95
96depend:
97	$(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
98
99
100#
101# Install all targets...
102#
103
104install:	all install-data install-headers install-libs install-exec
105
106
107#
108# Install data files...
109#
110
111install-data:
112	if test "x$(USBQUIRKS)" != x; then \
113		echo Installing USB quirks in $(USBQUIRKS); \
114		$(INSTALL_DIR) -m 755 $(USBQUIRKS); \
115		$(INSTALL_DATA) org.cups.usb-quirks $(USBQUIRKS); \
116	fi
117
118
119#
120# Install programs...
121#
122
123install-exec:	$(INSTALLXPC)
124	echo Installing backends in $(SERVERBIN)/backend
125	$(INSTALL_DIR) -m 755 $(SERVERBIN)/backend
126	for file in $(RBACKENDS); do \
127		$(LIBTOOL) $(INSTALL_BIN) -m 700 $$file $(SERVERBIN)/backend; \
128	done
129	for file in $(UBACKENDS); do \
130		$(INSTALL_BIN) $$file $(SERVERBIN)/backend; \
131	done
132	for file in $(IPPALIASES); do \
133		$(RM) $(SERVERBIN)/backend/$$file; \
134		$(LN) ipp $(SERVERBIN)/backend/$$file; \
135	done
136	if test "x$(DNSSD_BACKEND)" != x -a `uname` = Darwin; then \
137		$(RM) $(SERVERBIN)/backend/mdns; \
138		$(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \
139	fi
140	if test "x$(SYMROOT)" != "x"; then \
141		$(INSTALL_DIR) $(SYMROOT); \
142		for file in $(RBACKENDS) $(UBACKENDS); do \
143			cp $$file $(SYMROOT); \
144			dsymutil $(SYMROOT)/$$file; \
145		done \
146	fi
147
148install-xpc:	ipp
149	echo Installing XPC backends in $(SERVERBIN)/apple
150	$(INSTALL_DIR) -m 755 $(SERVERBIN)/apple
151	$(LIBTOOL) $(INSTALL_BIN) ipp $(SERVERBIN)/apple
152	for file in $(IPPALIASES); do \
153		$(RM) $(SERVERBIN)/apple/$$file; \
154		$(LN) ipp $(SERVERBIN)/apple/$$file; \
155	done
156
157
158#
159# Install headers...
160#
161
162install-headers:
163
164
165#
166# Install libraries...
167#
168
169install-libs:
170
171
172#
173# Uninstall all targets...
174#
175
176uninstall:
177	$(RM) $(SERVERBIN)/apple/ipp
178	for file in $(IPPALIASES); do \
179		$(RM) $(SERVERBIN)/apple/$$file; \
180	done
181	-$(RMDIR) $(SERVERBIN)/apple
182	for file in $(RBACKENDS) $(UBACKENDS); do \
183		$(RM) $(SERVERBIN)/backend/$$file; \
184	done
185	for file in $(IPPALIASES); do \
186		$(RM) $(SERVERBIN)/backend/$$file; \
187	done
188	-$(RMDIR) $(SERVERBIN)/backend
189	-$(RMDIR) $(SERVERBIN)
190
191
192#
193# test1284
194#
195
196test1284:	test1284.o ../cups/$(LIBCUPSSTATIC)
197	echo Linking $@...
198	$(CC) $(LDFLAGS) -o test1284 test1284.o ../cups/$(LIBCUPSSTATIC) \
199		$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
200
201
202#
203# testbackend
204#
205
206testbackend:	testbackend.o ../cups/$(LIBCUPSSTATIC)
207	echo Linking $@...
208	$(CC) $(LDFLAGS) -o testbackend testbackend.o ../cups/$(LIBCUPSSTATIC) \
209		$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
210
211
212#
213# testsupplies
214#
215
216testsupplies:	testsupplies.o libbackend.a ../cups/$(LIBCUPSSTATIC)
217	echo Linking $@...
218	$(CC) $(LDFLAGS) -o testsupplies testsupplies.o libbackend.a \
219		../cups/$(LIBCUPSSTATIC) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
220		$(COMMONLIBS) $(LIBZ)
221
222
223#
224# libbackend.a
225#
226
227libbackend.a:	$(LIBOBJS)
228	echo Archiving $@...
229	$(RM) $@
230	$(AR) $(ARFLAGS) $@ $(LIBOBJS)
231	$(RANLIB) $@
232
233
234#
235# dnssd
236#
237
238dnssd:	dnssd.o ../cups/$(LIBCUPS) libbackend.a
239	echo Linking $@...
240	$(CC) $(LDFLAGS) -o dnssd dnssd.o libbackend.a $(LIBS)
241	if test `uname` = Darwin; then \
242		$(RM) mdns; \
243		$(LN) dnssd mdns; \
244	fi
245
246
247#
248# ipp
249#
250
251ipp:	ipp.o ../cups/$(LIBCUPS) libbackend.a
252	echo Linking $@...
253	$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
254	$(RM) http
255	$(LN) ipp http
256
257
258#
259# lpd
260#
261
262lpd:	lpd.o ../cups/$(LIBCUPS) libbackend.a
263	echo Linking $@...
264	$(CC) $(LDFLAGS) -o lpd lpd.o libbackend.a $(LIBS)
265
266
267#
268# snmp
269#
270
271snmp:	snmp.o ../cups/$(LIBCUPS) libbackend.a
272	echo Linking $@...
273	$(CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
274
275
276#
277# socket
278#
279
280socket:	socket.o ../cups/$(LIBCUPS) libbackend.a
281	echo Linking $@...
282	$(CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
283
284
285#
286# usb
287#
288
289usb:	usb.o ../cups/$(LIBCUPS) libbackend.a
290	echo Linking $@...
291	$(CC) $(ARCHFLAGS) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
292		$(BACKLIBS) $(LIBS)
293usb.o:	usb.c usb-darwin.c usb-libusb.c usb-unix.c
294
295
296#
297# Dependencies...
298#
299
300include Dependencies
301
302
303#
304# End of "$Id: Makefile 11158 2013-07-17 18:31:56Z msweet $".
305#
306