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 | |
| 47 | install_all: install_PythonLauncher install_Python install_IDE |
| 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 | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 101 | $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 102 | --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 103 | $(srcdir)/Mac/Tools/IDE/PythonIDE.py |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 104 | |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 105 | LIBDEST=$(prefix)/Mac/Lib |
| 106 | LIBSRC=$(srcdir)/Mac/Lib |
Jack Jansen | dc74568 | 2002-05-23 22:18:13 +0000 | [diff] [blame] | 107 | LIBSUBDIRS= \ |
| 108 | Carbon \ |
| 109 | lib-scriptpackages \ |
| 110 | lib-scriptpackages/_builtinSuites \ |
| 111 | lib-scriptpackages/CodeWarrior \ |
| 112 | lib-scriptpackages/Explorer \ |
| 113 | lib-scriptpackages/Finder \ |
| 114 | lib-scriptpackages/Netscape \ |
| 115 | lib-scriptpackages/StdSuites \ |
| 116 | lib-scriptpackages/Terminal \ |
| 117 | mkcwproject \ |
| 118 | mkcwproject/template \ |
| 119 | mkcwproject/template-carbon \ |
| 120 | mkcwproject/template-ppc |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 121 | TOOLSDEST=$(prefix)/Mac/Tools |
| 122 | TOOLSSRC=$(srcdir)/Mac/Tools |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 123 | TOOLSSUBDIRS=IDE |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 124 | installmacsubtree: |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 125 | @for i in $(LIBDEST) $(TOOLSDEST); \ |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 126 | do \ |
| 127 | if test ! -d $$i; then \ |
| 128 | echo "Creating directory $$i"; \ |
| 129 | $(INSTALL) -d -m $(DIRMODE) $$i; \ |
| 130 | else true; \ |
| 131 | fi; \ |
| 132 | done |
| 133 | @for d in $(LIBSUBDIRS); \ |
| 134 | do \ |
| 135 | a=$(LIBSRC)/$$d; \ |
| 136 | if test ! -d $$a; then continue; else true; fi; \ |
| 137 | b=$(LIBDEST)/$$d; \ |
| 138 | if test ! -d $$b; then \ |
| 139 | echo "Creating directory $$b"; \ |
| 140 | $(INSTALL) -d -m $(DIRMODE) $$b; \ |
| 141 | else true; \ |
| 142 | fi; \ |
| 143 | done |
| 144 | @for i in $(LIBSRC)/*.py $(LIBSRC)/*.rsrc; \ |
| 145 | do \ |
| 146 | if test -x $$i; then \ |
| 147 | $(INSTALL_SCRIPT) $$i $(LIBDEST); \ |
| 148 | echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ |
| 149 | else \ |
| 150 | $(INSTALL_DATA) $$i $(LIBDEST); \ |
| 151 | echo $(INSTALL_DATA) $$i $(LIBDEST); \ |
| 152 | fi; \ |
| 153 | done |
| 154 | @for d in $(LIBSUBDIRS); \ |
| 155 | do \ |
| 156 | a=$(LIBSRC)/$$d; \ |
| 157 | if test ! -d $$a; then continue; else true; fi; \ |
| 158 | b=$(LIBDEST)/$$d; \ |
| 159 | for i in $$a/*; \ |
| 160 | do \ |
| 161 | case $$i in \ |
| 162 | *CVS) ;; \ |
| 163 | *.py[co]) ;; \ |
| 164 | *.orig) ;; \ |
| 165 | *~) ;; \ |
| 166 | *) \ |
| 167 | if test -d $$i; then continue; fi; \ |
| 168 | if test -x $$i; then \ |
| 169 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 170 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 171 | else \ |
| 172 | echo $(INSTALL_DATA) $$i $$b; \ |
| 173 | $(INSTALL_DATA) $$i $$b; \ |
| 174 | fi;; \ |
| 175 | esac; \ |
| 176 | done; \ |
| 177 | done |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 178 | @for d in $(TOOLSSUBDIRS); \ |
| 179 | do \ |
| 180 | a=$(TOOLSSRC)/$$d; \ |
| 181 | if test ! -d $$a; then continue; else true; fi; \ |
| 182 | b=$(TOOLSDEST)/$$d; \ |
| 183 | if test ! -d $$b; then \ |
| 184 | echo "Creating directory $$b"; \ |
| 185 | $(INSTALL) -d -m $(DIRMODE) $$b; \ |
| 186 | else true; \ |
| 187 | fi; \ |
| 188 | done |
| 189 | @for d in $(TOOLSSUBDIRS); \ |
| 190 | do \ |
| 191 | a=$(TOOLSSRC)/$$d; \ |
| 192 | if test ! -d $$a; then continue; else true; fi; \ |
| 193 | b=$(TOOLSDEST)/$$d; \ |
| 194 | for i in $$a/*; \ |
| 195 | do \ |
| 196 | case $$i in \ |
| 197 | *CVS) ;; \ |
| 198 | *.py[co]) ;; \ |
| 199 | *.orig) ;; \ |
| 200 | *~) ;; \ |
| 201 | *) \ |
| 202 | if test -d $$i; then continue; fi; \ |
| 203 | if test -x $$i; then \ |
| 204 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 205 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 206 | else \ |
| 207 | echo $(INSTALL_DATA) $$i $$b; \ |
| 208 | $(INSTALL_DATA) $$i $$b; \ |
| 209 | fi;; \ |
| 210 | esac; \ |
| 211 | done; \ |
| 212 | done |
| 213 | |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 214 | $(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] | 215 | |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 216 | # Put symlinks "python" and "pythonw" in the standard place |
Jack Jansen | cce7e34 | 2002-07-31 14:46:04 +0000 | [diff] [blame] | 217 | $(INSTALLED_PYTHONW): install_Python |
| 218 | # $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. |
| 219 | |
| 220 | installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 221 | $(INSTALL) -d $(UNIXBINDIR) |
| 222 | $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python |
| 223 | $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw |
| 224 | |
Jack Jansen | c361f94 | 2002-07-08 13:34:23 +0000 | [diff] [blame] | 225 | # This is for development purposes: create a Mac.pth that refers to the source |
| 226 | # directories |
| 227 | dontinstallmacsubtree: |
Jack Jansen | be3e1f7 | 2002-08-01 21:14:06 +0000 | [diff] [blame] | 228 | l=`cd $(srcdir)/Mac/Lib; pwd`; \ |
| 229 | echo $$l > $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth ; \ |
| 230 | echo $$l/lib-scriptpackages >> $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth |