4 # Scheduler Makefile for CUPS.
6 # Copyright 2007-2015 by Apple Inc.
7 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
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/".
96 # Make library targets...
106 unittests
: $(UNITTARGETS
)
110 # Clean all object files...
115 $(RM
) $(TARGETS
) $(UNITTARGETS
) convert
116 $(RM
) libcupsmime.so libcupsmime.dylib
120 # Update dependencies (without system header dependencies...)
124 $(CC
) -MM
$(ALL_CFLAGS
) $(COBJS
:.o
=.c
) >Dependencies
125 $(CXX
) -MM
$(ALL_CXXFLAGS
) $(CXXOBJS
:.o
=.
cxx) >>Dependencies
129 # Run oclint to check code coverage...
133 oclint
-o
=oclint.html
-html
$(CUPSDOBJS
:.o
=.c
) $(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
137 # Install all targets...
140 install: all install-data install-headers install-libs install-exec
144 # Install data files...
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
; \
160 if
test "$(STATEDIR)" != "$(SERVERROOT)"; then \
161 echo Creating
$(STATEDIR
)...
; \
162 $(INSTALL_DIR
) -m
755 $(STATEDIR
); \
164 echo Creating
$(STATEDIR
)/certs...
165 $(INSTALL_DIR
) -m
511 -o
$(CUPS_USER
) -g
$(CUPS_PRIMARY_SYSTEM_GROUP
) \
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
; \
184 $(INSTALL_DIR
) -m
755 $(BUILDROOT
)$(INITDIR
)/rc0.d
; \
185 $(LN
) ..
/init.d
/cups
$(BUILDROOT
)$(INITDIR
)/rc0.d
/K
$(RCSTOP
)cups
; \
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
); \
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
); \
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
; \
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
; \
219 # Install programs...
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; \
248 echo Installing header files in
$(INCLUDEDIR
)/cups...
249 $(INSTALL_DIR
) -m
755 $(INCLUDEDIR
)/cups
250 $(INSTALL_DATA
) mime.h
$(INCLUDEDIR
)/cups
254 # Install libraries...
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`; \
265 if
test $(LIBCUPSMIME
) = "libcupsmime.1.dylib"; then \
266 $(RM
) $(LIBDIR
)/libcupsmime.dylib
; \
267 $(LN
) $(LIBCUPSMIME
) $(LIBDIR
)/libcupsmime.dylib
; \
269 if
test "x$(SYMROOT)" != "x"; then \
270 $(INSTALL_DIR
) $(SYMROOT
); \
271 cp
$(LIBCUPSMIME
) $(SYMROOT
); \
272 dsymutil
$(SYMROOT
)/$(LIBCUPSMIME
); \
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
283 # Uninstall the scheduler...
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
)
302 -$(RMDIR
) $(REQUESTS
)/tmp
303 -$(RMDIR
) $(REQUESTS
)
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
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
; \
327 if
test "x$(INITDDIR)" != x
; then \
328 echo Uninstalling startup script...
; \
329 $(RM
) $(BUILDROOT
)$(INITDDIR
)/cups.sh
; \
330 $(RMDIR
) $(BUILDROOT
)$(INITDDIR
); \
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
; \
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
; \
343 if
test "x$(SMFMANIFESTDIR)" != x
; then \
344 echo Uninstalling SMF manifest file...
;\
345 $(RM
) $(BUILDROOT
)$(SMFMANIFESTDIR
)/cups.xml
; \
347 if
test "x$(XINETD)" != x
; then \
348 echo Uninstalling xinetd configuration file for cups-lpd...
; \
349 $(RM
) $(BUILDROOT
)$(XINETD
)/cups-lpd
; \
354 # Automatic API help files...
358 mxmldoc
--section
"Programming" \
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
367 mxmldoc
--framed api-mime \
368 --section
"Programming" \
370 --css ..
/doc
/cups-printable.css \
371 --header api-mime.header
--intro api-mime.shtml \
372 mime.h
$(LIBOBJS
:.o
=.c
)
376 # Make the scheduler executable, "cupsd".
379 cupsd
: $(CUPSDOBJS
) $(LIBCUPSMIME
) ..
/cups
/$(LIBCUPS
)
381 $(CC
) $(LDFLAGS
) -o cupsd
$(CUPSDOBJS
) -L.
-lcupsmime \
382 $(LIBZ
) $(SSLLIBS
) $(LIBSLP
) $(LIBLDAP
) $(PAMLIBS
) \
383 $(LIBPAPER
) $(LIBMALLOC
) $(SERVERLIBS
) $(ONDEMANDLIBS
) \
384 $(DNSSDLIBS
) $(LIBS
) $(LIBGSSAPI
) $(LIBWRAP
)
386 cupsd-static
: $(CUPSDOBJS
) libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
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
)
396 # Make the cupsfilter utility.
399 cupsfilter
: cupsfilter.o
$(LIBCUPSMIME
) ..
/cups
/$(LIBCUPS
)
401 $(CC
) $(LDFLAGS
) -o cupsfilter cupsfilter.o
-L.
-lcupsmime
$(LIBS
)
403 $(LN
) cupsfilter convert
405 cupsfilter-static
: cupsfilter.o libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
407 $(CC
) $(LDFLAGS
) -o cupsfilter-static cupsfilter.o libcupsmime.a \
408 ..
/cups
/$(LIBCUPSSTATIC
) $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) \
409 $(DNSSDLIBS
) $(LIBGSSAPI
)
413 # Make the device daemon, "cups-deviced".
416 cups-deviced
: cups-deviced.o util.o ..
/cups
/$(LIBCUPS
)
418 $(CC
) $(LDFLAGS
) -o cups-deviced cups-deviced.o util.o
$(LIBS
)
422 # Make the driver daemon, "cups-driverd".
425 cups-driverd
: cups-driverd.o util.o ..
/cups
/$(LIBCUPS
) ..
/ppdc
/$(LIBCUPSPPDC
)
427 $(CXX
) $(LDFLAGS
) -o cups-driverd cups-driverd.o util.o \
428 -L..
/ppdc
-lcupsppdc
$(LIBS
)
432 # Make the sandbox execution helper, "cups-exec".
435 cups-exec
: cups-exec.o
437 $(CC
) $(LDFLAGS
) -o cups-exec cups-exec.o
$(LIBS
)
441 # Make the line printer daemon, "cups-lpd".
444 cups-lpd
: cups-lpd.o ..
/cups
/$(LIBCUPS
)
446 $(CC
) $(LDFLAGS
) -o cups-lpd cups-lpd.o
$(LIBS
)
453 libcupsmime.so
.1: $(LIBOBJS
)
455 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBS
)
456 $(RM
) `basename $@ .1`
457 $(LN
) $@
`basename $@ .1`
461 # libcupsmime.1.dylib
464 libcupsmime
.1.dylib
: $(LIBOBJS
) libcupsmime.exp
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 \
472 $(RM
) libcupsmime.dylib
473 $(LN
) $@ libcupsmime.dylib
480 libcupsmime.la
: $(LIBOBJS
)
482 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) -rpath
$(LIBDIR
) \
483 -version-info
1:0 $(LIBS
)
490 libcupsmime.a
: $(LIBOBJS
)
493 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
498 # Make the test program, "testlpd".
501 testlpd
: testlpd.o ..
/cups
/$(LIBCUPSSTATIC
) cups-lpd
503 $(CC
) $(LDFLAGS
) -o testlpd testlpd.o ..
/cups
/$(LIBCUPSSTATIC
) \
504 $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) $(DNSSDLIBS
) $(LIBGSSAPI
)
511 testmime
: testmime.o libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
513 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testmime.o libcupsmime.a \
514 ..
/cups
/$(LIBCUPSSTATIC
) $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) \
515 $(DNSSDLIBS
) $(LIBGSSAPI
)
516 echo Running MIME tests...
521 # Make the test program, "testspeed".
524 testspeed
: testspeed.o ..
/cups
/$(LIBCUPSSTATIC
)
526 $(CC
) $(LDFLAGS
) -o testspeed testspeed.o ..
/cups
/$(LIBCUPSSTATIC
) \
527 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
) $(LIBGSSAPI
)
531 # Make the test program, "testsub".
534 testsub
: testsub.o ..
/cups
/$(LIBCUPSSTATIC
)
536 $(CC
) $(LDFLAGS
) -o testsub testsub.o ..
/cups
/$(LIBCUPSSTATIC
) \
537 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
) $(LIBGSSAPI
)
541 # Lines of code computation...
546 sloccount
$(CUPSDOBJS
:.o
=.c
) $(LIBOBJS
:.o
=.c
) cups-driverd.
cxx cups-lpd.c
2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'