1#
2# Filter makefile for CUPS.
3#
4# Copyright 2007-2017 by Apple Inc.
5# Copyright 1997-2006 by Easy Software Products.
6#
7# These coded instructions, statements, and computer programs are the
8# property of Apple Inc. and are protected by Federal copyright
9# law.  Distribution and use rights are outlined in the file "LICENSE.txt"
10# which should have been included with this file.  If this file is
11# missing or damaged, see the license at "http://www.cups.org/".
12#
13# This file is subject to the Apple OS-Developed Software exception.
14#
15
16include ../Makedefs
17
18
19FILTERS	=	\
20		commandtops \
21		gziptoany \
22		pstops \
23		rastertoepson \
24		rastertohp \
25		rastertolabel \
26		rastertopwg
27LIBTARGETS =	\
28		$(LIBCUPSIMAGE) \
29		libcupsimage.a
30UNITTARGETS =	\
31		rasterbench \
32		testclient \
33		testraster
34TARGETS	=	\
35		$(LIBTARGETS) \
36		$(FILTERS)
37
38IMAGEOBJS =	error.o interpret.o raster.o
39OBJS	=	$(IMAGEOBJS) \
40		commandtops.o gziptoany.o common.o pstops.o \
41		rasterbench.o rastertoepson.o rastertohp.o rastertolabel.o \
42		rastertopwg.o testclient.o testraster.o
43
44
45#
46# Make all targets...
47#
48
49all:	$(TARGETS)
50
51
52#
53# Make library targets...
54#
55
56libs:		$(LIBTARGETS)
57
58
59#
60# Make unit tests...
61#
62
63unittests:	$(UNITTARGETS)
64
65
66#
67# Clean all object files...
68#
69
70clean:
71	$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
72	$(RM) libcupsimage.so libcupsimage.sl libcupsimage.dylib
73
74
75#
76# Update dependencies (without system header dependencies...)
77#
78
79depend:
80	$(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
81
82
83#
84# Install all targets...
85#
86
87install:	all install-data install-headers install-libs install-exec
88
89
90#
91# Install data files...
92#
93
94install-data:
95
96
97#
98# Install programs...
99#
100
101install-exec:
102	$(INSTALL_DIR) -m 755 $(SERVERBIN)/filter
103	for file in $(FILTERS); do \
104		$(INSTALL_BIN) $$file $(SERVERBIN)/filter; \
105	done
106	$(RM) $(SERVERBIN)/filter/rastertodymo
107	$(LN) rastertolabel $(SERVERBIN)/filter/rastertodymo
108	if test "x$(SYMROOT)" != "x"; then \
109		$(INSTALL_DIR) $(SYMROOT); \
110		for file in $(FILTERS); do \
111			cp $$file $(SYMROOT); \
112			dsymutil $(SYMROOT)/$$file; \
113		done \
114	fi
115
116
117#
118# Install headers...
119#
120
121install-headers:
122
123
124#
125# Install libraries...
126#
127
128install-libs: $(INSTALLSTATIC)
129	$(INSTALL_DIR) -m 755 $(LIBDIR)
130	$(INSTALL_LIB) $(LIBCUPSIMAGE) $(LIBDIR)
131	-if test $(LIBCUPSIMAGE) = "libcupsimage.so.2" -o $(LIBCUPSIMAGE) = "libcupsimage.sl.2"; then \
132		$(RM) $(LIBDIR)/`basename $(LIBCUPSIMAGE) .2`; \
133		$(LN) $(LIBCUPSIMAGE) $(LIBDIR)/`basename $(LIBCUPSIMAGE) .2`; \
134	fi
135	-if test $(LIBCUPSIMAGE) = "libcupsimage.2.dylib"; then \
136		$(RM) $(LIBDIR)/libcupsimage.dylib; \
137		$(LN) $(LIBCUPSIMAGE) $(LIBDIR)/libcupsimage.dylib; \
138	fi
139	if test "x$(SYMROOT)" != "x"; then \
140		$(INSTALL_DIR) $(SYMROOT); \
141		cp $(LIBCUPSIMAGE) $(SYMROOT); \
142		dsymutil $(SYMROOT)/$(LIBCUPSIMAGE); \
143	fi
144
145installstatic:
146	$(INSTALL_DIR) -m 755 $(LIBDIR)
147	$(INSTALL_LIB) -m 755 libcupsimage.a $(LIBDIR)
148	$(RANLIB) $(LIBDIR)/libcupsimage.a
149	$(CHMOD) 555 $(LIBDIR)/libcupsimage.a
150
151
152#
153# Uninstall all targets...
154#
155
156uninstall:
157	for file in $(FILTERS); do \
158		$(RM) $(SERVERBIN)/filter/$$file; \
159	done
160	$(RM) $(SERVERBIN)/filter/rastertodymo
161	-$(RMDIR) $(SERVERBIN)/filter
162	-$(RMDIR) $(SERVERBIN)
163	$(RM) $(LIBDIR)/libcupsimage.2.dylib
164	$(RM) $(LIBDIR)/libcupsimage.a
165	$(RM) $(LIBDIR)/libcupsimage.dylib
166	$(RM) $(LIBDIR)/libcupsimage_s.a
167	$(RM) $(LIBDIR)/libcupsimage.sl
168	$(RM) $(LIBDIR)/libcupsimage.sl.2
169	$(RM) $(LIBDIR)/libcupsimage.so
170	$(RM) $(LIBDIR)/libcupsimage.so.2
171	-$(RMDIR) $(LIBDIR)
172
173
174#
175# Automatic API help files...
176#
177
178apihelp:
179	echo Generating CUPS API help files...
180	mxmldoc --section "Programming" --title "Raster API" \
181		--css ../doc/cups-printable.css \
182		--header api-raster.header --intro api-raster.shtml \
183		api-raster.xml \
184		../cups/raster.h interpret.c raster.c \
185		>../doc/help/api-raster.html
186	mxmldoc --tokens help/api-raster.html api-raster.xml >../doc/help/api-raster.tokens
187	$(RM) api-raster.xml
188	mxmldoc --section "Programming" \
189		--title "Developing PostScript Printer Drivers" \
190		--css ../doc/cups-printable.css \
191		--header postscript-driver.header \
192		--intro postscript-driver.shtml \
193		>../doc/help/postscript-driver.html
194	mxmldoc --section "Programming" \
195		--title "Introduction to the PPD Compiler" \
196		--css ../doc/cups-printable.css \
197		--header ppd-compiler.header \
198		--intro ppd-compiler.shtml \
199		>../doc/help/ppd-compiler.html
200	mxmldoc --section "Programming" \
201		--title "Developing Raster Printer Drivers" \
202		--css ../doc/cups-printable.css \
203		--header raster-driver.header \
204		--intro raster-driver.shtml \
205		>../doc/help/raster-driver.html
206	mxmldoc --section "Specifications" \
207		--title "CUPS PPD Extensions" \
208		--css ../doc/cups-printable.css \
209		--header spec-ppd.header \
210		--intro spec-ppd.shtml \
211		>../doc/help/spec-ppd.html
212
213
214#
215# commandtops
216#
217
218commandtops:	commandtops.o ../cups/$(LIBCUPS)
219	echo Linking $@...
220	$(LD_CC) $(LDFLAGS) -o $@ commandtops.o $(LIBS)
221
222
223#
224# gziptoany
225#
226
227gziptoany:	gziptoany.o ../Makedefs ../cups/$(LIBCUPS)
228	echo Linking $@...
229	$(LD_CC) $(LDFLAGS) -o $@ gziptoany.o $(LIBZ) $(LIBS)
230
231
232#
233# libcupsimage.so.2, libcupsimage.sl.2
234#
235
236libcupsimage.so.2 libcupsimage.sl.2:	$(IMAGEOBJS)
237	echo Linking $@...
238	$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS) $(DSOLIBS) \
239		-L../cups $(LINKCUPS)
240	$(RM) `basename $@ .2`
241	$(LN) $@ `basename $@ .2`
242
243
244#
245# libcupsimage.2.dylib
246#
247
248libcupsimage.2.dylib:	$(IMAGEOBJS) $(LIBCUPSIMAGEORDER)
249	echo Linking $@...
250	$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
251		-install_name $(libdir)/$@ \
252		-current_version 2.3.0 \
253		-compatibility_version 2.0.0 \
254		$(IMAGEOBJS) $(DSOLIBS) -L../cups $(LINKCUPS)
255	$(RM) libcupsimage.dylib
256	$(LN) $@ libcupsimage.dylib
257
258
259#
260# libcupsimage_s.a
261#
262
263libcupsimage_s.a:	$(IMAGEOBJS) libcupsimage_s.exp
264	echo Linking $@...
265	$(DSO) $(DSOFLAGS) -Wl,-berok,-bexport:libcupsimage_s.exp \
266		-o libcupsimage_s.o $(IMAGEOBJS) $(DSOLIBS)
267	$(RM) $@
268	$(AR) $(ARFLAGS) $@ libcupsimage_s.o
269
270
271#
272# libcupsimage.la
273#
274
275libcupsimage.la:       $(IMAGEOBJS)
276	echo Linking $@...
277	$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS:.o=.lo) $(DSOLIBS) \
278		-L../cups $(LINKCUPS) \
279		-rpath $(LIBDIR) -version-info 2:3
280
281
282#
283# libcupsimage.a
284#
285
286libcupsimage.a:	$(IMAGEOBJS)
287	echo Archiving $@...
288	$(RM) $@
289	$(AR) $(ARFLAGS) $@ $(IMAGEOBJS)
290	$(RANLIB) $@
291
292
293#
294# pstops
295#
296
297pstops:	pstops.o common.o ../cups/$(LIBCUPS)
298	echo Linking $@...
299	$(LD_CC) $(LDFLAGS) -o $@ pstops.o common.o $(LIBS)
300
301
302#
303# rastertoepson
304#
305
306rastertoepson:	rastertoepson.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
307	echo Linking $@...
308	$(LD_CC) $(LDFLAGS) -o $@ rastertoepson.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
309
310
311#
312# rastertohp
313#
314
315rastertohp:	rastertohp.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
316	echo Linking $@...
317	$(LD_CC) $(LDFLAGS) -o $@ rastertohp.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
318
319
320#
321# rastertolabel
322#
323
324rastertolabel:	rastertolabel.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
325	echo Linking $@...
326	$(LD_CC) $(LDFLAGS) -o $@ rastertolabel.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
327
328
329#
330# rastertopwg
331#
332
333rastertopwg:	rastertopwg.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE)
334	echo Linking $@...
335	$(LD_CC) $(LDFLAGS) -o $@ rastertopwg.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS)
336
337rastertopwg-static:	rastertopwg.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
338	echo Linking $@...
339	$(LD_CC) $(LDFLAGS) -o $@ rastertopwg.o libcupsimage.a \
340		../cups/$(LIBCUPSSTATIC) $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) \
341		$(SSLLIBS) $(DNSSDLIBS) $(LIBGSSAPI)
342
343
344#
345# testclient (dependency on static libraries is intentional)
346#
347
348testclient:	testclient.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
349	echo Linking $@...
350	$(LD_CC) $(LDFLAGS) -o $@ testclient.o \
351		libcupsimage.a ../cups/$(LIBCUPSSTATIC) \
352		$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
353
354
355#
356# testraster
357#
358
359testraster:	testraster.o ../cups/$(LIBCUPSSTATIC) libcupsimage.a
360	echo Linking $@...
361	$(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testraster.o libcupsimage.a \
362		../cups/$(LIBCUPSSTATIC) $(IMGLIBS) $(DSOLIBS) $(COMMONLIBS) \
363		$(SSLLIBS) $(DNSSDLIBS) $(LIBGSSAPI)
364	echo Running raster API tests...
365	./testraster
366
367
368#
369# rasterbench
370#
371
372rasterbench:	rasterbench.o libcupsimage.a
373	echo Linking $@...
374	$(LD_CC) $(LDFLAGS) -o $@ rasterbench.o libcupsimage.a $(LIBS)
375
376
377#
378# Dependencies...
379#
380
381include Dependencies
382