Haibo Huang | 4c28362 | 2019-12-13 16:47:52 -0800 | [diff] [blame] | 1 | # |
| 2 | # Top-level 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 |
| 8 | # information. |
| 9 | # |
| 10 | |
| 11 | include Makedefs |
| 12 | |
| 13 | |
| 14 | # |
| 15 | # Directories to make... |
| 16 | # |
| 17 | |
| 18 | DIRS = cups $(BUILDDIRS) |
| 19 | |
| 20 | |
| 21 | # |
| 22 | # Test suite options - normally blank, override with make command... |
| 23 | # |
| 24 | |
| 25 | TESTOPTIONS = |
| 26 | |
| 27 | |
| 28 | # |
| 29 | # Make all targets... |
| 30 | # |
| 31 | |
| 32 | all: |
| 33 | chmod +x cups-config |
| 34 | echo Using ARCHFLAGS="$(ARCHFLAGS)" |
| 35 | echo Using ALL_CFLAGS="$(ALL_CFLAGS)" |
| 36 | echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)" |
| 37 | echo Using CC="$(CC)" |
| 38 | echo Using CXX="$(CC)" |
| 39 | echo Using DSOFLAGS="$(DSOFLAGS)" |
| 40 | echo Using LDFLAGS="$(LDFLAGS)" |
| 41 | echo Using LIBS="$(LIBS)" |
| 42 | for dir in $(DIRS); do\ |
| 43 | echo Making all in $$dir... ;\ |
| 44 | (cd $$dir ; $(MAKE) $(MFLAGS) all $(UNITTESTS)) || exit 1;\ |
| 45 | done |
| 46 | |
| 47 | |
| 48 | # |
| 49 | # Make library targets... |
| 50 | # |
| 51 | |
| 52 | libs: |
| 53 | echo Using ARCHFLAGS="$(ARCHFLAGS)" |
| 54 | echo Using ALL_CFLAGS="$(ALL_CFLAGS)" |
| 55 | echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)" |
| 56 | echo Using CC="$(CC)" |
| 57 | echo Using CXX="$(CC)" |
| 58 | echo Using DSOFLAGS="$(DSOFLAGS)" |
| 59 | echo Using LDFLAGS="$(LDFLAGS)" |
| 60 | echo Using LIBS="$(LIBS)" |
| 61 | for dir in $(DIRS); do\ |
| 62 | echo Making libraries in $$dir... ;\ |
| 63 | (cd $$dir ; $(MAKE) $(MFLAGS) libs) || exit 1;\ |
| 64 | done |
| 65 | |
| 66 | |
| 67 | # |
| 68 | # Make unit test targets... |
| 69 | # |
| 70 | |
| 71 | unittests: |
| 72 | echo Using ARCHFLAGS="$(ARCHFLAGS)" |
| 73 | echo Using ALL_CFLAGS="$(ALL_CFLAGS)" |
| 74 | echo Using ALL_CXXFLAGS="$(ALL_CXXFLAGS)" |
| 75 | echo Using CC="$(CC)" |
| 76 | echo Using CXX="$(CC)" |
| 77 | echo Using DSOFLAGS="$(DSOFLAGS)" |
| 78 | echo Using LDFLAGS="$(LDFLAGS)" |
| 79 | echo Using LIBS="$(LIBS)" |
| 80 | for dir in $(DIRS); do\ |
| 81 | echo Making all in $$dir... ;\ |
| 82 | (cd $$dir ; $(MAKE) $(MFLAGS) unittests) || exit 1;\ |
| 83 | done |
| 84 | |
| 85 | |
| 86 | # |
| 87 | # Remove object and target files... |
| 88 | # |
| 89 | |
| 90 | clean: |
| 91 | for dir in $(DIRS); do\ |
| 92 | echo Cleaning in $$dir... ;\ |
| 93 | (cd $$dir; $(MAKE) $(MFLAGS) clean) || exit 1;\ |
| 94 | done |
| 95 | |
| 96 | |
| 97 | # |
| 98 | # Remove all non-distribution files... |
| 99 | # |
| 100 | |
| 101 | distclean: clean |
| 102 | $(RM) Makedefs config.h config.log config.status |
| 103 | $(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf |
| 104 | $(RM) cups-config |
| 105 | $(RM) desktop/cups.desktop |
| 106 | $(RM) doc/index.html |
| 107 | $(RM) packaging/cups.list |
| 108 | $(RM) scheduler/cups-lpd.xinetd scheduler/cups.sh scheduler/cups.xml scheduler/org.cups.cups-lpd.plist scheduler/org.cups.cups-lpdAT.service scheduler/org.cups.cupsd.path scheduler/org.cups.cupsd.service scheduler/org.cups.cupsd.socket |
| 109 | $(RM) templates/header.tmpl |
| 110 | -$(RM) doc/*/index.html |
| 111 | -$(RM) templates/*/header.tmpl |
| 112 | -$(RM) -r autom4te*.cache cups/charmaps cups/locale |
| 113 | |
| 114 | |
| 115 | # |
| 116 | # Make dependencies |
| 117 | # |
| 118 | |
| 119 | depend: |
| 120 | for dir in $(DIRS); do\ |
| 121 | echo Making dependencies in $$dir... ;\ |
| 122 | (cd $$dir; $(MAKE) $(MFLAGS) depend) || exit 1;\ |
| 123 | done |
| 124 | |
| 125 | |
| 126 | # |
| 127 | # Run the STACK tool on the sources, available here: |
| 128 | # |
| 129 | # http://css.csail.mit.edu/stack/ |
| 130 | # |
| 131 | # Do the following to pass options to configure: |
| 132 | # |
| 133 | # make CONFIGFLAGS="--foo --bar" stack |
| 134 | # |
| 135 | |
| 136 | .PHONY: stack |
| 137 | stack: |
| 138 | stack-build ./configure $(CONFIGFLAGS) |
| 139 | stack-build $(MAKE) $(MFLAGS) clean all |
| 140 | poptck |
| 141 | $(MAKE) $(MFLAGS) distclean |
| 142 | $(RM) */*.ll |
| 143 | $(RM) */*.ll.out |
| 144 | |
| 145 | |
| 146 | # |
| 147 | # Generate a ctags file... |
| 148 | # |
| 149 | |
| 150 | ctags: |
| 151 | ctags -R . |
| 152 | |
| 153 | |
| 154 | # |
| 155 | # Install everything... |
| 156 | # |
| 157 | |
| 158 | install: install-data install-headers install-libs install-exec |
| 159 | |
| 160 | |
| 161 | # |
| 162 | # Install data files... |
| 163 | # |
| 164 | |
| 165 | install-data: |
| 166 | echo Making all in cups... |
| 167 | (cd cups; $(MAKE) $(MFLAGS) all) |
| 168 | for dir in $(DIRS); do\ |
| 169 | echo Installing data files in $$dir... ;\ |
| 170 | (cd $$dir; $(MAKE) $(MFLAGS) install-data) || exit 1;\ |
| 171 | done |
| 172 | echo Installing cups-config script... |
| 173 | $(INSTALL_DIR) -m 755 $(BINDIR) |
| 174 | $(INSTALL_SCRIPT) cups-config $(BINDIR)/cups-config |
| 175 | |
| 176 | |
| 177 | # |
| 178 | # Install header files... |
| 179 | # |
| 180 | |
| 181 | install-headers: |
| 182 | for dir in $(DIRS); do\ |
| 183 | echo Installing header files in $$dir... ;\ |
| 184 | (cd $$dir; $(MAKE) $(MFLAGS) install-headers) || exit 1;\ |
| 185 | done |
| 186 | if test "x$(privateinclude)" != x; then \ |
| 187 | echo Installing config.h into $(PRIVATEINCLUDE)...; \ |
| 188 | $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \ |
| 189 | $(INSTALL_DATA) config.h $(PRIVATEINCLUDE)/config.h; \ |
| 190 | fi |
| 191 | |
| 192 | |
| 193 | # |
| 194 | # Install programs... |
| 195 | # |
| 196 | |
| 197 | install-exec: all |
| 198 | for dir in $(DIRS); do\ |
| 199 | echo Installing programs in $$dir... ;\ |
| 200 | (cd $$dir; $(MAKE) $(MFLAGS) install-exec) || exit 1;\ |
| 201 | done |
| 202 | |
| 203 | |
| 204 | # |
| 205 | # Install libraries... |
| 206 | # |
| 207 | |
| 208 | install-libs: libs |
| 209 | for dir in $(DIRS); do\ |
| 210 | echo Installing libraries in $$dir... ;\ |
| 211 | (cd $$dir; $(MAKE) $(MFLAGS) install-libs) || exit 1;\ |
| 212 | done |
| 213 | |
| 214 | |
| 215 | # |
| 216 | # Uninstall object and target files... |
| 217 | # |
| 218 | |
| 219 | uninstall: |
| 220 | for dir in $(DIRS); do\ |
| 221 | echo Uninstalling in $$dir... ;\ |
| 222 | (cd $$dir; $(MAKE) $(MFLAGS) uninstall) || exit 1;\ |
| 223 | done |
| 224 | echo Uninstalling cups-config script... |
| 225 | $(RM) $(BINDIR)/cups-config |
| 226 | -$(RMDIR) $(BINDIR) |
| 227 | |
| 228 | |
| 229 | # |
| 230 | # Run the test suite... |
| 231 | # |
| 232 | |
| 233 | test: all unittests |
| 234 | echo Running CUPS test suite... |
| 235 | cd test; ./run-stp-tests.sh $(TESTOPTIONS) |
| 236 | |
| 237 | |
| 238 | check: all unittests |
| 239 | echo Running CUPS test suite with defaults... |
| 240 | cd test; ./run-stp-tests.sh 1 0 n n |
| 241 | |
| 242 | debugcheck: all unittests |
| 243 | echo Running CUPS test suite with debug printfs... |
| 244 | cd test; ./run-stp-tests.sh 1 0 n y |
| 245 | |
| 246 | |
| 247 | # |
| 248 | # Create HTML documentation using codedoc (http://www.msweet.org/codedoc)... |
| 249 | # |
| 250 | |
| 251 | apihelp: |
| 252 | for dir in cups filter; do\ |
| 253 | echo Generating API help in $$dir... ;\ |
| 254 | (cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\ |
| 255 | done |
| 256 | |
| 257 | |
| 258 | # |
| 259 | # Lines of code computation... |
| 260 | # |
| 261 | |
| 262 | sloc: |
| 263 | for dir in cups scheduler; do \ |
| 264 | (cd $$dir; $(MAKE) $(MFLAGS) sloc) || exit 1;\ |
| 265 | done |
| 266 | |
| 267 | |
| 268 | # |
| 269 | # Make software distributions using EPM (http://www.msweet.org/)... |
| 270 | # |
| 271 | |
| 272 | EPMFLAGS = -v --output-dir dist $(EPMARCH) |
| 273 | |
| 274 | bsd deb epm pkg rpm slackware: |
| 275 | epm $(EPMFLAGS) -f $@ cups packaging/cups.list |
| 276 | |
| 277 | .PHONY: dist |
| 278 | dist: all |
| 279 | $(RM) -r dist |
| 280 | $(MAKE) $(MFLAGS) epm |
| 281 | case `uname` in \ |
| 282 | *BSD*) $(MAKE) $(MFLAGS) bsd;; \ |
| 283 | Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \ |
| 284 | SunOS*) $(MAKE) $(MFLAGS) pkg;; \ |
| 285 | esac |
| 286 | |
| 287 | |
| 288 | # |
| 289 | # Don't run top-level build targets in parallel... |
| 290 | # |
| 291 | |
| 292 | .NOTPARALLEL: |