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