blob: 83587eac7ba73c81c5674f5c04f43b425832e328 [file] [log] [blame]
Jack Jansen0b06be72002-06-21 14:48:38 +00001# 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 Jansenbe3e1f72002-08-01 21:14:06 +00006builddir = ../..
7srcdir = ../..
8VERSION=2.3
Jack Jansen0b06be72002-06-21 14:48:38 +00009
Jack Jansenbe3e1f72002-08-01 21:14:06 +000010prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
Jack Jansencce7e342002-07-31 14:46:04 +000011PYTHONAPPSDIR=/Applications/Python
Jack Jansenbe3e1f72002-08-01 21:14:06 +000012APPINSTALLDIR=$(prefix)/Resources/Python.app
Jack Jansen75ed1672001-09-05 22:09:50 +000013
Jack Jansen0cd0e652002-03-29 14:18:18 +000014# Variables for installing the "normal" unix binaries
15UNIXBINDIR=/usr/local/bin
Jack Jansenbe3e1f72002-08-01 21:14:06 +000016INSTALLED_PYTHON=$(prefix)/bin/python
Jack Jansen0cd0e652002-03-29 14:18:18 +000017INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python
18
Jack Jansen638e5e32001-09-06 16:33:57 +000019# Items more-or-less copied from the main Makefile
20DIRMODE=755
21INSTALL=/usr/bin/install -c
Jack Jansen0cd0e652002-03-29 14:18:18 +000022INSTALL_SYMLINK=/usr/bin/install -l as
Jack Jansen638e5e32001-09-06 16:33:57 +000023INSTALL_PROGRAM=${INSTALL}
24INSTALL_SCRIPT= ${INSTALL_PROGRAM}
25INSTALL_DATA= ${INSTALL} -m 644
Jack Jansen0cd0e652002-03-29 14:18:18 +000026STRIPFLAG=-s
Jack Jansen2cce33f2002-03-29 21:17:14 +000027OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \
28 -fno-common -dynamic
Jack Jansenbe3e1f72002-08-01 21:14:06 +000029INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include
Jack Jansen75ed1672001-09-05 22:09:50 +000030DEFINES=-DHAVE_CONFIG_H
31
32CFLAGS=$(OPT) $(DEFINES) $(INCLUDES)
Jack Jansenbe3e1f72002-08-01 21:14:06 +000033LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \
Jack Jansen75ed1672001-09-05 22:09:50 +000034 -framework Foundation
35CC=cc
36LD=cc
Jack Jansenfea15532002-01-27 20:05:20 +000037REZ=/Developer/Tools/Rez
38DEREZ=/Developer/Tools/DeRez
Jack Jansen75ed1672001-09-05 22:09:50 +000039
Jack Jansenbe3e1f72002-08-01 21:14:06 +000040PYTHON=$(builddir)/python.exe
41APPTEMPLATE=$(srcdir)/Mac/OSXResources/app
Jack Jansen638e5e32001-09-06 16:33:57 +000042APPSUBDIRS=MacOS Resources Resources/English.lproj
Jack Jansenbe3e1f72002-08-01 21:14:06 +000043RESOURCEDIR=$(srcdir)/Mac/Resources
Jack Jansenc432cba2001-09-09 00:36:52 +000044RESOURCEFILE=python.rsrc
Jack Jansenbe3e1f72002-08-01 21:14:06 +000045RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py
Jack Jansencce7e342002-07-31 14:46:04 +000046
Jack Jansen940dc922002-08-02 21:46:40 +000047install_all: install_PythonLauncher install_Python install_BuildApplet install_IDE
Jack Jansencce7e342002-07-31 14:46:04 +000048
49install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000050 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansencce7e342002-07-31 14:46:04 +000051 pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install
52
Jack Jansen21ed16a2002-08-02 14:11:24 +000053install_Python: $(PYTHON)
Jack Jansencce7e342002-07-31 14:46:04 +000054 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000055 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 Jansen638e5e32001-09-06 16:33:57 +000074 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 Jansen21ed16a2002-08-02 14:11:24 +000091 $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansenc432cba2001-09-09 00:36:52 +000092 # Create a temporary version of the resources here
Jack Jansenfdc8d752002-01-15 23:20:40 +000093 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc
94 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc
Jack Jansenfea15532002-01-27 20:05:20 +000095 $(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 Jansenc432cba2001-09-09 00:36:52 +000098 $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE)
Jack Jansencce7e342002-07-31 14:46:04 +000099
100install_IDE: $(INSTALLED_PYTHONW)
Jack Jansenf80798b2002-08-02 21:04:46 +0000101 @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 Jansenbe3e1f72002-08-01 21:14:06 +0000106 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
Jack Jansencce7e342002-07-31 14:46:04 +0000107 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000108 $(srcdir)/Mac/Tools/IDE/PythonIDE.py
Jack Jansen638e5e32001-09-06 16:33:57 +0000109
Jack Jansen940e9702002-08-02 15:32:12 +0000110install_BuildApplet: $(INSTALLED_PYTHONW)
111 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
112 --output $(PYTHONAPPSDIR)/BuildApplet.app \
113 $(srcdir)/Mac/scripts/BuildApplet.py
114
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000115LIBDEST=$(prefix)/Mac/Lib
116LIBSRC=$(srcdir)/Mac/Lib
Jack Jansendc745682002-05-23 22:18:13 +0000117LIBSUBDIRS= \
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 Jansenbe3e1f72002-08-01 21:14:06 +0000131TOOLSDEST=$(prefix)/Mac/Tools
132TOOLSSRC=$(srcdir)/Mac/Tools
Jack Jansenc71efe02002-01-21 22:51:55 +0000133TOOLSSUBDIRS=IDE
Jack Jansen638e5e32001-09-06 16:33:57 +0000134installmacsubtree:
Jack Jansenc71efe02002-01-21 22:51:55 +0000135 @for i in $(LIBDEST) $(TOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000136 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 Jansenc71efe02002-01-21 22:51:55 +0000188 @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 Jansenbe3e1f72002-08-01 21:14:06 +0000224 $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(prefix)/lib/python$(VERSION)/site-packages/
Jack Jansen109f0942002-01-18 16:12:27 +0000225
Jack Jansen0cd0e652002-03-29 14:18:18 +0000226# Put symlinks "python" and "pythonw" in the standard place
Jack Jansencce7e342002-07-31 14:46:04 +0000227$(INSTALLED_PYTHONW): install_Python
228# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
229
230installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh
Jack Jansen0cd0e652002-03-29 14:18:18 +0000231 $(INSTALL) -d $(UNIXBINDIR)
232 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python
233 $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw
234
Jack Jansenc361f942002-07-08 13:34:23 +0000235# This is for development purposes: create a Mac.pth that refers to the source
236# directories
237dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000238 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