Debian Codegraph @

cpython27/Mac/Makefile.in

raw
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.
4
5 VERSION=@VERSION@
6 ENSUREPIP=@ENSUREPIP@
7 builddir = ..
8 srcdir=@srcdir@
9 prefix=@prefix@
10 exec_prefix=@exec_prefix@
11 LIBDEST=$(prefix)/lib/python$(VERSION)
12 RUNSHARED=@RUNSHARED@
13 BUILDEXE=@BUILDEXEEXT@
14 BUILDPYTHON=$(builddir)/python$(BUILDEXE)
15 DESTDIR=
16 LDFLAGS=@LDFLAGS@
17 FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
18 PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
19 PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
20 LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
21 CC=@CC@
22 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
23 export MACOSX_DEPLOYMENT_TARGET
24
25 # These are normally glimpsed from the previous set
26 BINDIR= @bindir@
27 PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
28 APPINSTALLDIR=$(prefix)/Resources/Python.app
29
30 # Variables for installing the "normal" unix binaries
31 INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
32
33 # Items more-or-less copied from the main Makefile
34 DIRMODE=755
35 FILEMODE=644
36 INSTALL=@INSTALL@
37 INSTALL_SYMLINK=ln -fsn
38 INSTALL_PROGRAM=@INSTALL_PROGRAM@
39 INSTALL_SCRIPT= @INSTALL_SCRIPT@
40 INSTALL_DATA=@INSTALL_DATA@
41 LN=@LN@
42 STRIPFLAG=-s
43 CPMAC=CpMac
44
45 APPTEMPLATE=$(srcdir)/Resources/app
46 APPSUBDIRS=MacOS Resources
47 CACHERSRC=$(srcdir)/scripts/cachersrc.py
48 compileall=$(srcdir)/../Lib/compileall.py
49
50 installapps: install_Python install_pythonw install_BuildApplet install_PythonLauncher \
51 install_IDLE checkapplepython install_versionedtools
52
53
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/python2"
58 ln -sf python2 "$(DESTDIR)$(prefix)/bin/python"
59 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw2"
60 ln -sf pythonw2 "$(DESTDIR)$(prefix)/bin/pythonw"
61 ifneq ($(LIPO_32BIT_FLAGS),)
62 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
63 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
64 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python2-32"
65 ln -sf python2-32 "$(DESTDIR)$(prefix)/bin/python-32"
66 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw2-32"
67 ln -sf pythonw2-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
68 endif
69
70
71 #
72 # Install unix tools in /usr/local/bin. These are just aliases for the
73 # actual installation inside the framework.
74 #
75 installunixtools:
76 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
77 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
78 fi
79 for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
80 python2 pythonw2 idle2 \
81 pydoc2 python2-config smtpd2.py \
82 2to3-2 \
83 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
84 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py \
85 2to3-$(VERSION) ;\
86 do \
87 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
88 done
89 ifneq ($(LIPO_32BIT_FLAGS),)
90 for fn in python-32 pythonw-32 \
91 python2-32 pythonw2-32 \
92 python$(VERSION)-32 pythonw$(VERSION)-32 ;\
93 do \
94 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
95 done
96 endif
97 -if test "x$(ENSUREPIP)" != "xno" ; then \
98 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
99 for fn in \
100 easy_install \
101 pip \
102 pip2 \
103 ; \
104 do \
105 rm -f $${fn} ;\
106 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
107 done ;\
108 fi
109
110
111 #
112 # Like installunixtools, but only install links to the versioned binaries.
113 #
114 altinstallunixtools:
115 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
116 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
117 fi
118 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
119 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
120 do \
121 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
122 done
123 ifneq ($(LIPO_32BIT_FLAGS),)
124 for fn in python$(VERSION)-32 pythonw$(VERSION)-32 ;\
125 do \
126 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
127 done
128 endif
129 ln -fs "$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/2to3-$(VERSION)"
130 -if test "x$(ENSUREPIP)" != "xno" ; then \
131 cd "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" && \
132 for fn in \
133 easy_install-$(VERSION) \
134 pip$(VERSION) \
135 ; \
136 do \
137 rm -f $${fn} ;\
138 $(LN) -s $(BINDIR)/$${fn} $${fn} ;\
139 done ;\
140 fi
141
142 # By default most tools are installed without a version in their basename, to
143 # make it easier to install (and use) several python versions side-by-side move
144 # the tools to a version-specific name and add the non-versioned name as an
145 # alias.
146 install_versionedtools:
147 for fn in idle pydoc ;\
148 do \
149 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
150 continue ;\
151 fi ;\
152 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
153 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}2" ;\
154 ln -sf "$${fn}2" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
155 done
156 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
157 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
158 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd2.py" ;\
159 ln -sf "smtpd2.py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
160 fi
161 if [ ! -h "$(DESTDIR)$(prefix)/bin/2to3" ]; then \
162 mv "$(DESTDIR)$(prefix)/bin/2to3" "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)" ;\
163 ln -sf "2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3-2" ;\
164 ln -sf "2to3-2" "$(DESTDIR)$(prefix)/bin/2to3" ;\
165 fi
166
167
168 pythonw: $(srcdir)/Tools/pythonw.c Makefile
169 $(CC) $(LDFLAGS) -DPYTHONFRAMEWORK='"$(PYTHONFRAMEWORK)"' -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
170
171 install_PythonLauncher:
172 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
173
174 install_Python:
175 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
176 if test ! -d "$(DESTDIR)$$i"; then \
177 echo "Creating directory $(DESTDIR)$$i"; \
178 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
179 fi;\
180 done
181 @for i in $(APPSUBDIRS); do \
182 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
183 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
184 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
185 else true; \
186 fi; \
187 done
188 @for d in . $(APPSUBDIRS); \
189 do \
190 a=$(APPTEMPLATE)/$$d; \
191 if test ! -d $$a; then continue; else true; fi; \
192 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
193 for i in $$a/*; \
194 do \
195 case $$i in \
196 *CVS) ;; \
197 *.svn) ;; \
198 *.py[co]) ;; \
199 *.orig) ;; \
200 *~) ;; \
201 *idx) \
202 echo $(CPMAC) "$$i" $$b; \
203 $(CPMAC) "$$i" "$$b"; \
204 ;; \
205 *) \
206 if test -d $$i; then continue; fi; \
207 if test -x $$i; then \
208 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
209 $(INSTALL_SCRIPT) "$$i" "$$b"; \
210 else \
211 echo $(INSTALL_DATA) "$$i" "$$b"; \
212 $(INSTALL_DATA) "$$i" "$$b"; \
213 fi;; \
214 esac; \
215 done; \
216 done
217 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
218 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
219 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
220 -c 'import platform; print(platform.python_version())'`!g" \
221 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
222 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
223 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
224
225
226 install_IDLE:
227 cd IDLE && make install
228
229 install_BuildApplet:
230 if ! $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) \
231 -c 'import EasyDialogs' 2>/dev/null ; then \
232 echo "EasyDialogs not available in this Python - skipping Build Applet.app" ; \
233 else \
234 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
235 --destroot "$(DESTDIR)" \
236 --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
237 --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
238 $(srcdir)/scripts/BuildApplet.py && \
239 if [ -n "$(LIPO_32BIT_FLAGS)" ] ; then \
240 rm "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" && \
241 lipo $(LIPO_32BIT_FLAGS) \
242 -output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" \
243 $(BUILDPYTHON) ; \
244 fi \
245 fi
246
247 MACLIBDEST=$(LIBDEST)/plat-mac
248 MACTOOLSDEST=$(prefix)/Mac/Tools
249 MACTOOLSSRC=$(srcdir)/Mac/Tools
250 MACTOOLSSUBDIRS=IDE
251
252 installmacsubtree:
253 @for i in $(MACTOOLSDEST); \
254 do \
255 if test ! -d $(DESTDIR)$$i; then \
256 echo "Creating directory $(DESTDIR)$$i"; \
257 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
258 else true; \
259 fi; \
260 done
261 @for d in $(MACTOOLSSUBDIRS); \
262 do \
263 a=$(MACTOOLSSRC)/$$d; \
264 if test ! -d $$a; then continue; else true; fi; \
265 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
266 if test ! -d $$b; then \
267 echo "Creating directory $$b"; \
268 $(INSTALL) -d -m $(DIRMODE) $$b; \
269 else true; \
270 fi; \
271 done
272 @for d in $(MACTOOLSSUBDIRS); \
273 do \
274 a=$(MACTOOLSSRC)/$$d; \
275 if test ! -d $$a; then continue; else true; fi; \
276 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
277 for i in $$a/*; \
278 do \
279 case $$i in \
280 *CVS) ;; \
281 *.svn) ;; \
282 *.py[co]) ;; \
283 *.orig) ;; \
284 *~) ;; \
285 *.rsrc) \
286 echo $(CPMAC) $$i $$b ; \
287 $(CPMAC) $$i $$b ; \
288 ;; \
289 *) \
290 if test -d $$i; then continue; fi; \
291 if test -x $$i; then \
292 echo $(INSTALL_SCRIPT) $$i $$b; \
293 $(INSTALL_SCRIPT) $$i $$b; \
294 else \
295 echo $(INSTALL_DATA) $$i $$b; \
296 $(INSTALL_DATA) $$i $$b; \
297 fi;; \
298 esac; \
299 done; \
300 done
301
302
303 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
304 $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
305 $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
306
307 $(INSTALLED_PYTHONAPP): install_Python
308
309 installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
310 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
311 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
312 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
313 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
314 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
315 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
316
317
318 checkapplepython: $(srcdir)/Tools/fixapplepython23.py
319 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
320 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
321 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
322 fi
323
324
325 clean:
326 rm pythonw
327 cd PythonLauncher && make clean
328 cd IDLE && make clean
329
330 Makefile: $(srcdir)/Makefile.in ../config.status
331 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status