Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 1 | # This file can be invoked from the various frameworkinstall... targets in the |
| 2 | # main Makefile. The next couple of variables are overridden on the |
| 3 | # commandline in that case. |
| 4 | |
| 5 | VERSION=@VERSION@ |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 6 | builddir = .. |
| 7 | srcdir=@srcdir@ |
Ronald Oussoren | 4fbb080 | 2006-06-11 20:23:29 +0000 | [diff] [blame] | 8 | prefix=@prefix@ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 9 | LIBDEST=$(prefix)/lib/python$(VERSION) |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 10 | RUNSHARED=@RUNSHARED@ |
| 11 | BUILDEXE=@BUILDEXEEXT@ |
| 12 | BUILDPYTHON=$(builddir)/python$(BUILDEXE) |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 13 | DESTDIR= |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 14 | LDFLAGS=@LDFLAGS@ |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 15 | FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 16 | |
| 17 | # These are normally glimpsed from the previous set |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 18 | bindir=$(prefix)/bin |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 19 | PYTHONAPPSDIR=/Applications/MacPython $(VERSION) |
| 20 | APPINSTALLDIR=$(prefix)/Resources/Python.app |
| 21 | |
| 22 | # Variables for installing the "normal" unix binaries |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 23 | INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/Python |
| 24 | |
| 25 | # Items more-or-less copied from the main Makefile |
| 26 | DIRMODE=755 |
| 27 | FILEMODE=644 |
| 28 | INSTALL=@INSTALL@ |
| 29 | INSTALL_SYMLINK=ln -fsn |
| 30 | INSTALL_PROGRAM=@INSTALL_PROGRAM@ |
| 31 | INSTALL_SCRIPT= @INSTALL_SCRIPT@ |
| 32 | INSTALL_DATA=@INSTALL_DATA@ |
| 33 | LN=@LN@ |
| 34 | STRIPFLAG=-s |
| 35 | CPMAC=/Developer/Tools/CpMac |
| 36 | |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 37 | APPTEMPLATE=$(srcdir)/Resources/app |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 38 | APPSUBDIRS=MacOS Resources Resources/English.lproj \ |
| 39 | Resources/English.lproj/Documentation \ |
| 40 | Resources/English.lproj/Documentation/doc \ |
| 41 | Resources/English.lproj/Documentation/ide |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 42 | DOCDIR=$(srcdir)/Resources/app/Resources/English.lproj/Documentation |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 43 | DOCINDEX=$(DOCDIR)/"Documentation idx" |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 44 | CACHERSRC=$(srcdir)/scripts/cachersrc.py |
| 45 | compileall=$(srcdir)/../Lib/compileall.py |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 46 | |
| 47 | installapps: install_Python install_BuildApplet install_PythonLauncher \ |
| 48 | install_IDLE checkapplepython install_pythonw install_versionedtools |
| 49 | |
| 50 | install_pythonw: pythonw |
| 51 | $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" |
| 52 | $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)" |
| 53 | ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python" |
| 54 | ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw" |
| 55 | |
| 56 | # |
| 57 | # Install unix tools in /usr/local/bin. These are just aliases for the |
| 58 | # actual installation inside the framework. |
| 59 | # |
| 60 | installunixtools: |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 61 | if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ |
| 62 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 63 | fi |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 64 | for fn in python pythonw idle pydoc python-config smtpd.py \ |
| 65 | python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ |
| 66 | pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 67 | do \ |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 68 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 69 | done |
| 70 | |
Ronald Oussoren | 5b78732 | 2006-06-06 19:50:24 +0000 | [diff] [blame] | 71 | # |
| 72 | # Like installunixtools, but only install links to the versioned binaries. |
| 73 | # |
| 74 | altinstallunixtools: |
| 75 | if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ |
| 76 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ |
| 77 | fi |
| 78 | for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ |
| 79 | pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\ |
| 80 | do \ |
| 81 | ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ |
| 82 | done |
| 83 | |
| 84 | |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 85 | # By default most tools are installed without a version in their basename, to |
| 86 | # make it easier to install (and use) several python versions side-by-side move |
| 87 | # the tools to a version-specific name and add the non-versioned name as an |
| 88 | # alias. |
| 89 | install_versionedtools: |
| 90 | for fn in idle pydoc python-config ;\ |
| 91 | do \ |
Ronald Oussoren | da89b99 | 2006-05-23 11:04:24 +0000 | [diff] [blame] | 92 | if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \ |
| 93 | continue ;\ |
| 94 | fi ;\ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 95 | mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\ |
Ronald Oussoren | 3e3cb79 | 2006-05-18 09:04:15 +0000 | [diff] [blame] | 96 | ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 97 | done |
Ronald Oussoren | da89b99 | 2006-05-23 11:04:24 +0000 | [diff] [blame] | 98 | if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \ |
| 99 | mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\ |
| 100 | ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\ |
| 101 | fi |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 102 | |
| 103 | |
| 104 | pythonw: $(srcdir)/Tools/pythonw.c |
| 105 | $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \ |
| 106 | -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/Python"' |
| 107 | |
| 108 | |
| 109 | install_PythonLauncher: |
| 110 | cd PythonLauncher && make install DESTDIR=$(DESTDIR) |
| 111 | |
| 112 | install_Python: |
| 113 | @if test ! -f $(DOCINDEX); then \ |
| 114 | echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \ |
| 115 | fi |
| 116 | @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \ |
| 117 | if test ! -d "$(DESTDIR)$$i"; then \ |
| 118 | echo "Creating directory $(DESTDIR)$$i"; \ |
| 119 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \ |
| 120 | fi;\ |
| 121 | done |
| 122 | @for i in $(APPSUBDIRS); do \ |
| 123 | if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \ |
| 124 | echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ |
| 125 | $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ |
| 126 | else true; \ |
| 127 | fi; \ |
| 128 | done |
| 129 | @for d in . $(APPSUBDIRS); \ |
| 130 | do \ |
| 131 | a=$(APPTEMPLATE)/$$d; \ |
| 132 | if test ! -d $$a; then continue; else true; fi; \ |
| 133 | b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \ |
| 134 | for i in $$a/*; \ |
| 135 | do \ |
| 136 | case $$i in \ |
| 137 | *CVS) ;; \ |
| 138 | *.svn) ;; \ |
| 139 | *.py[co]) ;; \ |
| 140 | *.orig) ;; \ |
| 141 | *~) ;; \ |
| 142 | *idx) \ |
| 143 | echo $(CPMAC) "$$i" $$b; \ |
| 144 | $(CPMAC) "$$i" "$$b"; \ |
| 145 | ;; \ |
| 146 | *) \ |
| 147 | if test -d $$i; then continue; fi; \ |
| 148 | if test -x $$i; then \ |
| 149 | echo $(INSTALL_SCRIPT) "$$i" "$$b"; \ |
| 150 | $(INSTALL_SCRIPT) "$$i" "$$b"; \ |
| 151 | else \ |
| 152 | echo $(INSTALL_DATA) "$$i" "$$b"; \ |
| 153 | $(INSTALL_DATA) "$$i" "$$b"; \ |
| 154 | fi;; \ |
| 155 | esac; \ |
| 156 | done; \ |
| 157 | done |
| 158 | $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python" |
| 159 | |
| 160 | install_IDLE: |
| 161 | cd IDLE && make install |
| 162 | |
| 163 | install_BuildApplet: |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 164 | $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 165 | --destroot "$(DESTDIR)" \ |
| 166 | --python $(INSTALLED_PYTHONAPP) \ |
Ronald Oussoren | 3e3cb79 | 2006-05-18 09:04:15 +0000 | [diff] [blame] | 167 | --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \ |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 168 | $(srcdir)/scripts/BuildApplet.py |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 169 | |
| 170 | MACLIBDEST=$(LIBDEST)/plat-mac |
| 171 | MACTOOLSDEST=$(prefix)/Mac/Tools |
| 172 | MACTOOLSSRC=$(srcdir)/Mac/Tools |
| 173 | MACTOOLSSUBDIRS=IDE |
| 174 | |
| 175 | installmacsubtree: |
| 176 | @for i in $(MACTOOLSDEST); \ |
| 177 | do \ |
| 178 | if test ! -d $(DESTDIR)$$i; then \ |
| 179 | echo "Creating directory $(DESTDIR)$$i"; \ |
| 180 | $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ |
| 181 | else true; \ |
| 182 | fi; \ |
| 183 | done |
| 184 | @for d in $(MACTOOLSSUBDIRS); \ |
| 185 | do \ |
| 186 | a=$(MACTOOLSSRC)/$$d; \ |
| 187 | if test ! -d $$a; then continue; else true; fi; \ |
| 188 | b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ |
| 189 | if test ! -d $$b; then \ |
| 190 | echo "Creating directory $$b"; \ |
| 191 | $(INSTALL) -d -m $(DIRMODE) $$b; \ |
| 192 | else true; \ |
| 193 | fi; \ |
| 194 | done |
| 195 | @for d in $(MACTOOLSSUBDIRS); \ |
| 196 | do \ |
| 197 | a=$(MACTOOLSSRC)/$$d; \ |
| 198 | if test ! -d $$a; then continue; else true; fi; \ |
| 199 | b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ |
| 200 | for i in $$a/*; \ |
| 201 | do \ |
| 202 | case $$i in \ |
| 203 | *CVS) ;; \ |
| 204 | *.svn) ;; \ |
| 205 | *.py[co]) ;; \ |
| 206 | *.orig) ;; \ |
| 207 | *~) ;; \ |
| 208 | *.rsrc) \ |
| 209 | echo $(CPMAC) $$i $$b ; \ |
| 210 | $(CPMAC) $$i $$b ; \ |
| 211 | ;; \ |
| 212 | *) \ |
| 213 | if test -d $$i; then continue; fi; \ |
| 214 | if test -x $$i; then \ |
| 215 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 216 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 217 | else \ |
| 218 | echo $(INSTALL_DATA) $$i $$b; \ |
| 219 | $(INSTALL_DATA) $$i $$b; \ |
| 220 | fi;; \ |
| 221 | esac; \ |
| 222 | done; \ |
| 223 | done |
| 224 | |
| 225 | |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 226 | $(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) |
| 227 | $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) |
| 228 | $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 229 | |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 230 | $(INSTALLED_PYTHONAPP): install_Python |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 231 | |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 232 | installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 233 | $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras" |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 234 | $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt" |
| 235 | $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 236 | "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo" |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 237 | $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \ |
| 238 | "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac" |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 239 | |
| 240 | |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 241 | checkapplepython: $(srcdir)/Tools/fixapplepython23.py |
| 242 | @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 243 | echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \ |
Ronald Oussoren | 32f5d8f | 2006-06-07 19:02:03 +0000 | [diff] [blame] | 244 | echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \ |
Ronald Oussoren | 836b039 | 2006-05-14 19:56:34 +0000 | [diff] [blame] | 245 | fi |
| 246 | |
| 247 | |
| 248 | clean: |
| 249 | rm pythonw |
| 250 | cd PythonLauncher && make clean |
| 251 | cd IDLE && make clean |