Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 1 | PYTHONBUILDDIR=../.. |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 2 | INSTALLDIR=/Library/Frameworks/Python.framework/Versions/Current |
| 3 | APPINSTALLDIR=/Applications/Python.app |
Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 4 | |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 5 | # Variables for installing the "normal" unix binaries |
| 6 | UNIXBINDIR=/usr/local/bin |
| 7 | INSTALLED_PYTHON=$(INSTALLDIR)/bin/python |
| 8 | INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python |
| 9 | |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 10 | # Items more-or-less copied from the main Makefile |
| 11 | DIRMODE=755 |
| 12 | INSTALL=/usr/bin/install -c |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 13 | INSTALL_SYMLINK=/usr/bin/install -l as |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 14 | INSTALL_PROGRAM=${INSTALL} |
| 15 | INSTALL_SCRIPT= ${INSTALL_PROGRAM} |
| 16 | INSTALL_DATA= ${INSTALL} -m 644 |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 17 | STRIPFLAG=-s |
Jack Jansen | 2cce33f | 2002-03-29 21:17:14 +0000 | [diff] [blame] | 18 | OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ |
| 19 | -fno-common -dynamic |
Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 20 | INCLUDES=-I$(PYTHONBUILDDIR) -I$(PYTHONBUILDDIR)/Include \ |
| 21 | -I$(PYTHONBUILDDIR)/Mac/Include |
| 22 | DEFINES=-DHAVE_CONFIG_H |
| 23 | |
| 24 | CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) |
| 25 | LDFLAGS=-framework System -framework Python -framework Carbon \ |
| 26 | -framework Foundation |
| 27 | CC=cc |
| 28 | LD=cc |
Jack Jansen | fea1553 | 2002-01-27 20:05:20 +0000 | [diff] [blame] | 29 | REZ=/Developer/Tools/Rez |
| 30 | DEREZ=/Developer/Tools/DeRez |
Jack Jansen | 75ed167 | 2001-09-05 22:09:50 +0000 | [diff] [blame] | 31 | |
| 32 | OBJECTS=$(PYTHONBUILDDIR)/Mac/Python/macmain.o \ |
| 33 | $(PYTHONBUILDDIR)/Mac/Python/macgetargv.o |
| 34 | |
| 35 | pythonforbundle: $(OBJECTS) |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 36 | $(LD) $(LDFLAGS) $(OBJECTS) -o pythonforbundle |
| 37 | |
Jack Jansen | c432cba | 2001-09-09 00:36:52 +0000 | [diff] [blame] | 38 | PYTHON=$(PYTHONBUILDDIR)/python.exe |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 39 | APPTEMPLATE=$(PYTHONBUILDDIR)/Mac/OSXResources/app |
| 40 | APPSUBDIRS=MacOS Resources Resources/English.lproj |
Jack Jansen | fdc8d75 | 2002-01-15 23:20:40 +0000 | [diff] [blame] | 41 | RESOURCEDIR=$(PYTHONBUILDDIR)/Mac/Resources |
Jack Jansen | c432cba | 2001-09-09 00:36:52 +0000 | [diff] [blame] | 42 | RESOURCEFILE=python.rsrc |
| 43 | RFCONVERTER=$(PYTHONBUILDDIR)/Mac/Lib/applesingle.py |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 44 | install: pythonforbundle |
| 45 | @for i in $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ |
| 46 | if test ! -d $$i; then \ |
| 47 | echo "Creating directory $$i"; \ |
| 48 | $(INSTALL) -d -m $(DIRMODE) $$i; \ |
| 49 | fi;\ |
| 50 | done |
| 51 | @for i in $(APPSUBDIRS); do \ |
| 52 | if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \ |
| 53 | echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \ |
| 54 | $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \ |
| 55 | else true; \ |
| 56 | fi; \ |
| 57 | done |
| 58 | @for d in . $(APPSUBDIRS); \ |
| 59 | do \ |
| 60 | a=$(APPTEMPLATE)/$$d; \ |
| 61 | if test ! -d $$a; then continue; else true; fi; \ |
| 62 | b=$(APPINSTALLDIR)/Contents/$$d; \ |
| 63 | for i in $$a/*; \ |
| 64 | do \ |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 65 | case $$i in \ |
| 66 | *CVS) ;; \ |
| 67 | *.py[co]) ;; \ |
| 68 | *.orig) ;; \ |
| 69 | *~) ;; \ |
| 70 | *) \ |
| 71 | if test -d $$i; then continue; fi; \ |
| 72 | if test -x $$i; then \ |
| 73 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 74 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 75 | else \ |
| 76 | echo $(INSTALL_DATA) $$i $$b; \ |
| 77 | $(INSTALL_DATA) $$i $$b; \ |
| 78 | fi;; \ |
| 79 | esac; \ |
| 80 | done; \ |
| 81 | done |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 82 | $(INSTALL_PROGRAM) $(STRIPFLAG) pythonforbundle $(APPINSTALLDIR)/Contents/MacOS/python |
Jack Jansen | c432cba | 2001-09-09 00:36:52 +0000 | [diff] [blame] | 83 | # Create a temporary version of the resources here |
Jack Jansen | fdc8d75 | 2002-01-15 23:20:40 +0000 | [diff] [blame] | 84 | $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc |
| 85 | $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc |
Jack Jansen | fea1553 | 2002-01-27 20:05:20 +0000 | [diff] [blame] | 86 | $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r |
| 87 | $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r |
| 88 | $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r |
Jack Jansen | c432cba | 2001-09-09 00:36:52 +0000 | [diff] [blame] | 89 | $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE) |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 90 | |
| 91 | LIBDEST=$(INSTALLDIR)/Mac/Lib |
| 92 | LIBSRC=$(PYTHONBUILDDIR)/Mac/Lib |
| 93 | LIBSUBDIRS=Carbon lib-scriptpackages lib-scriptpackages/CodeWarrior lib-scriptpackages/Explorer \ |
| 94 | lib-scriptpackages/Finder lib-scriptpackages/Netscape lib-scriptpackages/StdSuites \ |
| 95 | mkcwproject mkcwproject/template mkcwproject/template-carbon mkcwproject/template-ppc |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 96 | TOOLSDEST=$(INSTALLDIR)/Mac/Tools |
| 97 | TOOLSSRC=$(PYTHONBUILDDIR)/Mac/Tools |
| 98 | TOOLSSUBDIRS=IDE |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 99 | installmacsubtree: |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 100 | @for i in $(LIBDEST) $(TOOLSDEST); \ |
Jack Jansen | 638e5e3 | 2001-09-06 16:33:57 +0000 | [diff] [blame] | 101 | do \ |
| 102 | if test ! -d $$i; then \ |
| 103 | echo "Creating directory $$i"; \ |
| 104 | $(INSTALL) -d -m $(DIRMODE) $$i; \ |
| 105 | else true; \ |
| 106 | fi; \ |
| 107 | done |
| 108 | @for d in $(LIBSUBDIRS); \ |
| 109 | do \ |
| 110 | a=$(LIBSRC)/$$d; \ |
| 111 | if test ! -d $$a; then continue; else true; fi; \ |
| 112 | b=$(LIBDEST)/$$d; \ |
| 113 | if test ! -d $$b; then \ |
| 114 | echo "Creating directory $$b"; \ |
| 115 | $(INSTALL) -d -m $(DIRMODE) $$b; \ |
| 116 | else true; \ |
| 117 | fi; \ |
| 118 | done |
| 119 | @for i in $(LIBSRC)/*.py $(LIBSRC)/*.rsrc; \ |
| 120 | do \ |
| 121 | if test -x $$i; then \ |
| 122 | $(INSTALL_SCRIPT) $$i $(LIBDEST); \ |
| 123 | echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ |
| 124 | else \ |
| 125 | $(INSTALL_DATA) $$i $(LIBDEST); \ |
| 126 | echo $(INSTALL_DATA) $$i $(LIBDEST); \ |
| 127 | fi; \ |
| 128 | done |
| 129 | @for d in $(LIBSUBDIRS); \ |
| 130 | do \ |
| 131 | a=$(LIBSRC)/$$d; \ |
| 132 | if test ! -d $$a; then continue; else true; fi; \ |
| 133 | b=$(LIBDEST)/$$d; \ |
| 134 | for i in $$a/*; \ |
| 135 | do \ |
| 136 | case $$i in \ |
| 137 | *CVS) ;; \ |
| 138 | *.py[co]) ;; \ |
| 139 | *.orig) ;; \ |
| 140 | *~) ;; \ |
| 141 | *) \ |
| 142 | if test -d $$i; then continue; fi; \ |
| 143 | if test -x $$i; then \ |
| 144 | echo $(INSTALL_SCRIPT) $$i $$b; \ |
| 145 | $(INSTALL_SCRIPT) $$i $$b; \ |
| 146 | else \ |
| 147 | echo $(INSTALL_DATA) $$i $$b; \ |
| 148 | $(INSTALL_DATA) $$i $$b; \ |
| 149 | fi;; \ |
| 150 | esac; \ |
| 151 | done; \ |
| 152 | done |
Jack Jansen | c71efe0 | 2002-01-21 22:51:55 +0000 | [diff] [blame] | 153 | @for d in $(TOOLSSUBDIRS); \ |
| 154 | do \ |
| 155 | a=$(TOOLSSRC)/$$d; \ |
| 156 | if test ! -d $$a; then continue; else true; fi; \ |
| 157 | b=$(TOOLSDEST)/$$d; \ |
| 158 | if test ! -d $$b; then \ |
| 159 | echo "Creating directory $$b"; \ |
| 160 | $(INSTALL) -d -m $(DIRMODE) $$b; \ |
| 161 | else true; \ |
| 162 | fi; \ |
| 163 | done |
| 164 | @for d in $(TOOLSSUBDIRS); \ |
| 165 | do \ |
| 166 | a=$(TOOLSSRC)/$$d; \ |
| 167 | if test ! -d $$a; then continue; else true; fi; \ |
| 168 | b=$(TOOLSDEST)/$$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 |
| 188 | |
Jack Jansen | 109f094 | 2002-01-18 16:12:27 +0000 | [diff] [blame] | 189 | @echo '** Copy the contents of sample_sitecustomize.py (or similar code) into' |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 190 | @echo '**' $(INSTALLDIR)/lib/python2.3/sitecustomize.py |
Jack Jansen | 109f094 | 2002-01-18 16:12:27 +0000 | [diff] [blame] | 191 | |
Jack Jansen | 0cd0e65 | 2002-03-29 14:18:18 +0000 | [diff] [blame] | 192 | # Put symlinks "python" and "pythonw" in the standard place |
| 193 | installunixprograms: $(INSTALLED_PYTHON) pythonw.sh |
| 194 | $(INSTALL) -d $(UNIXBINDIR) |
| 195 | $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python |
| 196 | $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw |
| 197 | |
| 198 | # This is for development purposes: put a symlink to the Mac source subtree in the |
| 199 | # framework |
| 200 | symlinkmacsubtree: |
| 201 | ln -sf `cd $(PYTHONBUILDDIR)/Mac; pwd` $(INSTALLDIR)/Mac |
| 202 | |
| 203 | @echo '** Copy the contents of sample_sitecustomize.py (or similar code) into' |
| 204 | @echo '**' $(INSTALLDIR)/lib/python2.3/sitecustomize.py |