Merge changes from CUPS 1.4svn-r7874.
[thirdparty/cups.git] / driver / Makefile
CommitLineData
ac884b6a
MS
1#
2# "$Id$"
3#
4# Makefile for the CUPS base drivers.
5#
6# Copyright 2007-2008 by Apple Inc.
7# Copyright 2002-2005 by Easy Software Products.
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
16#
17# Include standard definitions...
18#
19
20include ../Makedefs
21
22
23#
24# Object files...
25#
26
27LIBOBJS = \
28 attr.o \
29 check.o \
30 cmyk.o \
31 dither.o \
32 lut.o \
33 pack.o \
34 rgb.o \
35 srgb.o
50fe7201
MS
36LIB32OBJS = $(LIBOBJS:.o=.32.o)
37LIB64OBJS = $(LIBOBJS:.o=.64.o)
ac884b6a
MS
38
39OBJS = \
40 commandtoescpx.o \
41 commandtopclx.o \
42 rastertoescpx.o \
43 rastertopclx.o \
44 pcl-common.o \
45 testcmyk.o \
46 testdither.o \
47 testrgb.o \
50fe7201
MS
48 $(LIBOBJS) \
49 $(LIB32OBJS) \
50 $(LIB64OBJS)
ac884b6a 51
c9fc04c6 52LIBTARGETS = \
50fe7201
MS
53 $(LIBCUPSDRIVER) \
54 $(LIB32CUPSDRIVER) \
55 $(LIB64CUPSDRIVER) \
ac884b6a 56 libcupsdriver.a \
ac884b6a
MS
57 testcmyk \
58 testdither \
59 testrgb
c9fc04c6
MS
60TARGETS = \
61 $(LIBTARGETS) \
62 commandtoescpx \
63 commandtopclx \
64 rastertoescpx \
65 rastertopclx
ac884b6a
MS
66
67
68#
69# Make everything...
70#
71
72all: $(TARGETS)
73
74
c9fc04c6
MS
75#
76# Make library targets...
77#
78
79libs: $(LIBTARGETS)
80
81
5f64df29
MS
82#
83# Make unit tests...
84#
85
86unittests:
87
88
ac884b6a
MS
89#
90# Clean everything...
91#
92
93clean:
94 $(RM) $(OBJS) core
95 $(RM) *.bck core.*
96 $(RM) $(TARGETS)
bdd6c45b 97 $(RM) -r test
50fe7201
MS
98 $(RM) libcupsdriver.so libcupsdriver.sl libcupsdriver.dylib
99 $(RM) -r 32bit 64bit
ac884b6a
MS
100
101
102#
103# Update dependencies...
104#
105
106depend:
50fe7201
MS
107 touch Dependencies.tmp
108 makedepend -Y -I.. -fDependencies.tmp $(OBJS:.o=.c) >/dev/null 2>&1
109 $(RM) Dependencies
110 cp Dependencies.tmp Dependencies
111 sed -E -e '1,$$s/^([^.]+)\.o:/\1\.32.o: \1\.c /' Dependencies.tmp >>Dependencies
112 sed -E -e '1,$$s/^([^.]+)\.o:/\1\.64.o: \1\.c /' Dependencies.tmp >>Dependencies
113 $(RM) Dependencies.tmp
ac884b6a
MS
114
115
116#
50fe7201 117# Install all targets...
ac884b6a
MS
118#
119
50fe7201
MS
120install: all install-data install-headers install-libs install-exec
121
122
123#
124# Install data files...
125#
126
127install-data:
128
129
130#
131# Install programs...
132#
133
134install-exec:
ac884b6a
MS
135 $(INSTALL_DIR) $(SERVERBIN)/filter
136 for file in commandtoescpx commandtopclx rastertoescpx rastertopclx; do \
137 $(INSTALL_BIN) $$file $(SERVERBIN)/filter; \
138 done
50fe7201
MS
139 if test "x$(SYMROOT)" != "x"; then \
140 $(INSTALL_DIR) $(SYMROOT); \
141 for file in commandtoescpx commandtopclx rastertoescpx rastertopclx; do \
142 cp $$file $(SYMROOT); \
143 done \
144 fi
145
146
147#
148# Install headers...
149#
150
151install-headers:
152 echo Installing header files in $(INCLUDEDIR)/cups...
153 $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
ac884b6a
MS
154 $(INSTALL_DATA) driver.h $(INCLUDEDIR)/cups
155
156
50fe7201
MS
157#
158# Install libraries...
159#
160
161install-libs: $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64)
162 echo Installing libraries in $(LIBDIR)...
163 $(INSTALL_DIR) -m 755 $(LIBDIR)
164 $(INSTALL_LIB) $(LIBCUPSDRIVER) $(LIBDIR)
165 if test $(LIBCUPSDRIVER) = "libcupsdriver.so.1" -o $(LIBCUPSDRIVER) = "libcupsdriver.sl.1"; then \
166 $(RM) $(LIBDIR)/`basename $(LIBCUPSDRIVER) .1`; \
167 $(LN) $(LIBCUPSDRIVER) $(LIBDIR)/`basename $(LIBCUPSDRIVER) .1`; \
168 fi
169 if test $(LIBCUPSDRIVER) = "libcupsdriver.1.dylib"; then \
50fe7201
MS
170 $(RM) $(LIBDIR)/libcupsdriver.dylib; \
171 $(LN) $(LIBCUPSDRIVER) $(LIBDIR)/libcupsdriver.dylib; \
172 fi
173 if test "x$(SYMROOT)" != "x"; then \
174 $(INSTALL_DIR) $(SYMROOT); \
175 cp $(LIBCUPSDRIVER) $(SYMROOT); \
176 fi
177
178installstatic:
179 $(INSTALL_DIR) -m 755 $(LIBDIR)
180 $(INSTALL_LIB) libcupsdriver.a $(LIBDIR)
181 $(RANLIB) $(LIBDIR)/libcupsdriver.a
182
183install32bit:
184 echo Installing libraries in $(LIB32DIR)...
185 $(INSTALL_DIR) -m 755 $(LIB32DIR)
186 $(INSTALL_LIB) 32bit/libcupsdriver.so.1 $(LIB32DIR)/libcupsdriver.so.1
187 $(LN) libcupsdriver.so.1 $(LIB32DIR)/libcupsdriver.so
188
189install64bit:
190 echo Installing libraries in $(LIB64DIR)...
191 $(INSTALL_DIR) -m 755 $(LIB64DIR)
192 $(INSTALL_LIB) 64bit/libcupsdriver.so.1 $(LIB64DIR)/libcupsdriver.so.1
193 $(LN) libcupsdriver.so.1 $(LIB64DIR)/libcupsdriver.so
194
195
ac884b6a
MS
196#
197# Uninstall...
198#
199
50fe7201 200uninstall: $(UNINSTALL32) $(UNINSTALL64)
ac884b6a
MS
201 for file in commandtoescpx commandtopclx rastertoescpx rastertopclx; do \
202 $(RM) $(SERVERBIN)/filter/$$file; \
203 done
50fe7201
MS
204 $(RM) $(LIBDIR)/libcupsdriver.1.dylib
205 $(RM) $(LIBDIR)/libcupsdriver.a
206 $(RM) $(LIBDIR)/libcupsdriver.dylib
207 $(RM) $(LIBDIR)/libcupsdriver_s.a
208 $(RM) $(LIBDIR)/libcupsdriver.sl
209 $(RM) $(LIBDIR)/libcupsdriver.sl.1
210 $(RM) $(LIBDIR)/libcupsdriver.so
211 $(RM) $(LIBDIR)/libcupsdriver.so.1
212 -$(RMDIR) $(LIBDIR)
ac884b6a 213 $(RM) $(INCLUDEDIR)/cups/driver.h
50fe7201
MS
214 -$(RMDIR) $(INCLUDEDIR)/cups
215
216uninstall32bit:
217 $(RM) $(LIB32DIR)/libcupsdriver.so
218 $(RM) $(LIB32DIR)/libcupsdriver.so.1
219 -$(RMDIR) $(LIB32DIR)
220
221uninstall64bit:
222 $(RM) $(LIB64DIR)/libcupsdriver.so
223 $(RM) $(LIB64DIR)/libcupsdriver.so.1
224 -$(RMDIR) $(LIB64DIR)
ac884b6a
MS
225
226
227#
228# Automatic API help files...
229#
230
231apihelp:
232 mxmldoc --section "Programming" \
233 --title "Printer Driver API" \
234 --css ../doc/cups-printable.css \
235 --header api-driver.header --intro api-driver.shtml \
236 driver.h $(LIBOBJS:.o=.c) >../doc/help/api-driver.html
237
238framedhelp:
239 mxmldoc --framed api-driver \
240 --section "Programming" \
241 --title "Printer Driver API" \
242 --css ../doc/cups-printable.css \
243 --header api-driver.header --intro api-driver.shtml \
244 driver.h $(LIBOBJS:.o=.c)
245
246
247#
248# commandtopclx, the PCL command printer driver.
249#
250
50fe7201 251commandtopclx: commandtopclx.o $(LIBCUPSDRIVER) ../cups/$(LIBCUPS)
ac884b6a 252 echo Linking $@...
50fe7201 253 $(CC) $(LDFLAGS) -o $@ commandtopclx.o -L. -lcupsdriver $(LIBS)
ac884b6a
MS
254
255
256#
257# commandtoescpx, the ESC/P command printer driver.
258#
259
50fe7201 260commandtoescpx: commandtoescpx.o $(LIBCUPSDRIVER) ../cups/$(LIBCUPS)
ac884b6a 261 echo Linking $@...
50fe7201 262 $(CC) $(LDFLAGS) -o $@ commandtoescpx.o -L. -lcupsdriver $(LIBS)
ac884b6a
MS
263
264
265#
266# rastertoescpx, the ESC/P raster printer driver.
267#
268
50fe7201 269rastertoescpx: rastertoescpx.o $(LIBCUPSDRIVER) ../cups/$(LIBCUPS)
ac884b6a 270 echo Linking $@...
50fe7201 271 $(CC) $(LDFLAGS) -o $@ rastertoescpx.o -L. -lcupsdriver \
ac884b6a
MS
272 $(LINKCUPSIMAGE) $(LIBS)
273
274
275#
276# rastertopclx, the ESC/P raster printer driver.
277#
278
50fe7201 279rastertopclx: rastertopclx.o pcl-common.o $(LIBCUPSDRIVER) \
ac884b6a
MS
280 ../cups/$(LIBCUPS)
281 echo Linking $@...
50fe7201 282 $(CC) $(LDFLAGS) -o $@ rastertopclx.o pcl-common.o -L. -lcupsdriver \
ac884b6a
MS
283 $(LINKCUPSIMAGE) $(LIBS)
284
285
bdd6c45b
MS
286#
287# test, make a common test subdirectory for the other test programs.
288#
289
290test:
291 if test ! -d test; then \
292 rm -rf test; \
293 mkdir test; \
294 fi
295
296
ac884b6a
MS
297#
298# testcmyk, test cmyk separation functions.
299#
300
bdd6c45b 301testcmyk: test testcmyk.o libcupsdriver.a ../cups/libcups.a
ac884b6a 302 echo Linking $@...
c9fc04c6
MS
303 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcmyk.o libcupsdriver.a \
304 ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
c9fc04c6
MS
305 echo Running CMYK API tests...
306 ./testcmyk > test/testcmyk.log
ac884b6a
MS
307
308
309#
310# testdither, test dithering functions.
311#
312
bdd6c45b 313testdither: test testdither.o libcupsdriver.a ../cups/libcups.a
ac884b6a 314 echo Linking $@...
c9fc04c6
MS
315 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testdither.o libcupsdriver.a \
316 ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
c9fc04c6
MS
317 echo Running dither API tests...
318 ./testdither > test/0-255.pgm 2>test/0-255.log
319 ./testdither 0 127 255 > test/0-127-255.pgm 2>test/0-127-255.log
320 ./testdither 0 85 170 255 > test/0-85-170-255.pgm 2>test/0-85-170-255.log
321 ./testdither 0 63 127 170 198 227 255 > test/0-63-127-170-198-227-255.pgm 2>test/0-63-127-170-198-227-255.log
322 ./testdither 0 210 383 > test/0-210-383.pgm 2>test/0-210-383.log
323 ./testdither 0 82 255 > test/0-82-255.pgm 2>test/0-82-255.log
324 ./testdither 0 510 > test/0-510.pgm 2>test/0-510.log
325 ./testdither 0 1020 > test/0-1020.pgm 2>test/0-1020.log
ac884b6a
MS
326
327
328#
329# testrgb, test RGB separation functions.
330#
331
bdd6c45b 332testrgb: test testrgb.o libcupsdriver.a ../cups/libcups.a
ac884b6a 333 echo Linking $@...
c9fc04c6
MS
334 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testrgb.o libcupsdriver.a \
335 ../cups/libcups.a $(LIBGSSAPI) $(SSLLIBS) $(COMMONLIBS) $(LIBZ)
c9fc04c6 336 echo Running RGB API tests...
a0f6818e 337 ./testrgb > test/testrgb.log 2>&1 || echo "RGB tests failed!"
ac884b6a
MS
338
339
340#
50fe7201
MS
341# libcupsdriver.so.1, libcupsdriver.sl.1
342#
343
344libcupsdriver.so.1 libcupsdriver.sl.1: $(LIBOBJS)
345 echo Linking $@...
346 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
347 $(RM) `basename $@ .1`
348 $(LN) $@ `basename $@ .1`
349
350
351#
352# 32bit/libcupsdriver.so.1
353#
354
35532bit/libcupsdriver.so.1: $(LIB32OBJS)
356 echo Linking 32-bit $@...
357 -mkdir 32bit
358 $(DSO) $(ARCH32FLAGS) $(DSO32FLAGS) -o $@ $(LIB32OBJS) $(LIBS)
359 $(RM) 32bit/libcupsdriver.so
360 $(LN) libcupsdriver.so.1 32bit/libcupsdriver.so
361
362
363#
364# 64bit/libcupsdriver.so.1
365#
366
36764bit/libcupsdriver.so.1: $(LIB64OBJS)
368 echo Linking 64-bit $@...
369 -mkdir 64bit
370 $(DSO) $(ARCH64FLAGS) $(DSO64FLAGS) -o $@ $(LIB64OBJS) $(LIBS)
371 $(RM) 64bit/libcupsdriver.so
372 $(LN) libcupsdriver.so.1 64bit/libcupsdriver.so
373
374
375#
376# libcupsdriver.1.dylib
377#
378
379libcupsdriver.1.dylib: $(LIBOBJS) libcupsdriver.exp
380 echo Linking $@...
381 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
382 -install_name $(libdir)/$@ \
383 -current_version 1.0.0 \
384 -compatibility_version 1.0.0 \
385 -exported_symbols_list libcupsdriver.exp \
386 $(LIBOBJS) $(LIBS)
387 $(RM) libcupsdriver.dylib
388 $(LN) $@ libcupsdriver.dylib
389
390
391#
392# libcupsdriver_s.a
393#
394
395libcupsdriver_s.a: $(LIBOBJS)
396 echo Creating $@...
397 $(DSO) $(DSOFLAGS) -o libcupsdriver_s.o $(LIBOBJS) $(LIBS)
398 $(RM) $@
399 $(AR) $(ARFLAGS) $@ libcupsdriver_s.o
400
401
402#
403# libcupsdriver.la
404#
405
406libcupsdriver.la: $(LIBOBJS)
407 echo Linking $@...
408 $(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
409 -version-info 1:0 $(LIBS)
410
411
412#
413# libcupsdriver.a
ac884b6a
MS
414#
415
416libcupsdriver.a: $(LIBOBJS)
417 echo Archiving $@...
418 $(RM) $@
419 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
420 $(RANLIB) $@
421
422
423#
424# Include dependencies...
425#
426
427include Dependencies
428
429
430#
431# End of "$Id$".
432#