1# 2# Makefile for the CUPS PPD Compiler. 3# 4# Copyright © 2007-2019 by Apple Inc. 5# Copyright © 2002-2006 by Easy Software Products. 6# 7# Licensed under Apache License v2.0. See the file "LICENSE" for more 8# information. 9# 10 11# 12# Include standard definitions... 13# 14 15include ../Makedefs 16 17 18# 19# Object files... 20# 21 22LIBOBJS = \ 23 ppdc-array.o \ 24 ppdc-attr.o \ 25 ppdc-catalog.o \ 26 ppdc-choice.o \ 27 ppdc-constraint.o \ 28 ppdc-driver.o \ 29 ppdc-file.o \ 30 ppdc-filter.o \ 31 ppdc-font.o \ 32 ppdc-group.o \ 33 ppdc-import.o \ 34 ppdc-mediasize.o \ 35 ppdc-message.o \ 36 ppdc-option.o \ 37 ppdc-profile.o \ 38 ppdc-shared.o \ 39 ppdc-source.o \ 40 ppdc-string.o \ 41 ppdc-variable.o 42OBJS = \ 43 $(LIBOBJS) \ 44 genstrings.o \ 45 ppdc.o \ 46 ppdhtml.o \ 47 ppdi.o \ 48 ppdmerge.o \ 49 ppdpo.o \ 50 testcatalog.o 51LIBTARGETS = \ 52 libcupsppdc.a 53UNITTARGETS = \ 54 ppdc-static \ 55 ppdi-static \ 56 testcatalog 57EXECTARGETS = \ 58 ppdc \ 59 ppdhtml \ 60 ppdi \ 61 ppdmerge \ 62 ppdpo 63 64TARGETS = \ 65 $(LIBTARGETS) \ 66 $(EXECTARGETS) \ 67 $(LOCALTARGET) 68 69 70# 71# Make everything... 72# 73 74all: $(TARGETS) 75 76 77# 78# Make library targets... 79# 80 81libs: 82 83 84# 85# Make unit tests... 86# 87 88unittests: $(UNITTARGETS) 89 90 91# 92# Clean everything... 93# 94 95clean: 96 $(RM) $(OBJS) core 97 $(RM) *.bak *.bck core.* 98 $(RM) $(TARGETS) $(UNITTARGETS) genstrings 99 $(RM) -r ppd ppd2 100 $(RM) sample-import.drv sample.c test.drv 101 102 103# 104# Update dependencies... 105# 106 107depend: 108 $(CXX) -MM $(ALL_CXXFLAGS) $(OBJS:.o=.cxx) >Dependencies 109 110 111# 112# Install all targets... 113# 114 115install: all install-data install-headers install-libs install-exec 116 117 118# 119# Install data files... 120# 121 122install-data: 123 $(INSTALL_DIR) $(DATADIR)/drv 124 $(INSTALL_DATA) sample.drv $(DATADIR)/drv 125 126 127# 128# Install programs... 129# 130 131install-exec: 132 echo Installing PPD compiler programs... 133 $(INSTALL_DIR) $(BINDIR) 134 for file in $(EXECTARGETS); do \ 135 $(INSTALL_BIN) $$file $(BINDIR); \ 136 done 137 if test "x$(SYMROOT)" != "x"; then \ 138 $(INSTALL_DIR) $(SYMROOT); \ 139 for file in $(EXECTARGETS); do \ 140 cp $$file $(SYMROOT); \ 141 dsymutil $(SYMROOT)/$$file; \ 142 done \ 143 fi 144 145 146# 147# Install headers... 148# 149 150install-headers: 151 152 153# 154# Install libraries... 155# 156 157install-libs: 158 159 160# 161# Uninstall... 162# 163 164uninstall: 165 for file in $(EXECTARGETS); do \ 166 $(RM) $(BINDIR)/$$file; \ 167 done 168 $(RM) $(DATADIR)/drv/sample.drv 169 $(RMDIR) $(DATADIR)/drv 170 171 172# 173# Local programs (not built when cross-compiling...) 174# 175 176local: genstrings 177 178 179# 180# genstrings - generate GNU gettext strings. 181# 182 183genstrings: genstrings.o libcupsppdc.a ../cups/$(LIBCUPSSTATIC) \ 184 sample.drv ../data/media.defs 185 echo Linking $@... 186 $(LD_CXX) $(ARCHFLAGS) $(ALL_LDFLAGS) -o genstrings genstrings.o \ 187 libcupsppdc.a $(LINKCUPSSTATIC) 188 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 189 echo Generating localization strings... 190 ./genstrings >sample.c 191 192 193# 194# ppdc, the PPD compiler. 195# 196 197ppdc: ppdc.o libcupsppdc.a ../cups/$(LIBCUPS) 198 echo Linking $@... 199 $(LD_CXX) $(ALL_LDFLAGS) -o $@ ppdc.o libcupsppdc.a $(COMMONLIBS) $(LINKCUPS) 200 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 201 202 203ppdc-static: ppdc.o libcupsppdc.a ../cups/$(LIBCUPSSTATIC) foo.drv foo-fr.po 204 echo Linking $@... 205 $(LD_CXX) $(ARCHFLAGS) $(ALL_LDFLAGS) -o ppdc-static ppdc.o libcupsppdc.a \ 206 $(LINKCUPSSTATIC) 207 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 208 echo Testing PPD compiler... 209 ./ppdc-static -l en,fr -I ../data foo.drv 210 ./ppdc-static -l en,fr -z -I ../data foo.drv 211 212 213# 214# ppdhtml, the PPD to HTML utility. 215# 216 217ppdhtml: ppdhtml.o libcupsppdc.a ../cups/$(LIBCUPS) 218 echo Linking $@... 219 $(LD_CXX) $(ALL_LDFLAGS) -o $@ ppdhtml.o libcupsppdc.a $(COMMONLIBS) $(LINKCUPS) 220 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 221 222 223# 224# ppdi, import PPD files. 225# 226 227ppdi: ppdi.o libcupsppdc.a ../cups/$(LIBCUPS) 228 echo Linking $@... 229 $(LD_CXX) $(ALL_LDFLAGS) -o $@ ppdi.o libcupsppdc.a $(COMMONLIBS) $(LINKCUPS) 230 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 231 232 233ppdi-static: ppdc-static ppdi.o libcupsppdc.a ../cups/$(LIBCUPSSTATIC) 234 echo Linking $@... 235 $(LD_CXX) $(ARCHFLAGS) $(ALL_LDFLAGS) -o ppdi-static ppdi.o libcupsppdc.a \ 236 $(LINKCUPSSTATIC) 237 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 238 echo Testing PPD importer... 239 $(RM) -r ppd ppd2 sample-import.drv 240 ./ppdc-static -l en -I ../data sample.drv 241 ./ppdi-static -I ../data -o sample-import.drv ppd/* 242 ./ppdc-static -l en -I ../data -d ppd2 sample-import.drv 243 if diff -r ppd ppd2 >/dev/null; then \ 244 echo PPD import OK; \ 245 else \ 246 echo PPD import FAILED; \ 247 exit 1; \ 248 fi 249 250 251# 252# ppdmerge, merge PPD files. 253# 254 255ppdmerge: ppdmerge.o ../cups/$(LIBCUPS) 256 echo Linking $@... 257 $(LD_CXX) $(ALL_LDFLAGS) -o $@ ppdmerge.o $(LINKCUPS) 258 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 259 260 261# 262# ppdpo, create message catalog files. 263# 264 265ppdpo: ppdpo.o libcupsppdc.a ../cups/$(LIBCUPS) 266 echo Linking $@... 267 $(LD_CXX) $(ALL_LDFLAGS) -o $@ ppdpo.o libcupsppdc.a $(COMMONLIBS) $(LINKCUPS) 268 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 269 270 271# 272# testcatalog, test ppdcCatalog class. 273# 274 275testcatalog: testcatalog.o libcupsppdc.a ../cups/$(LIBCUPSSTATIC) 276 echo Linking $@... 277 $(LD_CXX) $(ALL_LDFLAGS) -o $@ testcatalog.o libcupsppdc.a \ 278 $(LINKCUPSSTATIC) 279 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@ 280 281 282# 283# libcupsppdc.a 284# 285 286libcupsppdc.a: $(LIBOBJS) 287 echo Archiving $@... 288 $(RM) $@ 289 $(AR) $(ARFLAGS) $@ $(LIBOBJS) 290 $(RANLIB) $@ 291 292 293# 294# Include dependencies... 295# 296 297include Dependencies 298