Jack Jansen | 0b06be7 | 2002-06-21 14:48:38 +0000 | [diff] [blame] | 1 | # This file can be invoked from the "python.app" target in the |
| 2 | # main Makefile. The next two variables are overridden on the |
| 3 | # commandline in that case. |
| 4 | |
| 5 | # assume user was invoking from Mac/OSX directory and building in source tree |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 6 | builddir = ../.. |
| 7 | srcdir = ../.. |
| 8 | VERSION=2.3 |
Jack Jansen | 0b06be7 | 2002-06-21 14:48:38 +0000 | [diff] [blame] | 9 | |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 10 | prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 11 | PYTHONAPPSDIR=/Applications/Python |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 12 | APPINSTALLDIR=$(prefix)/Resources/Python.app |
Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 13 | |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 14 | # Variables for installing the "normal" unix binaries |
| 15 | UNIXBINDIR=/usr/local/bin |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 16 | INSTALLED_PYTHON=$(prefix)/bin/python |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 17 | INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python |
| 18 | |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 19 | # Items more-or-less copied from the main Makefile |
| 20 | DIRMODE=755 |
| 21 | INSTALL=/usr/bin/install -c |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 22 | INSTALL_SYMLINK=/usr/bin/install -l as |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 23 | INSTALL_PROGRAM=${INSTALL} |
| 24 | INSTALL_SCRIPT= ${INSTALL_PROGRAM} |
| 25 | INSTALL_DATA= ${INSTALL} -m 644 |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 26 | STRIPFLAG=-s |
Jack Jansen | 2cce33f | 2002-03-29 21:17:14 +0000 | [diff] [blame] | 27 | OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ |
| 28 | -fno-common -dynamic |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 29 | INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include |
Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 30 | DEFINES=-DHAVE_CONFIG_H |
| 31 | |
| 32 | CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 33 | LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \ |
Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 34 | -framework Foundation |
| 35 | CC=cc |
| 36 | LD=cc |
Jack Jansen | fea1553 | 2002-01-27 20:05:20 +0000 | [diff] [blame] | 37 | REZ=/Developer/Tools/Rez |
| 38 | DEREZ=/Developer/Tools/DeRez |
Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 39 | |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 40 | PYTHON=$(builddir)/python.exe |
| 41 | APPTEMPLATE=$(srcdir)/Mac/OSXResources/app |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 42 | APPSUBDIRS=MacOS Resources Resources/English.lproj |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 43 | RESOURCEDIR=$(srcdir)/Mac/Resources |
Jack Jansen | c432cba | 2001-09-09 00:36:52 +0000 | [diff] [blame] | 44 | RESOURCEFILE=python.rsrc |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 45 | RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 46 | |
Jack Jansen | 940dc92 | 2002-08-02 21:46:40 +0000 | [diff] [blame] | 47 | install_all: install_PythonLauncher install_Python install_BuildApplet install_IDE |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 48 | |
| 49 | install_PythonLauncher: |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 50 | cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 51 | pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install |
| 52 | |
Jack Jansen | 21ed16a | 2002-08-02 14:11:24 +0000 | [diff] [blame] | 53 | install_Python: $(PYTHON) |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 54 | @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 55 | if test ! -d $$i; then \ |
| 56 | echo "Creating directory $$i"; \ |
| 57 | $(INSTALL) -d -m $(DIRMODE) $$i; \ |
| 58 | fi;\ |
| 59 | done |
| 60 | @for i in $(APPSUBDIRS); do \ |
| 61 | if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \ |
| 62 | echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \ |
| 63 | $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \ |
| 64 | else true; \ |
| 65 | fi; \ |
| 66 | done |
| 67 | @for d in . $(APPSUBDIRS); \ |
| 68 | do \ |
| 69 | a=$(APPTEMPLATE)/$$d; \ |
| 70 | if test ! -d $$a; then continue; else true; fi; \ |
| 71 | b=$(APPINSTALLDIR)/Contents/$$d; \ |
| 72 | for i in $$a/*; \ |
| 73 | do \ |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 74 | case $$i in \ |
| 75 | *CVS) ;; \ |
| 76 | *.py[co]) ;; \ |
| 77 | *.orig) ;; \ |
| 78 | *~) ;; \ |
| 79 | *) \ |
| 80 | if test -d $$i; then continue; fi; \ |
| 81 | if test -x $$i; then \ |
| 82 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 83 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 84 | else \ |
| 85 | echo $(INSTALL_DATA) $$i $$b; \ |
| 86 | $(INSTALL_DATA) $$i $$b; \ |
| 87 | fi;; \ |
| 88 | esac; \ |
| 89 | done; \ |
| 90 | done |
Jack Jansen | 21ed16a | 2002-08-02 14:11:24 +0000 | [diff] [blame] | 91 | $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python |
Jack Jansen | c432cba | 2001-09-09 00:36:52 +0000 | [diff] [blame] | 92 | # Create a temporary version of the resources here |
Jack Jansen | fdc8d75 | 2002-01-15 23:20:40 +0000 | [diff] [blame] | 93 | $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc |
| 94 | $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc |
Jack Jansen | fea1553 | 2002-01-27 20:05:20 +0000 | [diff] [blame] | 95 | $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r |
| 96 | $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r |
| 97 | $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r |
Jack Jansen | c432cba | 2001-09-09 00:36:52 +0000 | [diff] [blame] | 98 | $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE) |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 99 | |
| 100 | install_IDE: $(INSTALLED_PYTHONW) |
Jack Jansen | f80798b | 2002-08-02 21:04:46 +0000 | [diff] [blame] | 101 | @if $(INSTALLED_PYTHONW) -c "import waste"; then ; else \ |
| 102 | echo PythonIDE needs the \"waste\" extension module; \ |
| 103 | echo See Mac/OSX/README for details; \ |
| 104 | exit 1; \ |
| 105 | fi |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 106 | $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 107 | --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 108 | $(srcdir)/Mac/Tools/IDE/PythonIDE.py |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 109 | |
Jack Jansen | 940e970 | 2002-08-02 15:32:12 +0000 | [diff] [blame] | 110 | install_BuildApplet: $(INSTALLED_PYTHONW) |
| 111 | $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ |
| 112 | --output $(PYTHONAPPSDIR)/BuildApplet.app \ |
| 113 | $(srcdir)/Mac/scripts/BuildApplet.py |
| 114 | |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 115 | LIBDEST=$(prefix)/Mac/Lib |
| 116 | LIBSRC=$(srcdir)/Mac/Lib |
Jack Jansen | dc74568 | 2002-05-23 22:18:13 +0000 | [diff] [blame] | 117 | LIBSUBDIRS= \ |
| 118 | Carbon \ |
| 119 | lib-scriptpackages \ |
| 120 | lib-scriptpackages/_builtinSuites \ |
| 121 | lib-scriptpackages/CodeWarrior \ |
| 122 | lib-scriptpackages/Explorer \ |
| 123 | lib-scriptpackages/Finder \ |
| 124 | lib-scriptpackages/Netscape \ |
| 125 | lib-scriptpackages/StdSuites \ |
| 126 | lib-scriptpackages/Terminal \ |
| 127 | mkcwproject \ |
| 128 | mkcwproject/template \ |
| 129 | mkcwproject/template-carbon \ |
| 130 | mkcwproject/template-ppc |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 131 | TOOLSDEST=$(prefix)/Mac/Tools |
| 132 | TOOLSSRC=$(srcdir)/Mac/Tools |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 133 | TOOLSSUBDIRS=IDE |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 134 | installmacsubtree: |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 135 | @for i in $(LIBDEST) $(TOOLSDEST); \ |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 136 | do \ |
| 137 | if test ! -d $$i; then \ |
| 138 | echo "Creating directory $$i"; \ |
| 139 | $(INSTALL) -d -m $(DIRMODE) $$i; \ |
| 140 | else true; \ |
| 141 | fi; \ |
| 142 | done |
| 143 | @for d in $(LIBSUBDIRS); \ |
| 144 | do \ |
| 145 | a=$(LIBSRC)/$$d; \ |
| 146 | if test ! -d $$a; then continue; else true; fi; \ |
| 147 | b=$(LIBDEST)/$$d; \ |
| 148 | if test ! -d $$b; then \ |
| 149 | echo "Creating directory $$b"; \ |
| 150 | $(INSTALL) -d -m $(DIRMODE) $$b; \ |
| 151 | else true; \ |
| 152 | fi; \ |
| 153 | done |
| 154 | @for i in $(LIBSRC)/*.py $(LIBSRC)/*.rsrc; \ |
| 155 | do \ |
| 156 | if test -x $$i; then \ |
| 157 | $(INSTALL_SCRIPT) $$i $(LIBDEST); \ |
| 158 | echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ |
| 159 | else \ |
| 160 | $(INSTALL_DATA) $$i $(LIBDEST); \ |
| 161 | echo $(INSTALL_DATA) $$i $(LIBDEST); \ |
| 162 | fi; \ |
| 163 | done |
| 164 | @for d in $(LIBSUBDIRS); \ |
| 165 | do \ |
| 166 | a=$(LIBSRC)/$$d; \ |
| 167 | if test ! -d $$a; then continue; else true; fi; \ |
| 168 | b=$(LIBDEST)/$$d; \ |
| 169 | for i in $$a/*; \ |
| 170 | do \ |
| 171 | case $$i in \ |
| 172 | *CVS) ;; \ |
| 173 | *.py[co]) ;; \ |
| 174 | *.orig) ;; \ |
| 175 | *~) ;; \ |
| 176 | *) \ |
| 177 | if test -d $$i; then continue; fi; \ |
| 178 | if test -x $$i; then \ |
| 179 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 180 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 181 | else \ |
| 182 | echo $(INSTALL_DATA) $$i $$b; \ |
| 183 | $(INSTALL_DATA) $$i $$b; \ |
| 184 | fi;; \ |
| 185 | esac; \ |
| 186 | done; \ |
| 187 | done |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 188 | @for d in $(TOOLSSUBDIRS); \ |
| 189 | do \ |
| 190 | a=$(TOOLSSRC)/$$d; \ |
| 191 | if test ! -d $$a; then continue; else true; fi; \ |
| 192 | b=$(TOOLSDEST)/$$d; \ |
| 193 | if test ! -d $$b; then \ |
| 194 | echo "Creating directory $$b"; \ |
| 195 | $(INSTALL) -d -m $(DIRMODE) $$b; \ |
| 196 | else true; \ |
| 197 | fi; \ |
| 198 | done |
| 199 | @for d in $(TOOLSSUBDIRS); \ |
| 200 | do \ |
| 201 | a=$(TOOLSSRC)/$$d; \ |
| 202 | if test ! -d $$a; then continue; else true; fi; \ |
| 203 | b=$(TOOLSDEST)/$$d; \ |
| 204 | for i in $$a/*; \ |
| 205 | do \ |
| 206 | case $$i in \ |
| 207 | *CVS) ;; \ |
| 208 | *.py[co]) ;; \ |
| 209 | *.orig) ;; \ |
| 210 | *~) ;; \ |
| 211 | *) \ |
| 212 | if test -d $$i; then continue; fi; \ |
| 213 | if test -x $$i; then \ |
| 214 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 215 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 216 | else \ |
| 217 | echo $(INSTALL_DATA) $$i $$b; \ |
| 218 | $(INSTALL_DATA) $$i $$b; \ |
| 219 | fi;; \ |
| 220 | esac; \ |
| 221 | done; \ |
| 222 | done |
| 223 | |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 224 | $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(prefix)/lib/python$(VERSION)/site-packages/ |
Jack Jansen | 109f094 | 2002-01-18 16:12:27 +0000 | [diff] [blame] | 225 | |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 226 | # Put symlinks "python" and "pythonw" in the standard place |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 227 | $(INSTALLED_PYTHONW): install_Python |
| 228 | # $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. |
| 229 | |
| 230 | installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 231 | $(INSTALL) -d $(UNIXBINDIR) |
| 232 | $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python |
| 233 | $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw |
| 234 | |
Jack Jansen | c361f94 | 2002-07-08 13:34:23 +0000 | [diff] [blame] | 235 | # This is for development purposes: create a Mac.pth that refers to the source |
| 236 | # directories |
| 237 | dontinstallmacsubtree: |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 238 | l=`cd $(srcdir)/Mac/Lib; pwd`; \ |
| 239 | echo $$l > $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth ; \ |
| 240 | echo $$l/lib-scriptpackages >> $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth |