blob: ed4bab19b82625e7cf57cfa39cbc9b8e3a2ad832 [file] [log] [blame]
Jack Jansen75ed1672001-09-05 22:09:50 +00001PYTHONBUILDDIR=../..
Jack Jansen638e5e32001-09-06 16:33:57 +00002INSTALLDIR=/Library/Frameworks/Python.framework/Versions/Current
3APPINSTALLDIR=/Applications/Python.app
Jack Jansen75ed1672001-09-05 22:09:50 +00004
Jack Jansen0cd0e652002-03-29 14:18:18 +00005# Variables for installing the "normal" unix binaries
6UNIXBINDIR=/usr/local/bin
7INSTALLED_PYTHON=$(INSTALLDIR)/bin/python
8INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python
9
Jack Jansen638e5e32001-09-06 16:33:57 +000010# Items more-or-less copied from the main Makefile
11DIRMODE=755
12INSTALL=/usr/bin/install -c
Jack Jansen0cd0e652002-03-29 14:18:18 +000013INSTALL_SYMLINK=/usr/bin/install -l as
Jack Jansen638e5e32001-09-06 16:33:57 +000014INSTALL_PROGRAM=${INSTALL}
15INSTALL_SCRIPT= ${INSTALL_PROGRAM}
16INSTALL_DATA= ${INSTALL} -m 644
Jack Jansen0cd0e652002-03-29 14:18:18 +000017STRIPFLAG=-s
Jack Jansen2cce33f2002-03-29 21:17:14 +000018OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \
19 -fno-common -dynamic
Jack Jansen75ed1672001-09-05 22:09:50 +000020INCLUDES=-I$(PYTHONBUILDDIR) -I$(PYTHONBUILDDIR)/Include \
21 -I$(PYTHONBUILDDIR)/Mac/Include
22DEFINES=-DHAVE_CONFIG_H
23
24CFLAGS=$(OPT) $(DEFINES) $(INCLUDES)
25LDFLAGS=-framework System -framework Python -framework Carbon \
26 -framework Foundation
27CC=cc
28LD=cc
Jack Jansenfea15532002-01-27 20:05:20 +000029REZ=/Developer/Tools/Rez
30DEREZ=/Developer/Tools/DeRez
Jack Jansen75ed1672001-09-05 22:09:50 +000031
32OBJECTS=$(PYTHONBUILDDIR)/Mac/Python/macmain.o \
33 $(PYTHONBUILDDIR)/Mac/Python/macgetargv.o
34
35pythonforbundle: $(OBJECTS)
Jack Jansen638e5e32001-09-06 16:33:57 +000036 $(LD) $(LDFLAGS) $(OBJECTS) -o pythonforbundle
37
Jack Jansenc432cba2001-09-09 00:36:52 +000038PYTHON=$(PYTHONBUILDDIR)/python.exe
Jack Jansen638e5e32001-09-06 16:33:57 +000039APPTEMPLATE=$(PYTHONBUILDDIR)/Mac/OSXResources/app
40APPSUBDIRS=MacOS Resources Resources/English.lproj
Jack Jansenfdc8d752002-01-15 23:20:40 +000041RESOURCEDIR=$(PYTHONBUILDDIR)/Mac/Resources
Jack Jansenc432cba2001-09-09 00:36:52 +000042RESOURCEFILE=python.rsrc
43RFCONVERTER=$(PYTHONBUILDDIR)/Mac/Lib/applesingle.py
Jack Jansen638e5e32001-09-06 16:33:57 +000044install: 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 Jansen638e5e32001-09-06 16:33:57 +000065 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 Jansen0cd0e652002-03-29 14:18:18 +000082 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonforbundle $(APPINSTALLDIR)/Contents/MacOS/python
Jack Jansenc432cba2001-09-09 00:36:52 +000083 # Create a temporary version of the resources here
Jack Jansenfdc8d752002-01-15 23:20:40 +000084 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc
85 $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc
Jack Jansenfea15532002-01-27 20:05:20 +000086 $(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 Jansenc432cba2001-09-09 00:36:52 +000089 $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE)
Jack Jansen638e5e32001-09-06 16:33:57 +000090
91LIBDEST=$(INSTALLDIR)/Mac/Lib
92LIBSRC=$(PYTHONBUILDDIR)/Mac/Lib
93LIBSUBDIRS=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 Jansenc71efe02002-01-21 22:51:55 +000096TOOLSDEST=$(INSTALLDIR)/Mac/Tools
97TOOLSSRC=$(PYTHONBUILDDIR)/Mac/Tools
98TOOLSSUBDIRS=IDE
Jack Jansen638e5e32001-09-06 16:33:57 +000099installmacsubtree:
Jack Jansenc71efe02002-01-21 22:51:55 +0000100 @for i in $(LIBDEST) $(TOOLSDEST); \
Jack Jansen638e5e32001-09-06 16:33:57 +0000101 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 Jansenc71efe02002-01-21 22:51:55 +0000153 @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 Jansen109f0942002-01-18 16:12:27 +0000189 @echo '** Copy the contents of sample_sitecustomize.py (or similar code) into'
Jack Jansen0cd0e652002-03-29 14:18:18 +0000190 @echo '**' $(INSTALLDIR)/lib/python2.3/sitecustomize.py
Jack Jansen109f0942002-01-18 16:12:27 +0000191
Jack Jansen0cd0e652002-03-29 14:18:18 +0000192# Put symlinks "python" and "pythonw" in the standard place
193installunixprograms: $(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
200symlinkmacsubtree:
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