blob: f505bc5f50bf7b1832b5de6550816f379687d625 [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
47install_all: install_PythonLauncher install_Python install_IDE
48
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 Jansenbe3e1f72002-08-01 21:14:06 +0000105LIBDEST=$(prefix)/Mac/Lib
106LIBSRC=$(srcdir)/Mac/Lib
Jack Jansendc745682002-05-23 22:18:13 +0000107LIBSUBDIRS= \
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 Jansenbe3e1f72002-08-01 21:14:06 +0000121TOOLSDEST=$(prefix)/Mac/Tools
122TOOLSSRC=$(srcdir)/Mac/Tools
Jack Jansenc71efe02002-01-21 22:51:55 +0000123TOOLSSUBDIRS=IDE
Jack Jansen638e5e32001-09-06 16:33:57 +0000124installmacsubtree:
Jack Jansenc71efe02002-01-21 22:51:55 +0000125 @for i in $(LIBDEST) $(TOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000126 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 Jansenc71efe02002-01-21 22:51:55 +0000178 @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 Jansenbe3e1f72002-08-01 21:14:06 +0000214 $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(prefix)/lib/python$(VERSION)/site-packages/
Jack Jansen109f0942002-01-18 16:12:27 +0000215
Jack Jansen0cd0e652002-03-29 14:18:18 +0000216# Put symlinks "python" and "pythonw" in the standard place
Jack Jansencce7e342002-07-31 14:46:04 +0000217$(INSTALLED_PYTHONW): install_Python
218# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
219
220installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh
Jack Jansen0cd0e652002-03-29 14:18:18 +0000221 $(INSTALL) -d $(UNIXBINDIR)
222 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python
223 $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw
224
Jack Jansenc361f942002-07-08 13:34:23 +0000225# This is for development purposes: create a Mac.pth that refers to the source
226# directories
227dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000228 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