1# 2# Backend makefile for CUPS. 3# 4# Copyright 2007-2019 by Apple Inc. 5# Copyright 1997-2007 by Easy Software Products, all rights reserved. 6# 7# Licensed under Apache License v2.0. See the file "LICENSE" for more information. 8# 9 10include ../Makedefs 11 12# 13# Object files... 14# 15 16# RBACKENDS are installed mode 0700 so cupsd will run them as root... 17# 18# UBACKENDS and ULBACKENDS are installed mode 0755 so cupsd will run them as 19# an unprivileged user... 20# 21# See http://www.cups.org/doc/api-filter.html for more info... 22RBACKENDS = \ 23 ipp \ 24 lpd \ 25 $(DNSSD_BACKEND) 26UBACKENDS = \ 27 snmp \ 28 socket 29ULBACKENDS = \ 30 usb 31UNITTESTS = \ 32 test1284 \ 33 testbackend \ 34 testsupplies 35TARGETS = \ 36 libbackend.a \ 37 $(RBACKENDS) \ 38 $(UBACKENDS) \ 39 $(ULBACKENDS) 40LIBOBJS = \ 41 ieee1284.o \ 42 network.o \ 43 runloop.o \ 44 snmp-supplies.o 45OBJS = \ 46 ipp.o \ 47 lpd.o \ 48 dnssd.o \ 49 snmp.o \ 50 socket.o \ 51 test1284.o \ 52 testbackend.o \ 53 testsupplies.o \ 54 usb.o 55 56 57# 58# Make all targets... 59# 60 61all: $(TARGETS) 62 63 64# 65# Make library targets... 66# 67 68libs: $(ULBACKENDS) 69 70 71# 72# Make unit tests... 73# 74 75unittests: $(UNITTESTS) 76 77 78# 79# Clean all object files... 80# 81 82clean: 83 $(RM) $(OBJS) $(TARGETS) $(UNITTESTS) $(LIBOBJS) http https ipps mdns socket-static 84 85 86# 87# Update dependencies (without system header dependencies...) 88# 89 90depend: 91 $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies 92 93 94# 95# Install all targets... 96# 97 98install: all install-data install-headers install-libs install-exec 99 100 101# 102# Install data files... 103# 104 105install-data: 106 if test "x$(USBQUIRKS)" != x; then \ 107 echo Installing USB quirks in $(USBQUIRKS); \ 108 $(INSTALL_DIR) -m 755 $(USBQUIRKS); \ 109 $(INSTALL_DATA) org.cups.usb-quirks $(USBQUIRKS); \ 110 fi 111 112 113# 114# Install programs... 115# 116 117install-exec: $(INSTALLXPC) 118 echo Installing backends in $(SERVERBIN)/backend 119 $(INSTALL_DIR) -m 755 $(SERVERBIN)/backend 120 for file in $(RBACKENDS); do \ 121 $(LIBTOOL) $(INSTALL_BIN) -m 700 $$file $(SERVERBIN)/backend; \ 122 done 123 for file in $(UBACKENDS); do \ 124 $(INSTALL_BIN) $$file $(SERVERBIN)/backend; \ 125 done 126 for file in $(IPPALIASES); do \ 127 $(RM) $(SERVERBIN)/backend/$$file; \ 128 $(LN) ipp $(SERVERBIN)/backend/$$file; \ 129 done 130 if test "x$(DNSSD_BACKEND)" != x -a `uname` = Darwin; then \ 131 $(RM) $(SERVERBIN)/backend/mdns; \ 132 $(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \ 133 fi 134 if test "x$(SYMROOT)" != "x"; then \ 135 $(INSTALL_DIR) $(SYMROOT); \ 136 for file in $(RBACKENDS) $(UBACKENDS); do \ 137 cp $$file $(SYMROOT); \ 138 dsymutil $(SYMROOT)/$$file; \ 139 done \ 140 fi 141 142install-xpc: ipp 143 echo Installing XPC backends in $(SERVERBIN)/apple 144 $(INSTALL_DIR) -m 755 $(SERVERBIN)/apple 145 $(LIBTOOL) $(INSTALL_BIN) ipp $(SERVERBIN)/apple 146 for file in $(IPPALIASES); do \ 147 $(RM) $(SERVERBIN)/apple/$$file; \ 148 $(LN) ipp $(SERVERBIN)/apple/$$file; \ 149 done 150 151 152# 153# Install headers... 154# 155 156install-headers: 157 158 159# 160# Install libraries... 161# 162 163install-libs: 164 echo Installing backends in $(SERVERBIN)/backend 165 $(INSTALL_DIR) -m 755 $(SERVERBIN)/backend 166 for file in $(ULBACKENDS); do \ 167 $(INSTALL_BIN) $$file $(SERVERBIN)/backend; \ 168 done 169 if test "x$(SYMROOT)" != "x"; then \ 170 $(INSTALL_DIR) $(SYMROOT); \ 171 for file in $(ULBACKENDS); do \ 172 cp $$file $(SYMROOT); \ 173 dsymutil $(SYMROOT)/$$file; \ 174 done \ 175 fi 176 177 178# 179# Uninstall all targets... 180# 181 182uninstall: 183 $(RM) $(SERVERBIN)/apple/ipp 184 for file in $(IPPALIASES); do \ 185 $(RM) $(SERVERBIN)/apple/$$file; \ 186 done 187 -$(RMDIR) $(SERVERBIN)/apple 188 for file in $(RBACKENDS) $(UBACKENDS) $(ULBACKENDS); do \ 189 $(RM) $(SERVERBIN)/backend/$$file; \ 190 done 191 for file in $(IPPALIASES); do \ 192 $(RM) $(SERVERBIN)/backend/$$file; \ 193 done 194 -$(RMDIR) $(SERVERBIN)/backend 195 -$(RMDIR) $(SERVERBIN) 196 197 198# 199# test1284 200# 201 202test1284: test1284.o ../cups/$(LIBCUPSSTATIC) 203 echo Linking $@... 204 $(LD_CC) $(ALL_LDFLAGS) -o test1284 test1284.o $(LINKCUPSSTATIC) 205 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 206 207 208# 209# testbackend 210# 211 212testbackend: testbackend.o ../cups/$(LIBCUPSSTATIC) 213 echo Linking $@... 214 $(LD_CC) $(ALL_LDFLAGS) -o testbackend testbackend.o $(LINKCUPSSTATIC) 215 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 216 217 218# 219# testsupplies 220# 221 222testsupplies: testsupplies.o libbackend.a ../cups/$(LIBCUPSSTATIC) 223 echo Linking $@... 224 $(LD_CC) $(ALL_LDFLAGS) -o testsupplies testsupplies.o libbackend.a \ 225 $(LINKCUPSSTATIC) 226 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 227 228 229# 230# libbackend.a 231# 232 233libbackend.a: $(LIBOBJS) 234 echo Archiving $@... 235 $(RM) $@ 236 $(AR) $(ARFLAGS) $@ $(LIBOBJS) 237 $(RANLIB) $@ 238 239 240# 241# dnssd 242# 243 244dnssd: dnssd.o ../cups/$(LIBCUPS) libbackend.a 245 echo Linking $@... 246 $(LD_CC) $(ALL_LDFLAGS) -o dnssd dnssd.o libbackend.a $(DNSSDLIBS) $(LINKCUPS) 247 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 248 if test `uname` = Darwin; then \ 249 $(RM) mdns; \ 250 $(LN) dnssd mdns; \ 251 fi 252 253 254# 255# ipp 256# 257 258ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a 259 echo Linking $@... 260 $(LD_CC) $(ALL_LDFLAGS) -o ipp ipp.o libbackend.a $(LINKCUPS) 261 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 262 $(RM) http https ipps 263 for file in $(IPPALIASES); do \ 264 $(LN) ipp $$file; \ 265 done 266 267 268# 269# lpd 270# 271 272lpd: lpd.o ../cups/$(LIBCUPS) libbackend.a 273 echo Linking $@... 274 $(LD_CC) $(ALL_LDFLAGS) -o lpd lpd.o libbackend.a $(LINKCUPS) 275 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 276 277 278# 279# snmp 280# 281 282snmp: snmp.o ../cups/$(LIBCUPS) libbackend.a 283 echo Linking $@... 284 $(LD_CC) $(ALL_LDFLAGS) -o snmp snmp.o libbackend.a $(LINKCUPS) 285 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 286 287 288# 289# socket 290# 291 292socket: socket.o ../cups/$(LIBCUPS) libbackend.a 293 echo Linking $@... 294 $(LD_CC) $(ALL_LDFLAGS) -o socket socket.o libbackend.a $(LINKCUPS) 295 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 296 297socket-static: socket.o ../cups/$(LIBCUPSSTATIC) libbackend.a 298 echo Linking $@... 299 $(LD_CC) $(ALL_LDFLAGS) -o socket-static socket.o libbackend.a \ 300 $(LINKCUPSSTATIC) 301 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 302 303 304# 305# usb 306# 307 308usb: usb.o ../cups/$(LIBCUPS) libbackend.a 309 echo Linking $@... 310 $(LD_CC) $(ARCHFLAGS) $(ALL_LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \ 311 $(BACKLIBS) $(COMMONLIBS) $(LINKCUPS) 312 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 313usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c 314 315 316# 317# Dependencies... 318# 319 320include Dependencies 321