]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/Makefile
Add support for ASL and journald when doing "syslog" logging (STR #4474)
[thirdparty/cups.git] / scheduler / Makefile
1 #
2 # "$Id$"
3 #
4 # Scheduler Makefile for CUPS.
5 #
6 # Copyright 2007-2015 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
16 include ../Makedefs
17
18 CUPSDOBJS = \
19 auth.o \
20 banners.o \
21 cert.o \
22 classes.o \
23 client.o \
24 colorman.o \
25 conf.o \
26 dirsvc.o \
27 env.o \
28 file.o \
29 main.o \
30 ipp.o \
31 listen.o \
32 job.o \
33 log.o \
34 network.o \
35 policy.o \
36 printers.o \
37 process.o \
38 quotas.o \
39 select.o \
40 server.o \
41 statbuf.o \
42 subscriptions.o \
43 sysman.o
44 LIBOBJS = \
45 filter.o \
46 mime.o \
47 type.o
48 COBJS = \
49 $(CUPSDOBJS) \
50 $(LIBOBJS) \
51 cupsfilter.o \
52 cups-deviced.o \
53 cups-exec.o \
54 cups-lpd.o \
55 testlpd.o \
56 testmime.o \
57 testspeed.o \
58 testsub.o \
59 util.o
60 CXXOBJS = \
61 cups-driverd.o
62 OBJS = \
63 $(COBJS) \
64 $(CXXOBJS)
65 LIBTARGETS = \
66 $(LIBCUPSMIME) \
67 libcupsmime.a
68
69 UNITTARGETS = \
70 testlpd \
71 testmime \
72 testspeed \
73 testsub
74
75 PROGRAMS = \
76 cupsd \
77 cupsfilter \
78 cups-deviced \
79 cups-driverd \
80 cups-exec \
81 cups-lpd
82
83 TARGETS = \
84 $(LIBTARGETS) \
85 $(PROGRAMS)
86
87
88 #
89 # Make everything...
90 #
91
92 all: $(TARGETS)
93
94
95 #
96 # Make library targets...
97 #
98
99 libs: $(LIBTARGETS)
100
101
102 #
103 # Make unit tests...
104 #
105
106 unittests: $(UNITTARGETS)
107
108
109 #
110 # Clean all object files...
111 #
112
113 clean:
114 $(RM) $(OBJS)
115 $(RM) $(TARGETS) $(UNITTARGETS) convert
116 $(RM) libcupsmime.so libcupsmime.dylib
117
118
119 #
120 # Update dependencies (without system header dependencies...)
121 #
122
123 depend:
124 $(CC) -MM $(ALL_CFLAGS) $(COBJS:.o=.c) >Dependencies
125 $(CXX) -MM $(ALL_CXXFLAGS) $(CXXOBJS:.o=.cxx) >>Dependencies
126
127
128 #
129 # Run oclint to check code coverage...
130 #
131
132 oclint:
133 oclint -o=oclint.html -html $(CUPSDOBJS:.o=.c) $(LIBOBJS:.o=.c) -- $(ALL_CFLAGS)
134
135
136 #
137 # Install all targets...
138 #
139
140 install: all install-data install-headers install-libs install-exec
141
142
143 #
144 # Install data files...
145 #
146
147 install-data:
148 echo Creating $(SERVERBIN)/driver...
149 $(INSTALL_DIR) -m 755 $(SERVERBIN)/driver
150 echo Creating $(SERVERROOT)...
151 $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)
152 echo Creating $(SERVERROOT)/interfaces...
153 $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)/interfaces
154 echo Creating $(SERVERROOT)/ppd...
155 $(INSTALL_DIR) -m 755 -g $(CUPS_GROUP) $(SERVERROOT)/ppd
156 if test "x`uname`" != xDarwin; then \
157 echo Creating $(SERVERROOT)/ssl...; \
158 $(INSTALL_DIR) -m 700 -g $(CUPS_GROUP) $(SERVERROOT)/ssl; \
159 fi
160 if test "$(STATEDIR)" != "$(SERVERROOT)"; then \
161 echo Creating $(STATEDIR)...; \
162 $(INSTALL_DIR) -m 755 $(STATEDIR); \
163 fi
164 echo Creating $(STATEDIR)/certs...
165 $(INSTALL_DIR) -m 511 -o $(CUPS_USER) -g $(CUPS_PRIMARY_SYSTEM_GROUP) \
166 $(STATEDIR)/certs
167 echo Creating $(LOGDIR)...
168 $(INSTALL_DIR) -m 755 $(LOGDIR)
169 echo Creating $(REQUESTS)...
170 $(INSTALL_DIR) -m 710 -g $(CUPS_GROUP) $(REQUESTS)
171 echo Creating $(REQUESTS)/tmp...
172 $(INSTALL_DIR) -m 1770 -g $(CUPS_GROUP) $(REQUESTS)/tmp
173 echo Creating $(CACHEDIR)...
174 $(INSTALL_DIR) -m 770 -g $(CUPS_GROUP) $(CACHEDIR)
175 if test "x$(INITDIR)" != x; then \
176 echo Installing init scripts...; \
177 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
178 $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
179 for level in $(RCLEVELS); do \
180 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
181 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups; \
182 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups; \
183 done; \
184 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
185 $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc0.d/K$(RCSTOP)cups; \
186 fi
187 if test "x$(INITDDIR)" != x; then \
188 echo Installing init script...; \
189 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDDIR); \
190 $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDDIR); \
191 fi
192 if test "x$(LAUNCHD_DIR)" != x; then \
193 echo Installing launchd configuration files...; \
194 $(INSTALL_DIR) $(BUILDROOT)$(LAUNCHD_DIR); \
195 $(INSTALL_DATA) org.cups.cupsd.plist $(BUILDROOT)$(LAUNCHD_DIR); \
196 $(INSTALL_DATA) org.cups.cups-lpd.plist $(BUILDROOT)$(LAUNCHD_DIR); \
197 fi
198 if test "x$(SMFMANIFESTDIR)" != x; then \
199 echo Installing SMF manifest in $(SMFMANIFESTDIR)...;\
200 $(INSTALL_DIR) $(BUILDROOT)/$(SMFMANIFESTDIR); \
201 $(INSTALL_SCRIPT) cups.xml $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
202 fi
203 if test "x$(SYSTEMD_DIR)" != x; then \
204 echo Installing systemd configuration files...; \
205 $(INSTALL_DIR) $(BUILDROOT)$(SYSTEMD_DIR); \
206 $(INSTALL_DATA) org.cups.cupsd.path $(BUILDROOT)$(SYSTEMD_DIR); \
207 $(INSTALL_DATA) org.cups.cupsd.service $(BUILDROOT)$(SYSTEMD_DIR); \
208 $(INSTALL_DATA) org.cups.cupsd.socket $(BUILDROOT)$(SYSTEMD_DIR); \
209 $(INSTALL_DATA) org.cups.cups-lpdAT.service $(BUILDROOT)$(SYSTEMD_DIR)/org.cups.cups-lpd@.service; \
210 $(INSTALL_DATA) org.cups.cups-lpd.socket $(BUILDROOT)$(SYSTEMD_DIR); \
211 elif test "x$(XINETD)" != x; then \
212 echo Installing xinetd configuration file for cups-lpd...; \
213 $(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \
214 $(INSTALL_DATA) cups-lpd.xinetd $(BUILDROOT)$(XINETD)/cups-lpd; \
215 fi
216
217
218 #
219 # Install programs...
220 #
221
222 install-exec:
223 echo Installing programs in $(SBINDIR)...
224 $(INSTALL_DIR) -m 755 $(SBINDIR)
225 $(INSTALL_BIN) -m $(CUPS_CUPSD_FILE_PERM) cupsd $(SBINDIR)
226 $(INSTALL_BIN) cupsfilter $(SBINDIR)
227 echo Installing programs in $(SERVERBIN)/daemon...
228 $(INSTALL_DIR) -m 755 $(SERVERBIN)
229 $(INSTALL_DIR) -m 755 $(SERVERBIN)/daemon
230 $(INSTALL_BIN) cups-deviced $(SERVERBIN)/daemon
231 $(INSTALL_BIN) cups-driverd $(SERVERBIN)/daemon
232 $(INSTALL_BIN) cups-exec $(SERVERBIN)/daemon
233 $(INSTALL_BIN) cups-lpd $(SERVERBIN)/daemon
234 if test "x$(SYMROOT)" != "x"; then \
235 $(INSTALL_DIR) $(SYMROOT); \
236 for file in $(PROGRAMS); do \
237 cp $$file $(SYMROOT); \
238 dsymutil $(SYMROOT)/$$file; \
239 done \
240 fi
241
242
243 #
244 # Install headers...
245 #
246
247 install-headers:
248 echo Installing header files in $(INCLUDEDIR)/cups...
249 $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups
250 $(INSTALL_DATA) mime.h $(INCLUDEDIR)/cups
251
252
253 #
254 # Install libraries...
255 #
256
257 install-libs: $(INSTALLSTATIC)
258 echo Installing libraries in $(LIBDIR)...
259 $(INSTALL_DIR) -m 755 $(LIBDIR)
260 $(INSTALL_LIB) $(LIBCUPSMIME) $(LIBDIR)
261 if test $(LIBCUPSMIME) = "libcupsmime.so.1"; then \
262 $(RM) $(LIBDIR)/`basename $(LIBCUPSMIME) .1`; \
263 $(LN) $(LIBCUPSMIME) $(LIBDIR)/`basename $(LIBCUPSMIME) .1`; \
264 fi
265 if test $(LIBCUPSMIME) = "libcupsmime.1.dylib"; then \
266 $(RM) $(LIBDIR)/libcupsmime.dylib; \
267 $(LN) $(LIBCUPSMIME) $(LIBDIR)/libcupsmime.dylib; \
268 fi
269 if test "x$(SYMROOT)" != "x"; then \
270 $(INSTALL_DIR) $(SYMROOT); \
271 cp $(LIBCUPSMIME) $(SYMROOT); \
272 dsymutil $(SYMROOT)/$(LIBCUPSMIME); \
273 fi
274
275 installstatic:
276 $(INSTALL_DIR) -m 755 $(LIBDIR)
277 $(INSTALL_LIB) -m 755 libcupsmime.a $(LIBDIR)
278 $(RANLIB) $(LIBDIR)/libcupsmime.a
279 $(CHMOD) 555 $(LIBDIR)/libcupsmime.a
280
281
282 #
283 # Uninstall the scheduler...
284 #
285
286 uninstall:
287 $(RM) $(SBINDIR)/cupsd
288 $(RM) $(SBINDIR)/cupsfilter
289 $(RM) $(SERVERBIN)/daemon/cups-deviced
290 $(RM) $(SERVERBIN)/daemon/cups-driverd
291 $(RM) $(SERVERBIN)/daemon/cups-exec
292 $(RM) $(SERVERBIN)/daemon/cups-lpd
293 -$(RMDIR) $(STATEDIR)/certs
294 -$(RMDIR) $(STATEDIR)
295 -$(RMDIR) $(SERVERROOT)/ppd
296 -$(RMDIR) $(SERVERROOT)/interfaces
297 -$(RMDIR) $(SERVERROOT)
298 -$(RMDIR) $(SERVERBIN)/driver
299 -$(RMDIR) $(SERVERBIN)/daemon
300 -$(RMDIR) $(SERVERBIN)
301 -$(RMDIR) $(SBINDIR)
302 -$(RMDIR) $(REQUESTS)/tmp
303 -$(RMDIR) $(REQUESTS)
304 -$(RMDIR) $(LOGDIR)
305 -$(RMDIR) $(CACHEDIR)
306 $(RM) $(LIBDIR)/libcupsmime.1.dylib
307 $(RM) $(LIBDIR)/libcupsmime.a
308 $(RM) $(LIBDIR)/libcupsmime.dylib
309 $(RM) $(LIBDIR)/libcupsmime.so
310 $(RM) $(LIBDIR)/libcupsmime.so.1
311 -$(RMDIR) $(LIBDIR)
312 $(RM) $(INCLUDEDIR)/cups/mime.h
313 -$(RMDIR) $(INCLUDEDIR)/cups
314 if test "x$(INITDIR)" != x; then \
315 echo Uninstalling init scripts...; \
316 $(RM) $(BUILDROOT)$(INITDIR)/init.d/cups; \
317 $(RMDIR) $(BUILDROOT)$(INITDIR)/init.d; \
318 $(RM) $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
319 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc0.d; \
320 $(RM) $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
321 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc2.d; \
322 $(RM) $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
323 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc3.d; \
324 $(RM) $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
325 $(RMDIR) $(BUILDROOT)$(INITDIR)/rc5.d; \
326 fi
327 if test "x$(INITDDIR)" != x; then \
328 echo Uninstalling startup script...; \
329 $(RM) $(BUILDROOT)$(INITDDIR)/cups.sh; \
330 $(RMDIR) $(BUILDROOT)$(INITDDIR); \
331 fi
332 if test "x$LAUNCHD_DIR" != x; then \
333 echo Uninstalling launchd files...; \
334 $(RM) $(BUILDROOT)$(LAUNCHD_DIR)/org.cups.cupsd.plist; \
335 $(RM) $(BUILDROOT)$(LAUNCHD_DIR)/org.cups.cups-lpd.plist; \
336 fi
337 if test "x$SYSTEMD_DIR" != x; then \
338 echo Uninstalling systemd files...; \
339 $(RM) $(BUILDROOT)$(SYSTEMD_DIR)/org.cups.cupsd.path; \
340 $(RM) $(BUILDROOT)$(SYSTEMD_DIR)/org.cups.cupsd.service; \
341 $(RM) $(BUILDROOT)$(SYSTEMD_DIR)/org.cups.cupsd.socket; \
342 fi
343 if test "x$(SMFMANIFESTDIR)" != x; then \
344 echo Uninstalling SMF manifest file...;\
345 $(RM) $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
346 fi
347 if test "x$(XINETD)" != x; then \
348 echo Uninstalling xinetd configuration file for cups-lpd...; \
349 $(RM) $(BUILDROOT)$(XINETD)/cups-lpd; \
350 fi
351
352
353 #
354 # Automatic API help files...
355 #
356
357 apihelp:
358 mxmldoc --section "Programming" \
359 --title "MIME API" \
360 --css ../doc/cups-printable.css \
361 --header api-mime.header --intro api-mime.shtml \
362 mime.h $(LIBOBJS:.o=.c) >../doc/help/api-mime.html
363 mxmldoc --tokens help/api-mime.html api-mime.xml >../doc/help/api-mime.tokens
364 $(RM) api-mime.xml
365
366 framedhelp:
367 mxmldoc --framed api-mime \
368 --section "Programming" \
369 --title "MIME API" \
370 --css ../doc/cups-printable.css \
371 --header api-mime.header --intro api-mime.shtml \
372 mime.h $(LIBOBJS:.o=.c)
373
374
375 #
376 # Make the scheduler executable, "cupsd".
377 #
378
379 cupsd: $(CUPSDOBJS) $(LIBCUPSMIME) ../cups/$(LIBCUPS)
380 echo Linking $@...
381 $(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \
382 $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
383 $(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(ONDEMANDLIBS) \
384 $(DNSSDLIBS) $(LIBS) $(LIBGSSAPI) $(LIBWRAP)
385
386 cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC)
387 echo Linking $@...
388 $(CC) $(LDFLAGS) -o cupsd-static $(CUPSDOBJS) libcupsmime.a \
389 $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
390 ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \
391 $(LIBMALLOC) $(SERVERLIBS) $(ONDEMANDLIBS) $(DNSSDLIBS) \
392 $(LIBGSSAPI) $(LIBWRAP)
393
394
395 #
396 # Make the cupsfilter utility.
397 #
398
399 cupsfilter: cupsfilter.o $(LIBCUPSMIME) ../cups/$(LIBCUPS)
400 echo Linking $@...
401 $(CC) $(LDFLAGS) -o cupsfilter cupsfilter.o -L. -lcupsmime $(LIBS)
402 $(RM) convert
403 $(LN) cupsfilter convert
404
405 cupsfilter-static: cupsfilter.o libcupsmime.a ../cups/$(LIBCUPSSTATIC)
406 echo Linking $@...
407 $(CC) $(LDFLAGS) -o cupsfilter-static cupsfilter.o libcupsmime.a \
408 ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(SSLLIBS) \
409 $(DNSSDLIBS) $(LIBGSSAPI)
410
411
412 #
413 # Make the device daemon, "cups-deviced".
414 #
415
416 cups-deviced: cups-deviced.o util.o ../cups/$(LIBCUPS)
417 echo Linking $@...
418 $(CC) $(LDFLAGS) -o cups-deviced cups-deviced.o util.o $(LIBS)
419
420
421 #
422 # Make the driver daemon, "cups-driverd".
423 #
424
425 cups-driverd: cups-driverd.o util.o ../cups/$(LIBCUPS) ../ppdc/$(LIBCUPSPPDC)
426 echo Linking $@...
427 $(CXX) $(LDFLAGS) -o cups-driverd cups-driverd.o util.o \
428 -L../ppdc -lcupsppdc $(LIBS)
429
430
431 #
432 # Make the sandbox execution helper, "cups-exec".
433 #
434
435 cups-exec: cups-exec.o
436 echo Linking $@...
437 $(CC) $(LDFLAGS) -o cups-exec cups-exec.o $(LIBS)
438
439
440 #
441 # Make the line printer daemon, "cups-lpd".
442 #
443
444 cups-lpd: cups-lpd.o ../cups/$(LIBCUPS)
445 echo Linking $@...
446 $(CC) $(LDFLAGS) -o cups-lpd cups-lpd.o $(LIBS)
447
448
449 #
450 # libcupsmime.so.1
451 #
452
453 libcupsmime.so.1: $(LIBOBJS)
454 echo Linking $@...
455 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
456 $(RM) `basename $@ .1`
457 $(LN) $@ `basename $@ .1`
458
459
460 #
461 # libcupsmime.1.dylib
462 #
463
464 libcupsmime.1.dylib: $(LIBOBJS) libcupsmime.exp
465 echo Linking $@...
466 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
467 -install_name $(libdir)/$@ \
468 -current_version 1.0.0 \
469 -compatibility_version 1.0.0 \
470 -exported_symbols_list libcupsmime.exp \
471 $(LIBOBJS) $(LIBS)
472 $(RM) libcupsmime.dylib
473 $(LN) $@ libcupsmime.dylib
474
475
476 #
477 # libcupsmime.la
478 #
479
480 libcupsmime.la: $(LIBOBJS)
481 echo Linking $@...
482 $(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
483 -version-info 1:0 $(LIBS)
484
485
486 #
487 # libcupsmime.a
488 #
489
490 libcupsmime.a: $(LIBOBJS)
491 echo Archiving $@...
492 $(RM) $@
493 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
494 $(RANLIB) $@
495
496
497 #
498 # Make the test program, "testlpd".
499 #
500
501 testlpd: testlpd.o ../cups/$(LIBCUPSSTATIC) cups-lpd
502 echo Linking $@...
503 $(CC) $(LDFLAGS) -o testlpd testlpd.o ../cups/$(LIBCUPSSTATIC) \
504 $(COMMONLIBS) $(LIBZ) $(SSLLIBS) $(DNSSDLIBS) $(LIBGSSAPI)
505
506
507 #
508 # testmime
509 #
510
511 testmime: testmime.o libcupsmime.a ../cups/$(LIBCUPSSTATIC)
512 echo Linking $@...
513 $(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testmime.o libcupsmime.a \
514 ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(SSLLIBS) \
515 $(DNSSDLIBS) $(LIBGSSAPI)
516 echo Running MIME tests...
517 ./testmime
518
519
520 #
521 # Make the test program, "testspeed".
522 #
523
524 testspeed: testspeed.o ../cups/$(LIBCUPSSTATIC)
525 echo Linking $@...
526 $(CC) $(LDFLAGS) -o testspeed testspeed.o ../cups/$(LIBCUPSSTATIC) \
527 $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ) $(LIBGSSAPI)
528
529
530 #
531 # Make the test program, "testsub".
532 #
533
534 testsub: testsub.o ../cups/$(LIBCUPSSTATIC)
535 echo Linking $@...
536 $(CC) $(LDFLAGS) -o testsub testsub.o ../cups/$(LIBCUPSSTATIC) \
537 $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ) $(LIBGSSAPI)
538
539
540 #
541 # Lines of code computation...
542 #
543
544 sloc:
545 echo "cupsd: \c"
546 sloccount $(CUPSDOBJS:.o=.c) $(LIBOBJS:.o=.c) cups-driverd.cxx cups-lpd.c 2>/dev/null | grep "Total Physical" | awk '{print $$9}'
547
548
549 #
550 # Dependencies...
551 #
552
553 include Dependencies
554
555
556 #
557 # End of "$Id$".
558 #