2 # Scheduler Makefile for CUPS.
4 # Copyright © 2007-2018 by Apple Inc.
5 # Copyright © 1997-2007 by Easy Software Products, all rights reserved.
7 # Licensed under Apache License v2.0. See the file "LICENSE" for more
90 # Make library targets...
100 unittests
: $(UNITTARGETS
)
104 # Clean all object files...
109 $(RM
) $(TARGETS
) $(UNITTARGETS
) convert
113 # Update dependencies (without system header dependencies...)
117 $(CC
) -MM
$(ALL_CFLAGS
) $(COBJS
:.o
=.c
) >Dependencies
118 $(CXX
) -MM
$(ALL_CXXFLAGS
) $(CXXOBJS
:.o
=.
cxx) >>Dependencies
122 # Run oclint to check code coverage...
126 oclint
-o
=oclint.html
-html
$(CUPSDOBJS
:.o
=.c
) $(LIBOBJS
:.o
=.c
) -- $(ALL_CFLAGS
)
130 # Install all targets...
133 install: all install-data install-headers install-libs install-exec
137 # Install data files...
141 echo Creating
$(SERVERBIN
)/driver...
142 $(INSTALL_DIR
) -m
755 $(SERVERBIN
)/driver
143 echo Creating
$(SERVERROOT
)...
144 $(INSTALL_DIR
) -m
755 -g
$(CUPS_GROUP
) $(SERVERROOT
)
145 echo Creating
$(SERVERROOT
)/ppd...
146 $(INSTALL_DIR
) -m
755 -g
$(CUPS_GROUP
) $(SERVERROOT
)/ppd
147 if
test "x`uname`" != xDarwin
; then \
148 echo Creating
$(SERVERROOT
)/ssl...
; \
149 $(INSTALL_DIR
) -m
700 -g
$(CUPS_GROUP
) $(SERVERROOT
)/ssl
; \
151 if
test "$(STATEDIR)" != "$(SERVERROOT)"; then \
152 echo Creating
$(STATEDIR
)...
; \
153 $(INSTALL_DIR
) -m
755 $(STATEDIR
); \
155 echo Creating
$(STATEDIR
)/certs...
156 $(INSTALL_DIR
) -m
511 -o
$(CUPS_USER
) -g
$(CUPS_PRIMARY_SYSTEM_GROUP
) \
158 echo Creating
$(LOGDIR
)...
159 $(INSTALL_DIR
) -m
755 $(LOGDIR
)
160 echo Creating
$(REQUESTS
)...
161 $(INSTALL_DIR
) -m
710 -g
$(CUPS_GROUP
) $(REQUESTS
)
162 echo Creating
$(REQUESTS
)/tmp...
163 $(INSTALL_DIR
) -m
1770 -g
$(CUPS_GROUP
) $(REQUESTS
)/tmp
164 echo Creating
$(CACHEDIR
)...
165 $(INSTALL_DIR
) -m
770 -g
$(CUPS_GROUP
) $(CACHEDIR
)
166 if
test "x$(INITDIR)" != x
; then \
167 echo Installing init scripts...
; \
168 $(INSTALL_DIR
) -m
755 $(BUILDROOT
)$(INITDIR
)/init.d
; \
169 $(INSTALL_SCRIPT
) cups.sh
$(BUILDROOT
)$(INITDIR
)/init.d
/cups
; \
170 for level in
$(RCLEVELS
); do \
171 $(INSTALL_DIR
) -m
755 $(BUILDROOT
)$(INITDIR
)/rc
$${level}.d
; \
172 $(LN
) ..
/init.d
/cups
$(BUILDROOT
)$(INITDIR
)/rc
$${level}.d
/S
$(RCSTART
)cups
; \
173 $(LN
) ..
/init.d
/cups
$(BUILDROOT
)$(INITDIR
)/rc
$${level}.d
/K
$(RCSTOP
)cups
; \
175 $(INSTALL_DIR
) -m
755 $(BUILDROOT
)$(INITDIR
)/rc0.d
; \
176 $(LN
) ..
/init.d
/cups
$(BUILDROOT
)$(INITDIR
)/rc0.d
/K
$(RCSTOP
)cups
; \
178 if
test "x$(INITDDIR)" != x
; then \
179 echo Installing init script...
; \
180 $(INSTALL_DIR
) -m
755 $(BUILDROOT
)$(INITDDIR
); \
181 $(INSTALL_SCRIPT
) cups.sh
$(BUILDROOT
)$(INITDDIR
); \
183 if
test "x$(LAUNCHD_DIR)" != x
; then \
184 echo Installing launchd configuration files...
; \
185 $(INSTALL_DIR
) $(BUILDROOT
)$(LAUNCHD_DIR
); \
186 $(INSTALL_DATA
) org.cups.cupsd.plist
$(BUILDROOT
)$(LAUNCHD_DIR
); \
187 $(INSTALL_DATA
) org.cups.cups-lpd.plist
$(BUILDROOT
)$(LAUNCHD_DIR
); \
189 if
test "x$(SMFMANIFESTDIR)" != x
; then \
190 echo Installing SMF manifest in
$(SMFMANIFESTDIR
)...
;\
191 $(INSTALL_DIR
) $(BUILDROOT
)/$(SMFMANIFESTDIR
); \
192 $(INSTALL_SCRIPT
) cups.xml
$(BUILDROOT
)$(SMFMANIFESTDIR
)/cups.xml
; \
194 if
test "x$(SYSTEMD_DIR)" != x
; then \
195 echo Installing systemd configuration files...
; \
196 $(INSTALL_DIR
) $(BUILDROOT
)$(SYSTEMD_DIR
); \
197 $(INSTALL_DATA
) org.cups.cupsd.path
$(BUILDROOT
)$(SYSTEMD_DIR
); \
198 $(INSTALL_DATA
) org.cups.cupsd.service
$(BUILDROOT
)$(SYSTEMD_DIR
); \
199 $(INSTALL_DATA
) org.cups.cupsd.socket
$(BUILDROOT
)$(SYSTEMD_DIR
); \
200 $(INSTALL_DATA
) org.cups.cups-lpdAT.service
$(BUILDROOT
)$(SYSTEMD_DIR
)/org.cups.cups-lpd@.service
; \
201 $(INSTALL_DATA
) org.cups.cups-lpd.socket
$(BUILDROOT
)$(SYSTEMD_DIR
); \
202 elif
test "x$(XINETD)" != x
; then \
203 echo Installing xinetd configuration file for cups-lpd...
; \
204 $(INSTALL_DIR
) -m
755 $(BUILDROOT
)$(XINETD
); \
205 $(INSTALL_DATA
) cups-lpd.xinetd
$(BUILDROOT
)$(XINETD
)/cups-lpd
; \
210 # Install programs...
214 echo Installing programs in
$(SBINDIR
)...
215 $(INSTALL_DIR
) -m
755 $(SBINDIR
)
216 $(INSTALL_BIN
) -m
$(CUPS_CUPSD_FILE_PERM
) cupsd
$(SBINDIR
)
217 $(INSTALL_BIN
) cupsfilter
$(SBINDIR
)
218 echo Installing programs in
$(SERVERBIN
)/daemon...
219 $(INSTALL_DIR
) -m
755 $(SERVERBIN
)
220 $(INSTALL_DIR
) -m
755 $(SERVERBIN
)/daemon
221 $(INSTALL_BIN
) cups-deviced
$(SERVERBIN
)/daemon
222 $(INSTALL_BIN
) cups-driverd
$(SERVERBIN
)/daemon
223 $(INSTALL_BIN
) cups-exec
$(SERVERBIN
)/daemon
224 $(INSTALL_BIN
) cups-lpd
$(SERVERBIN
)/daemon
225 if
test "x$(SYMROOT)" != "x"; then \
226 $(INSTALL_DIR
) $(SYMROOT
); \
227 for file in
$(PROGRAMS
); do \
228 cp
$$file $(SYMROOT
); \
229 dsymutil
$(SYMROOT
)/$$file; \
242 # Install libraries...
249 # Uninstall the scheduler...
253 $(RM
) $(SBINDIR
)/cupsd
254 $(RM
) $(SBINDIR
)/cupsfilter
255 $(RM
) $(SERVERBIN
)/daemon
/cups-deviced
256 $(RM
) $(SERVERBIN
)/daemon
/cups-driverd
257 $(RM
) $(SERVERBIN
)/daemon
/cups-exec
258 $(RM
) $(SERVERBIN
)/daemon
/cups-lpd
259 -$(RMDIR
) $(STATEDIR
)/certs
260 -$(RMDIR
) $(STATEDIR
)
261 -$(RMDIR
) $(SERVERROOT
)/ppd
262 -$(RMDIR
) $(SERVERROOT
)/interfaces
263 -$(RMDIR
) $(SERVERROOT
)
264 -$(RMDIR
) $(SERVERBIN
)/driver
265 -$(RMDIR
) $(SERVERBIN
)/daemon
266 -$(RMDIR
) $(SERVERBIN
)
268 -$(RMDIR
) $(REQUESTS
)/tmp
269 -$(RMDIR
) $(REQUESTS
)
271 -$(RMDIR
) $(CACHEDIR
)
272 if
test "x$(INITDIR)" != x
; then \
273 echo Uninstalling init scripts...
; \
274 $(RM
) $(BUILDROOT
)$(INITDIR
)/init.d
/cups
; \
275 $(RMDIR
) $(BUILDROOT
)$(INITDIR
)/init.d
; \
276 $(RM
) $(BUILDROOT
)$(INITDIR
)/rc0.d
/K00cups
; \
277 $(RMDIR
) $(BUILDROOT
)$(INITDIR
)/rc0.d
; \
278 $(RM
) $(BUILDROOT
)$(INITDIR
)/rc2.d
/S99cups
; \
279 $(RMDIR
) $(BUILDROOT
)$(INITDIR
)/rc2.d
; \
280 $(RM
) $(BUILDROOT
)$(INITDIR
)/rc3.d
/S99cups
; \
281 $(RMDIR
) $(BUILDROOT
)$(INITDIR
)/rc3.d
; \
282 $(RM
) $(BUILDROOT
)$(INITDIR
)/rc5.d
/S99cups
; \
283 $(RMDIR
) $(BUILDROOT
)$(INITDIR
)/rc5.d
; \
285 if
test "x$(INITDDIR)" != x
; then \
286 echo Uninstalling startup script...
; \
287 $(RM
) $(BUILDROOT
)$(INITDDIR
)/cups.sh
; \
288 $(RMDIR
) $(BUILDROOT
)$(INITDDIR
); \
290 if
test "x$LAUNCHD_DIR" != x
; then \
291 echo Uninstalling launchd files...
; \
292 $(RM
) $(BUILDROOT
)$(LAUNCHD_DIR
)/org.cups.cupsd.plist
; \
293 $(RM
) $(BUILDROOT
)$(LAUNCHD_DIR
)/org.cups.cups-lpd.plist
; \
295 if
test "x$SYSTEMD_DIR" != x
; then \
296 echo Uninstalling systemd files...
; \
297 $(RM
) $(BUILDROOT
)$(SYSTEMD_DIR
)/org.cups.cupsd.path
; \
298 $(RM
) $(BUILDROOT
)$(SYSTEMD_DIR
)/org.cups.cupsd.service
; \
299 $(RM
) $(BUILDROOT
)$(SYSTEMD_DIR
)/org.cups.cupsd.socket
; \
301 if
test "x$(SMFMANIFESTDIR)" != x
; then \
302 echo Uninstalling SMF manifest file...
;\
303 $(RM
) $(BUILDROOT
)$(SMFMANIFESTDIR
)/cups.xml
; \
305 if
test "x$(XINETD)" != x
; then \
306 echo Uninstalling xinetd configuration file for cups-lpd...
; \
307 $(RM
) $(BUILDROOT
)$(XINETD
)/cups-lpd
; \
312 # Make the scheduler executable, "cupsd".
315 cupsd
: $(CUPSDOBJS
) libcupsmime.a ..
/cups
/$(LIBCUPS
)
317 $(LD_CC
) $(LDFLAGS
) -o cupsd
$(CUPSDOBJS
) libcupsmime.a \
318 $(LIBZ
) $(SSLLIBS
) $(LIBSLP
) $(LIBLDAP
) $(PAMLIBS
) \
319 $(LIBPAPER
) $(LIBMALLOC
) $(SERVERLIBS
) $(ONDEMANDLIBS
) \
320 $(DNSSDLIBS
) $(LIBS
) $(LIBGSSAPI
) $(LIBWRAP
)
321 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
323 cupsd-static
: $(CUPSDOBJS
) libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
325 $(LD_CC
) $(LDFLAGS
) -o cupsd-static
$(CUPSDOBJS
) libcupsmime.a \
326 $(LIBZ
) $(SSLLIBS
) $(LIBSLP
) $(LIBLDAP
) $(PAMLIBS
) \
327 ..
/cups
/$(LIBCUPSSTATIC
) $(COMMONLIBS
) $(LIBZ
) $(LIBPAPER
) \
328 $(LIBMALLOC
) $(SERVERLIBS
) $(ONDEMANDLIBS
) $(DNSSDLIBS
) \
329 $(LIBGSSAPI
) $(LIBWRAP
)
330 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
334 # Make the cupsfilter utility.
337 cupsfilter
: cupsfilter.o libcupsmime.a ..
/cups
/$(LIBCUPS
)
339 $(LD_CC
) $(LDFLAGS
) -o cupsfilter cupsfilter.o libcupsmime.a
$(LIBS
)
340 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
342 $(LN
) cupsfilter convert
344 cupsfilter-static
: cupsfilter.o libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
346 $(LD_CC
) $(LDFLAGS
) -o cupsfilter-static cupsfilter.o libcupsmime.a \
347 ..
/cups
/$(LIBCUPSSTATIC
) $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) \
348 $(DNSSDLIBS
) $(LIBGSSAPI
)
349 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
353 # Make the device daemon, "cups-deviced".
356 cups-deviced
: cups-deviced.o util.o ..
/cups
/$(LIBCUPS
)
358 $(LD_CC
) $(LDFLAGS
) -o cups-deviced cups-deviced.o util.o
$(LIBS
)
359 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
363 # Make the driver daemon, "cups-driverd".
366 cups-driverd
: cups-driverd.o util.o ..
/cups
/$(LIBCUPS
) ..
/ppdc
/libcupsppdc.a
368 $(LD_CXX
) $(LDFLAGS
) -o cups-driverd cups-driverd.o util.o \
369 ..
/ppdc
/libcupsppdc.a
$(LIBS
)
370 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
374 # Make the sandbox execution helper, "cups-exec".
377 cups-exec
: cups-exec.o
379 $(LD_CC
) $(LDFLAGS
) -o cups-exec cups-exec.o
$(LIBS
)
380 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
384 # Make the line printer daemon, "cups-lpd".
387 cups-lpd
: cups-lpd.o ..
/cups
/$(LIBCUPS
)
389 $(LD_CC
) $(LDFLAGS
) -o cups-lpd cups-lpd.o
$(LIBS
)
390 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
397 libcupsmime.a
: $(LIBOBJS
)
400 $(AR
) $(ARFLAGS
) $@
$(LIBOBJS
)
405 # Make the test program, "testlpd".
408 testlpd
: testlpd.o ..
/cups
/$(LIBCUPSSTATIC
) cups-lpd
410 $(LD_CC
) $(LDFLAGS
) -o testlpd testlpd.o ..
/cups
/$(LIBCUPSSTATIC
) \
411 $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) $(DNSSDLIBS
) $(LIBGSSAPI
)
418 testmime
: testmime.o libcupsmime.a ..
/cups
/$(LIBCUPSSTATIC
)
420 $(LD_CC
) $(ARCHFLAGS
) $(LDFLAGS
) -o
$@ testmime.o libcupsmime.a \
421 ..
/cups
/$(LIBCUPSSTATIC
) $(COMMONLIBS
) $(LIBZ
) $(SSLLIBS
) \
422 $(DNSSDLIBS
) $(LIBGSSAPI
)
423 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
424 echo Running MIME tests...
429 # Make the test program, "testspeed".
432 testspeed
: testspeed.o ..
/cups
/$(LIBCUPSSTATIC
)
434 $(LD_CC
) $(LDFLAGS
) -o testspeed testspeed.o ..
/cups
/$(LIBCUPSSTATIC
) \
435 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
) $(LIBGSSAPI
)
436 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
440 # Make the test program, "testsub".
443 testsub
: testsub.o ..
/cups
/$(LIBCUPSSTATIC
)
445 $(LD_CC
) $(LDFLAGS
) -o testsub testsub.o ..
/cups
/$(LIBCUPSSTATIC
) \
446 $(SSLLIBS
) $(DNSSDLIBS
) $(COMMONLIBS
) $(LIBZ
) $(LIBGSSAPI
)
447 $(CODE_SIGN
) -s
"$(CODE_SIGN_IDENTITY)" $@
451 # Lines of code computation...
456 sloccount
$(CUPSDOBJS
:.o
=.c
) $(LIBOBJS
:.o
=.c
) cups-driverd.
cxx cups-lpd.c
2>/dev
/null | grep
"Total Physical" | awk
'{print $$9}'