Fix and improve some assertions in test_site
[python.git] / Mac / Makefile.in
blobb9fd377c79f55b394d4f9a500099ca2a94efad85
1 # This file can be invoked from the various frameworkinstall... targets in the
2 # main Makefile. The next couple of variables are overridden on the
3 # commandline in that case.
5 VERSION=@VERSION@
6 builddir = ..
7 srcdir=@srcdir@
8 prefix=@prefix@
9 LIBDEST=$(prefix)/lib/python$(VERSION)
10 RUNSHARED=@RUNSHARED@
11 BUILDEXE=@BUILDEXEEXT@
12 BUILDPYTHON=$(builddir)/python$(BUILDEXE)
13 DESTDIR=
14 LDFLAGS=@LDFLAGS@
15 FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
16 PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
17 PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
20 # These are normally glimpsed from the previous set
21 bindir=$(prefix)/bin
22 PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
23 APPINSTALLDIR=$(prefix)/Resources/Python.app
25 # Variables for installing the "normal" unix binaries
26 INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
28 # Items more-or-less copied from the main Makefile
29 DIRMODE=755
30 FILEMODE=644
31 INSTALL=@INSTALL@
32 INSTALL_SYMLINK=ln -fsn
33 INSTALL_PROGRAM=@INSTALL_PROGRAM@
34 INSTALL_SCRIPT= @INSTALL_SCRIPT@
35 INSTALL_DATA=@INSTALL_DATA@
36 LN=@LN@
37 STRIPFLAG=-s
38 CPMAC=/Developer/Tools/CpMac
40 APPTEMPLATE=$(srcdir)/Resources/app
41 APPSUBDIRS=MacOS Resources
42 CACHERSRC=$(srcdir)/scripts/cachersrc.py
43 compileall=$(srcdir)/../Lib/compileall.py
45 installapps: install_Python install_BuildApplet install_PythonLauncher \
46 install_IDLE checkapplepython install_pythonw install_versionedtools
48 installapps4way: install_Python4way install_BuildApplet install_PythonLauncher install_IDLE install_pythonw4way install_versionedtools
51 install_pythonw: pythonw
52 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
53 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
54 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
55 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
58 # Install 3 variants of python/pythonw:
59 # - 32-bit (i386 and ppc)
60 # - 64-bit (x86_64 and ppc64)
61 # - all (all four architectures)
62 # - Make 'python' and 'pythonw' aliases for the 32-bit variant
63 install_pythonw4way: pythonw-32 pythonw-64 pythonw
64 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64"
65 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64"
66 ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python-64"
67 ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw-64"
69 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32"
70 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32"
71 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32"
72 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
74 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all"
75 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all"
76 ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python-all"
77 ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw-all"
79 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
80 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
81 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw"
82 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python"
85 # Install unix tools in /usr/local/bin. These are just aliases for the
86 # actual installation inside the framework.
88 installunixtools:
89 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
90 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
92 for fn in python pythonw idle pydoc python-config smtpd.py \
93 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
94 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
95 do \
96 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
97 done
100 # TODO: install symlinks for -32, -64 and -all as well
101 installunixtools4way: installunixtools
105 # Like installunixtools, but only install links to the versioned binaries.
107 altinstallunixtools:
108 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
109 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
111 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
112 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
113 do \
114 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
115 done
117 # TODO: -32, -64 and -all variants
118 altinstallunixtools4way: altinstallunixtools
120 # By default most tools are installed without a version in their basename, to
121 # make it easier to install (and use) several python versions side-by-side move
122 # the tools to a version-specific name and add the non-versioned name as an
123 # alias.
124 install_versionedtools:
125 for fn in idle pydoc ;\
126 do \
127 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
128 continue ;\
129 fi ;\
130 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
131 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
132 done
133 if [ ! -h "$(DESTDIR)$(prefix)/bin/python-config" ]; then \
134 mv "$(DESTDIR)$(prefix)/bin/python-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\
135 ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python-config" ; \
137 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
138 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
139 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
143 pythonw: $(srcdir)/Tools/pythonw.c Makefile
144 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
145 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
147 pythonw-32: $(srcdir)/Tools/pythonw.c Makefile
148 $(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \
149 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"'
151 pythonw-64: $(srcdir)/Tools/pythonw.c Makefile
152 $(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \
153 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"'
155 install_PythonLauncher:
156 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
158 install_Python:
159 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
160 if test ! -d "$(DESTDIR)$$i"; then \
161 echo "Creating directory $(DESTDIR)$$i"; \
162 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
163 fi;\
164 done
165 @for i in $(APPSUBDIRS); do \
166 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
167 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
168 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
169 else true; \
170 fi; \
171 done
172 @for d in . $(APPSUBDIRS); \
173 do \
174 a=$(APPTEMPLATE)/$$d; \
175 if test ! -d $$a; then continue; else true; fi; \
176 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
177 for i in $$a/*; \
178 do \
179 case $$i in \
180 *CVS) ;; \
181 *.svn) ;; \
182 *.py[co]) ;; \
183 *.orig) ;; \
184 *~) ;; \
185 *idx) \
186 echo $(CPMAC) "$$i" $$b; \
187 $(CPMAC) "$$i" "$$b"; \
188 ;; \
189 *) \
190 if test -d $$i; then continue; fi; \
191 if test -x $$i; then \
192 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
193 $(INSTALL_SCRIPT) "$$i" "$$b"; \
194 else \
195 echo $(INSTALL_DATA) "$$i" "$$b"; \
196 $(INSTALL_DATA) "$$i" "$$b"; \
197 fi;; \
198 esac; \
199 done; \
200 done
201 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
202 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
203 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
204 -c 'import platform; print(platform.python_version())'`!g" \
205 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
206 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
207 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
209 install_Python4way: install_Python
210 lipo -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
211 lipo -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
215 install_IDLE:
216 cd IDLE && make install
218 install_BuildApplet:
219 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
220 --destroot "$(DESTDIR)" \
221 --python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \
222 --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
223 $(srcdir)/scripts/BuildApplet.py
225 MACLIBDEST=$(LIBDEST)/plat-mac
226 MACTOOLSDEST=$(prefix)/Mac/Tools
227 MACTOOLSSRC=$(srcdir)/Mac/Tools
228 MACTOOLSSUBDIRS=IDE
230 installmacsubtree:
231 @for i in $(MACTOOLSDEST); \
232 do \
233 if test ! -d $(DESTDIR)$$i; then \
234 echo "Creating directory $(DESTDIR)$$i"; \
235 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
236 else true; \
237 fi; \
238 done
239 @for d in $(MACTOOLSSUBDIRS); \
240 do \
241 a=$(MACTOOLSSRC)/$$d; \
242 if test ! -d $$a; then continue; else true; fi; \
243 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
244 if test ! -d $$b; then \
245 echo "Creating directory $$b"; \
246 $(INSTALL) -d -m $(DIRMODE) $$b; \
247 else true; \
248 fi; \
249 done
250 @for d in $(MACTOOLSSUBDIRS); \
251 do \
252 a=$(MACTOOLSSRC)/$$d; \
253 if test ! -d $$a; then continue; else true; fi; \
254 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
255 for i in $$a/*; \
256 do \
257 case $$i in \
258 *CVS) ;; \
259 *.svn) ;; \
260 *.py[co]) ;; \
261 *.orig) ;; \
262 *~) ;; \
263 *.rsrc) \
264 echo $(CPMAC) $$i $$b ; \
265 $(CPMAC) $$i $$b ; \
266 ;; \
267 *) \
268 if test -d $$i; then continue; fi; \
269 if test -x $$i; then \
270 echo $(INSTALL_SCRIPT) $$i $$b; \
271 $(INSTALL_SCRIPT) $$i $$b; \
272 else \
273 echo $(INSTALL_DATA) $$i $$b; \
274 $(INSTALL_DATA) $$i $$b; \
275 fi;; \
276 esac; \
277 done; \
278 done
281 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
282 $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
283 $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
285 $(INSTALLED_PYTHONAPP): install_Python
287 installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
288 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
289 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
290 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
291 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
292 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
293 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
296 checkapplepython: $(srcdir)/Tools/fixapplepython23.py
297 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
298 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
299 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
303 clean:
304 rm pythonw
305 cd PythonLauncher && make clean
306 cd IDLE && make clean
308 Makefile: $(srcdir)/Makefile.in ../config.status
309 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status