2 # Scheduler Makefile for CUPS.
4 # Copyright 2007-2016 by Apple Inc.
5 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
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/".
94 # Make library targets...
104 unittests
: $(UNITTARGETS
)
108 # Clean all object files...
113 $(RM
) $(TARGETS
) $(UNITTARGETS
) convert
114 $(RM
) libcupsmime.so libcupsmime.dylib
118 # Update dependencies (without system header dependencies...)
122 $(CC
) -MM
$(ALL_CFLAGS
) $(COBJS
:.o
=.c
) >Dependencies
123 $(CXX
) -MM
$(ALL_CXXFLAGS
) $(CXXOBJS
:.o
=.
cxx) >>Dependencies
127 # Run oclint to check code coverage...
131 oclint
-o
=oclint.html
-html
$(CUPSDOBJS
:.o
=.c
) $(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
135 # Install all targets...
138 install: all install-data install-headers install-libs install-exec
142 # Install data files...
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
; \
156 if
test "$(STATEDIR)" != "$(SERVERROOT)"; then \
157 echo Creating
$(STATEDIR
)...
; \
158 $(INSTALL_DIR
) -m
755 $(STATEDIR
); \
160 echo Creating
$(STATEDIR
)/certs...
161 $(INSTALL_DIR
) -m
511 -o
$(CUPS_USER
) -g
$(CUPS_PRIMARY_SYSTEM_GROUP
) \
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
; \
180 $(INSTALL_DIR
) -m
755 $(BUILDROOT
)$(INITDIR
)/rc0.d
; \
181 $(LN
) ..
/init.d
/cups
$(BUILDROOT
)$(INITDIR
)/rc0.d
/K
$(RCSTOP
)cups
; \
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
); \
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
); \
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
; \
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
; \
215 # Install programs...
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; \
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
); \
252 # Install libraries...
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`; \
263 if
test $(LIBCUPSMIME
) = "libcupsmime.1.dylib"; then \
264 $(RM
) $(LIBDIR
)/libcupsmime.dylib
; \
265 $(LN
) $(LIBCUPSMIME
) $(LIBDIR
)/libcupsmime.dylib
; \
267 if
test "x$(SYMROOT)" != "x"; then \
268 $(INSTALL_DIR
) $(SYMROOT
); \
269 cp
$(LIBCUPSMIME
) $(SYMROOT
); \
270 dsymutil
$(SYMROOT
)/$(LIBCUPSMIME
); \
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
281 # Uninstall the scheduler...
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
)
300 -$(RMDIR
) $(REQUESTS
)/tmp
301 -$(RMDIR
) $(REQUESTS
)
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
310 -if
test "x$(privateinclude)" != x
; then \
311 $(RM
) $(PRIVATEINCLUDE
)/mime.h
; \
312 $(RMDIR
) $(PRIVATEINCLUDE
); \
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 # Make the scheduler executable, "cupsd".
357 cupsd
: $(CUPSDOBJS
) $(LIBCUPSMIME
) ..
/cups
/$(LIBCUPS
)
359 $(CC
) $(LDFLAGS
) -o cupsd
$(CUPSDOBJS
) -L.
-lcupsmime \
360 $(LIBZ
) $(SSLLIBS
) $(LIBSLP
) $(LIBLDAP
) $(PAMLIBS
) \
361 $(LIBPAPER
) $(LIBMALLOC
) $(SERVERLIBS
) $(ONDEMANDLIBS
) \
362 $(DNSSDLIBS
) $(LIBS
) $(LIBGSSAPI
) $(LIBWRAP
)
364 cupsd-static
: $(CUPSDOBJS
) libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
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
)
374 # Make the cupsfilter utility.
377 cupsfilter
: cupsfilter.o
$(LIBCUPSMIME
) ..
/cups
/$(LIBCUPS
)
379 $(CC
) $(LDFLAGS
) -o cupsfilter cupsfilter.o
-L.
-lcupsmime
$(LIBS
)
381 $(LN
) cupsfilter convert
383 cupsfilter-static
: cupsfilter.o libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
385 $(CC
) $(LDFLAGS
) -o cupsfilter-static cupsfilter.o libcupsmime.a \
386 ..
/cups
/$(LIBCUPSSTATIC
) $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) \
387 $(DNSSDLIBS
) $(LIBGSSAPI
)
391 # Make the device daemon, "cups-deviced".
394 cups-deviced
: cups-deviced.o util.o ..
/cups
/$(LIBCUPS
)
396 $(CC
) $(LDFLAGS
) -o cups-deviced cups-deviced.o util.o
$(LIBS
)
400 # Make the driver daemon, "cups-driverd".
403 cups-driverd
: cups-driverd.o util.o ..
/cups
/$(LIBCUPS
) ..
/ppdc
/$(LIBCUPSPPDC
)
405 $(CXX
) $(LDFLAGS
) -o cups-driverd cups-driverd.o util.o \
406 -L..
/ppdc
-lcupsppdc
$(LIBS
)
410 # Make the sandbox execution helper, "cups-exec".
413 cups-exec
: cups-exec.o
415 $(CC
) $(LDFLAGS
) -o cups-exec cups-exec.o
$(LIBS
)
419 # Make the line printer daemon, "cups-lpd".
422 cups-lpd
: cups-lpd.o ..
/cups
/$(LIBCUPS
)
424 $(CC
) $(LDFLAGS
) -o cups-lpd cups-lpd.o
$(LIBS
)
431 libcupsmime.so
.1: $(LIBOBJS
)
433 $(DSO
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
) $(LIBS
)
434 $(RM
) `basename $@ .1`
435 $(LN
) $@
`basename $@ .1`
439 # libcupsmime.1.dylib
442 libcupsmime
.1.dylib
: $(LIBOBJS
) libcupsmime.exp
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 \
450 $(RM
) libcupsmime.dylib
451 $(LN
) $@ libcupsmime.dylib
458 libcupsmime.la
: $(LIBOBJS
)
460 $(CC
) $(ARCHFLAGS
) $(DSOFLAGS
) -o
$@
$(LIBOBJS
:.o
=.lo
) -rpath
$(LIBDIR
) \
461 -version-info
1:0 $(LIBS
)
468 libcupsmime.a
: $(LIBOBJS
)
471 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
476 # Make the test program, "testlpd".
479 testlpd
: testlpd.o ..
/cups
/$(LIBCUPSSTATIC
) cups-lpd
481 $(CC
) $(LDFLAGS
) -o testlpd testlpd.o ..
/cups
/$(LIBCUPSSTATIC
) \
482 $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) $(DNSSDLIBS
) $(LIBGSSAPI
)
489 testmime
: testmime.o libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
491 $(CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testmime.o libcupsmime.a \
492 ..
/cups
/$(LIBCUPSSTATIC
) $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) \
493 $(DNSSDLIBS
) $(LIBGSSAPI
)
494 echo Running MIME tests...
499 # Make the test program, "testspeed".
502 testspeed
: testspeed.o ..
/cups
/$(LIBCUPSSTATIC
)
504 $(CC
) $(LDFLAGS
) -o testspeed testspeed.o ..
/cups
/$(LIBCUPSSTATIC
) \
505 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
) $(LIBGSSAPI
)
509 # Make the test program, "testsub".
512 testsub
: testsub.o ..
/cups
/$(LIBCUPSSTATIC
)
514 $(CC
) $(LDFLAGS
) -o testsub testsub.o ..
/cups
/$(LIBCUPSSTATIC
) \
515 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
) $(LIBGSSAPI
)
519 # Lines of code computation...
524 sloccount
$(CUPSDOBJS
:.o
=.c
) $(LIBOBJS
:.o
=.c
) cups-driverd.
cxx cups-lpd.c
2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'