blob: daf9dfe6da758fde05179b7048ff34f03bc58cef [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 +000040OBJECTS=$(builddir)/Mac/Python/macmain.o \
41 $(builddir)/Mac/Python/macgetargv.o
Jack Jansen75ed1672001-09-05 22:09:50 +000042
Jack Jansenbe3e1f72002-08-01 21:14:06 +000043PYTHON=$(builddir)/python.exe
44APPTEMPLATE=$(srcdir)/Mac/OSXResources/app
Jack Jansen638e5e32001-09-06 16:33:57 +000045APPSUBDIRS=MacOS Resources Resources/English.lproj
Jack Jansenbe3e1f72002-08-01 21:14:06 +000046RESOURCEDIR=$(srcdir)/Mac/Resources
Jack Jansenc432cba2001-09-09 00:36:52 +000047RESOURCEFILE=python.rsrc
Jack Jansenbe3e1f72002-08-01 21:14:06 +000048RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py
Jack Jansencce7e342002-07-31 14:46:04 +000049
50install_all: install_PythonLauncher install_Python install_IDE
51
52install_PythonLauncher:
Jack Jansenbe3e1f72002-08-01 21:14:06 +000053 cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \
Jack Jansencce7e342002-07-31 14:46:04 +000054 pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=/ install
55
56install_Python: pythonforbundle
57 @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \
Jack Jansen638e5e32001-09-06 16:33:57 +000058 if test ! -d $$i; then \
59 echo "Creating directory $$i"; \
60 $(INSTALL) -d -m $(DIRMODE) $$i; \
61 fi;\
62 done
63 @for i in $(APPSUBDIRS); do \
64 if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \
65 echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \
66 $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \
67 else true; \
68 fi; \
69 done
70 @for d in . $(APPSUBDIRS); \
71 do \
72 a=$(APPTEMPLATE)/$$d; \
73 if test ! -d $$a; then continue; else true; fi; \
74 b=$(APPINSTALLDIR)/Contents/$$d; \
75 for i in $$a/*; \
76 do \
Jack Jansen638e5e32001-09-06 16:33:57 +000077 case $$i in \
78 *CVS) ;; \
79 *.py[co]) ;; \
80 *.orig) ;; \
81 *~) ;; \
82 *) \
83 if test -d $$i; then continue; fi; \
84 if test -x $$i; then \
85 echo $(INSTALL_SCRIPT) $$i $$b; \
86 $(INSTALL_SCRIPT) $$i $$b; \
87 else \
88 echo $(INSTALL_DATA) $$i $$b; \
89 $(INSTALL_DATA) $$i $$b; \
90 fi;; \
91 esac; \
92 done; \
93 done
Jack Jansen0cd0e652002-03-29 14:18:18 +000094 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonforbundle $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansenc432cba2001-09-09 00:36:52 +000095 # Create a temporary version of the resources here
Jack Jansenfdc8d752002-01-15 23:20:40 +000096 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc
97 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc
Jack Jansenfea15532002-01-27 20:05:20 +000098 $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r
99 $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r
100 $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r
Jack Jansenc432cba2001-09-09 00:36:52 +0000101 $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE)
Jack Jansencce7e342002-07-31 14:46:04 +0000102
103install_IDE: $(INSTALLED_PYTHONW)
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000104 $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \
Jack Jansencce7e342002-07-31 14:46:04 +0000105 --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000106 $(srcdir)/Mac/Tools/IDE/PythonIDE.py
Jack Jansen638e5e32001-09-06 16:33:57 +0000107
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000108LIBDEST=$(prefix)/Mac/Lib
109LIBSRC=$(srcdir)/Mac/Lib
Jack Jansendc745682002-05-23 22:18:13 +0000110LIBSUBDIRS= \
111 Carbon \
112 lib-scriptpackages \
113 lib-scriptpackages/_builtinSuites \
114 lib-scriptpackages/CodeWarrior \
115 lib-scriptpackages/Explorer \
116 lib-scriptpackages/Finder \
117 lib-scriptpackages/Netscape \
118 lib-scriptpackages/StdSuites \
119 lib-scriptpackages/Terminal \
120 mkcwproject \
121 mkcwproject/template \
122 mkcwproject/template-carbon \
123 mkcwproject/template-ppc
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000124TOOLSDEST=$(prefix)/Mac/Tools
125TOOLSSRC=$(srcdir)/Mac/Tools
Jack Jansenc71efe02002-01-21 22:51:55 +0000126TOOLSSUBDIRS=IDE
Jack Jansen638e5e32001-09-06 16:33:57 +0000127installmacsubtree:
Jack Jansenc71efe02002-01-21 22:51:55 +0000128 @for i in $(LIBDEST) $(TOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000129 do \
130 if test ! -d $$i; then \
131 echo "Creating directory $$i"; \
132 $(INSTALL) -d -m $(DIRMODE) $$i; \
133 else true; \
134 fi; \
135 done
136 @for d in $(LIBSUBDIRS); \
137 do \
138 a=$(LIBSRC)/$$d; \
139 if test ! -d $$a; then continue; else true; fi; \
140 b=$(LIBDEST)/$$d; \
141 if test ! -d $$b; then \
142 echo "Creating directory $$b"; \
143 $(INSTALL) -d -m $(DIRMODE) $$b; \
144 else true; \
145 fi; \
146 done
147 @for i in $(LIBSRC)/*.py $(LIBSRC)/*.rsrc; \
148 do \
149 if test -x $$i; then \
150 $(INSTALL_SCRIPT) $$i $(LIBDEST); \
151 echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
152 else \
153 $(INSTALL_DATA) $$i $(LIBDEST); \
154 echo $(INSTALL_DATA) $$i $(LIBDEST); \
155 fi; \
156 done
157 @for d in $(LIBSUBDIRS); \
158 do \
159 a=$(LIBSRC)/$$d; \
160 if test ! -d $$a; then continue; else true; fi; \
161 b=$(LIBDEST)/$$d; \
162 for i in $$a/*; \
163 do \
164 case $$i in \
165 *CVS) ;; \
166 *.py[co]) ;; \
167 *.orig) ;; \
168 *~) ;; \
169 *) \
170 if test -d $$i; then continue; fi; \
171 if test -x $$i; then \
172 echo $(INSTALL_SCRIPT) $$i $$b; \
173 $(INSTALL_SCRIPT) $$i $$b; \
174 else \
175 echo $(INSTALL_DATA) $$i $$b; \
176 $(INSTALL_DATA) $$i $$b; \
177 fi;; \
178 esac; \
179 done; \
180 done
Jack Jansenc71efe02002-01-21 22:51:55 +0000181 @for d in $(TOOLSSUBDIRS); \
182 do \
183 a=$(TOOLSSRC)/$$d; \
184 if test ! -d $$a; then continue; else true; fi; \
185 b=$(TOOLSDEST)/$$d; \
186 if test ! -d $$b; then \
187 echo "Creating directory $$b"; \
188 $(INSTALL) -d -m $(DIRMODE) $$b; \
189 else true; \
190 fi; \
191 done
192 @for d in $(TOOLSSUBDIRS); \
193 do \
194 a=$(TOOLSSRC)/$$d; \
195 if test ! -d $$a; then continue; else true; fi; \
196 b=$(TOOLSDEST)/$$d; \
197 for i in $$a/*; \
198 do \
199 case $$i in \
200 *CVS) ;; \
201 *.py[co]) ;; \
202 *.orig) ;; \
203 *~) ;; \
204 *) \
205 if test -d $$i; then continue; fi; \
206 if test -x $$i; then \
207 echo $(INSTALL_SCRIPT) $$i $$b; \
208 $(INSTALL_SCRIPT) $$i $$b; \
209 else \
210 echo $(INSTALL_DATA) $$i $$b; \
211 $(INSTALL_DATA) $$i $$b; \
212 fi;; \
213 esac; \
214 done; \
215 done
216
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000217 $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(prefix)/lib/python$(VERSION)/site-packages/
Jack Jansen109f0942002-01-18 16:12:27 +0000218
Jack Jansen0cd0e652002-03-29 14:18:18 +0000219# Put symlinks "python" and "pythonw" in the standard place
Jack Jansencce7e342002-07-31 14:46:04 +0000220$(INSTALLED_PYTHONW): install_Python
221# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
222
223installunixprograms: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) pythonw.sh
Jack Jansen0cd0e652002-03-29 14:18:18 +0000224 $(INSTALL) -d $(UNIXBINDIR)
225 $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(UNIXBINDIR)/python
226 $(INSTALL) pythonw.sh $(UNIXBINDIR)/pythonw
227
Jack Jansenc361f942002-07-08 13:34:23 +0000228# This is for development purposes: create a Mac.pth that refers to the source
229# directories
230dontinstallmacsubtree:
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000231 l=`cd $(srcdir)/Mac/Lib; pwd`; \
232 echo $$l > $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth ; \
233 echo $$l/lib-scriptpackages >> $(prefix)/lib/python$(VERSION)/site-packages/Mac.pth
Jack Jansen0b06be72002-06-21 14:48:38 +0000234
Jack Jansencce7e342002-07-31 14:46:04 +0000235pythonforbundle: $(OBJECTS)
236 $(LD) $(LDFLAGS) $(OBJECTS) -o pythonforbundle
Jack Jansen0b06be72002-06-21 14:48:38 +0000237
238# Rules to build each file in OBJECTS - is there a better way?
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000239$(builddir)/Mac/Python/macmain.o: $(srcdir)/Mac/Python/macmain.c
240 $(CC) $(CFLAGS) -c $(srcdir)/Mac/Python/macmain.c -o $@
Jack Jansen0b06be72002-06-21 14:48:38 +0000241
Jack Jansenbe3e1f72002-08-01 21:14:06 +0000242$(builddir)/Mac/Python/macgetargv.o: $(srcdir)/Mac/Python/macgetargv.c
243 $(CC) $(CFLAGS) -c $(srcdir)/Mac/Python/macgetargv.c -o $@
Jack Jansen0b06be72002-06-21 14:48:38 +0000244