Merged revisions 80404 via svnmerge from
[python/dscho.git] / Mac / Makefile.in
blob18db6415a828d6e110f2ab69ff6ab0786fecd484
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@
18 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
19 export MACOSX_DEPLOYMENT_TARGET
23 # These are normally glimpsed from the previous set
24 bindir=$(prefix)/bin
25 PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
26 APPINSTALLDIR=$(prefix)/Resources/Python.app
28 # Variables for installing the "normal" unix binaries
29 INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
31 # Items more-or-less copied from the main Makefile
32 DIRMODE=755
33 FILEMODE=644
34 INSTALL=@INSTALL@
35 INSTALL_SYMLINK=ln -fsn
36 INSTALL_PROGRAM=@INSTALL_PROGRAM@
37 INSTALL_SCRIPT= @INSTALL_SCRIPT@
38 INSTALL_DATA=@INSTALL_DATA@
39 LN=@LN@
40 STRIPFLAG=-s
41 CPMAC=/Developer/Tools/CpMac
43 APPTEMPLATE=$(srcdir)/Resources/app
44 APPSUBDIRS=MacOS Resources
45 compileall=$(srcdir)/../Lib/compileall.py
47 installapps: install_Python install_PythonLauncher install_IDLE \
48 checkapplepython install_pythonw install_versionedtools
50 installapps4way: install_Python4way install_PythonLauncher \
51 install_IDLE4way install_pythonw4way install_versionedtools
54 install_pythonw: pythonw
55 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
56 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
57 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python3"
58 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw3"
61 # Install 3 variants of python/pythonw:
62 # - 32-bit (i386 and ppc)
63 # - 64-bit (x86_64 and ppc64)
64 # - all (all four architectures)
65 # - Make 'python' and 'pythonw' aliases for the 32-bit variant
66 install_pythonw4way: pythonw-32 pythonw-64 pythonw
67 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64"
68 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64"
69 ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python3-64"
70 ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw3-64"
72 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32"
73 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32"
74 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python3-32"
75 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw3-32"
77 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all"
78 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all"
79 ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python3-all"
80 ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw3-all"
82 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
83 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
84 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw3"
85 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python3"
88 # Install unix tools in /usr/local/bin. These are just aliases for the
89 # actual installation inside the framework.
91 installunixtools:
92 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
93 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
95 for fn in python3 pythonw3 idle3 pydoc3 python3-config \
96 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
97 pydoc$(VERSION) python$(VERSION)-config 2to3 \
98 2to3-$(VERSION) ;\
99 do \
100 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
101 done
104 # TODO: install symlinks for -32, -64 and -all as well
105 installunixtools4way: installunixtools
109 # Like installunixtools, but only install links to the versioned binaries.
111 altinstallunixtools:
112 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
113 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
115 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
116 pydoc$(VERSION) python$(VERSION)-config 2to3-$(VERSION);\
117 do \
118 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
119 done
121 # TODO: -32, -64 and -all variants
122 altinstallunixtools4way: altinstallunixtools
124 # By default most tools are installed without a version in their basename, to
125 # make it easier to install (and use) several python versions side-by-side move
126 # the tools to a version-specific name and add the non-versioned name as an
127 # alias.
128 install_versionedtools:
129 for fn in idle pydoc ;\
130 do \
131 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}3" ]; then \
132 continue ;\
133 fi ;\
134 mv "$(DESTDIR)$(prefix)/bin/$${fn}3" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
135 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}3" ;\
136 done
137 mv "$(DESTDIR)$(prefix)/bin/2to3" "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)"
138 ln -sf "2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3"
139 if [ ! -h "$(DESTDIR)$(prefix)/bin/python3-config" ]; then \
140 mv "$(DESTDIR)$(prefix)/bin/python3-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\
141 ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python3-config" ; \
145 pythonw: $(srcdir)/Tools/pythonw.c Makefile
146 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
147 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
149 pythonw-32: $(srcdir)/Tools/pythonw.c Makefile
150 $(CC) $(LDFLAGS) -o pythonw-tmp.o $(srcdir)/Tools/pythonw.c \
151 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"' ;\
152 lipo @LIPO_32BIT_FLAGS@ -output $@ pythonw-tmp.o ; rm pythonw-tmp.o
154 pythonw-64: $(srcdir)/Tools/pythonw.c Makefile
155 $(CC) $(LDFLAGS) -o pythonw-tmp.o $(srcdir)/Tools/pythonw.c \
156 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"' ;\
157 lipo @LIPO_64BIT_FLAGS@ -output $@ pythonw-tmp.o ; rm pythonw-tmp.o
159 install_PythonLauncher:
160 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
162 install_Python:
163 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
164 if test ! -d "$(DESTDIR)$$i"; then \
165 echo "Creating directory $(DESTDIR)$$i"; \
166 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
167 fi;\
168 done
169 @for i in $(APPSUBDIRS); do \
170 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
171 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
172 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
173 else true; \
174 fi; \
175 done
176 @for d in . $(APPSUBDIRS); \
177 do \
178 a=$(APPTEMPLATE)/$$d; \
179 if test ! -d $$a; then continue; else true; fi; \
180 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
181 for i in $$a/*; \
182 do \
183 case $$i in \
184 *CVS) ;; \
185 *.svn) ;; \
186 *.py[co]) ;; \
187 *.orig) ;; \
188 *~) ;; \
189 *idx) \
190 echo $(CPMAC) "$$i" $$b; \
191 $(CPMAC) "$$i" "$$b"; \
192 ;; \
193 *) \
194 if test -d $$i; then continue; fi; \
195 if test -x $$i; then \
196 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
197 $(INSTALL_SCRIPT) "$$i" "$$b"; \
198 else \
199 echo $(INSTALL_DATA) "$$i" "$$b"; \
200 $(INSTALL_DATA) "$$i" "$$b"; \
201 fi;; \
202 esac; \
203 done; \
204 done
205 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
206 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
207 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
208 -c 'import platform; print(platform.python_version())'`!g" \
209 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
210 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
211 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
213 install_Python4way: install_Python
214 lipo @LIPO_32BIT_FLAGS@ -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
215 lipo @LIPO_64BIT_FLAGS@ -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
219 install_IDLE:
220 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
221 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -rf "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
222 /bin/cp -PR "$(srcdir)/IDLE/IDLE.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
223 ln -sf "$(INSTALLED_PYTHONAPP)" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
224 sed -e "s!%prefix%!$(prefix)!g" -e 's!%exe%!$(PYTHONFRAMEWORK)!g' < "$(srcdir)/IDLE/IDLE.app/Contents/MacOS/IDLE" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/IDLE"
225 sed "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`!g" < "$(srcdir)/IDLE/IDLE.app/Contents/Info.plist" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/Info.plist"
226 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \
227 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \
228 "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
229 sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \
230 < "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \
231 > "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \
232 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
234 if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \
235 /bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \
236 "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
237 sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \
238 -e 's!<Alt-Key-!<Option-Key-!g' \
239 < "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \
240 > "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \
241 rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
243 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
245 install_IDLE4way: install_IDLE
246 ln -sf "$(INSTALLED_PYTHONAPP)-32" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
247 sed -e "s!%prefix%!$(prefix)!g" -e 's!%exe%!$(PYTHONFRAMEWORK)-32!g' < "$(srcdir)/IDLE/IDLE.app/Contents/MacOS/IDLE" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/IDLE"
248 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
250 $(INSTALLED_PYTHONAPP): install_Python
252 installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
253 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
254 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
255 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
256 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
257 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
258 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
261 checkapplepython: $(srcdir)/Tools/fixapplepython23.py
262 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
263 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
264 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
268 clean:
269 rm pythonw
270 cd PythonLauncher && make clean
272 Makefile: $(srcdir)/Makefile.in ../config.status
273 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status