blob: 7b4922e8aba47c608ce56fcc307872bc1f3ad5a0 [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 Jansen940e9702002-08-02 15:32:12 +000047install_all: install_PythonLauncher install_Python install_IDE install_BuildApplet
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 Jansenbe3e1f72002-08-01 21:14:06 +0000101 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
Jack Jansencce7e342002-07-31 14:46:04 +0000102 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000103 $(srcdir)/Mac/Tools/IDE/PythonIDE.py
Jack Jansen638e5e32001-09-06 16:33:57 +0000104
Jack Jansen940e9702002-08-02 15:32:12 +0000105install_BuildApplet: $(INSTALLED_PYTHONW)
106 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
107 --output $(PYTHONAPPSDIR)/BuildApplet.app \
108 $(srcdir)/Mac/scripts/BuildApplet.py
109
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000110LIBDEST=$(prefix)/Mac/Lib
111LIBSRC=$(srcdir)/Mac/Lib
Jack Jansendc745682002-05-23 22:18:13 +0000112LIBSUBDIRS= \
113 Carbon \
114 lib-scriptpackages \
115 lib-scriptpackages/_builtinSuites \
116 lib-scriptpackages/CodeWarrior \
117 lib-scriptpackages/Explorer \
118 lib-scriptpackages/Finder \
119 lib-scriptpackages/Netscape \
120 lib-scriptpackages/StdSuites \
121 lib-scriptpackages/Terminal \
122 mkcwproject \
123 mkcwproject/template \
124 mkcwproject/template-carbon \
125 mkcwproject/template-ppc
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000126TOOLSDEST=$(prefix)/Mac/Tools
127TOOLSSRC=$(srcdir)/Mac/Tools
Jack Jansenc71efe02002-01-21 22:51:55 +0000128TOOLSSUBDIRS=IDE
Jack Jansen638e5e32001-09-06 16:33:57 +0000129installmacsubtree:
Jack Jansenc71efe02002-01-21 22:51:55 +0000130 @for i in $(LIBDEST) $(TOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000131 do \
132 if test ! -d $$i; then \
133 echo "Creating directory $$i"; \
134 $(INSTALL) -d -m $(DIRMODE) $$i; \
135 else true; \
136 fi; \
137 done
138 @for d in $(LIBSUBDIRS); \
139 do \
140 a=$(LIBSRC)/$$d; \
141 if test ! -d $$a; then continue; else true; fi; \
142 b=$(LIBDEST)/$$d; \
143 if test ! -d $$b; then \
144 echo "Creating directory $$b"; \
145 $(INSTALL) -d -m $(DIRMODE) $$b; \
146 else true; \
147 fi; \
148 done
149 @for i in $(LIBSRC)/*.py $(LIBSRC)/*.rsrc; \
150 do \
151 if test -x $$i; then \
152 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
153 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
154 else \
155 $(INSTALL_DATA) $$i $(LIBDEST); \
156 echo $(INSTALL_DATA) $$i $(LIBDEST); \
157 fi; \
158 done
159 @for d in $(LIBSUBDIRS); \
160 do \
161 a=$(LIBSRC)/$$d; \
162 if test ! -d $$a; then continue; else true; fi; \
163 b=$(LIBDEST)/$$d; \
164 for i in $$a/*; \
165 do \
166 case $$i in \
167 *CVS) ;; \
168 *.py[co]) ;; \
169 *.orig) ;; \
170 *~) ;; \
171 *) \
172 if test -d $$i; then continue; fi; \
173 if test -x $$i; then \
174 echo $(INSTALL_SCRIPT) $$i $$b; \
175 $(INSTALL_SCRIPT) $$i $$b; \
176 else \
177 echo $(INSTALL_DATA) $$i $$b; \
178 $(INSTALL_DATA) $$i $$b; \
179 fi;; \
180 esac; \
181 done; \
182 done
Jack Jansenc71efe02002-01-21 22:51:55 +0000183 @for d in $(TOOLSSUBDIRS); \
184 do \
185 a=$(TOOLSSRC)/$$d; \
186 if test ! -d $$a; then continue; else true; fi; \
187 b=$(TOOLSDEST)/$$d; \
188 if test ! -d $$b; then \
189 echo "Creating directory $$b"; \
190 $(INSTALL) -d -m $(DIRMODE) $$b; \
191 else true; \
192 fi; \
193 done
194 @for d in $(TOOLSSUBDIRS); \
195 do \
196 a=$(TOOLSSRC)/$$d; \
197 if test ! -d $$a; then continue; else true; fi; \
198 b=$(TOOLSDEST)/$$d; \
199 for i in $$a/*; \
200 do \
201 case $$i in \
202 *CVS) ;; \
203 *.py[co]) ;; \
204 *.orig) ;; \
205 *~) ;; \
206 *) \
207 if test -d $$i; then continue; fi; \
208 if test -x $$i; then \
209 echo $(INSTALL_SCRIPT) $$i $$b; \
210 $(INSTALL_SCRIPT) $$i $$b; \
211 else \
212 echo $(INSTALL_DATA) $$i $$b; \
213 $(INSTALL_DATA) $$i $$b; \
214 fi;; \
215 esac; \
216 done; \
217 done
218
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000219 $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(prefix)/lib/python$(VERSION)/site-packages/
Jack Jansen109f0942002-01-18 16:12:27 +0000220
Jack Jansen0cd0e652002-03-29 14:18:18 +0000221# Put symlinks "python" and "pythonw" in the standard place
Jack Jansencce7e342002-07-31 14:46:04 +0000222$(INSTALLED_PYTHONW): install_Python
223# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
224
225installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh
Jack Jansen0cd0e652002-03-29 14:18:18 +0000226 $(INSTALL) -d $(UNIXBINDIR)
227 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python
228 $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw
229
Jack Jansenc361f942002-07-08 13:34:23 +0000230# This is for development purposes: create a Mac.pth that refers to the source
231# directories
232dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000233 l=`cd $(srcdir)/Mac/Lib; pwd`; \
234 echo $$l > $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth ; \
235 echo $$l/lib-scriptpackages >> $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth