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