Issue #7654: enable additional bytes/bytearray tests. Patch by Florent Xicluna.
[python.git] / Mac / Makefile.in
blob8c389eddcd90c160c0550be3fd90b4fe356df43f
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 LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
21 # These are normally glimpsed from the previous set
22 bindir=$(prefix)/bin
23 PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
24 APPINSTALLDIR=$(prefix)/Resources/Python.app
26 # Variables for installing the "normal" unix binaries
27 INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
29 # Items more-or-less copied from the main Makefile
30 DIRMODE=755
31 FILEMODE=644
32 INSTALL=@INSTALL@
33 INSTALL_SYMLINK=ln -fsn
34 INSTALL_PROGRAM=@INSTALL_PROGRAM@
35 INSTALL_SCRIPT= @INSTALL_SCRIPT@
36 INSTALL_DATA=@INSTALL_DATA@
37 LN=@LN@
38 STRIPFLAG=-s
39 CPMAC=/Developer/Tools/CpMac
41 APPTEMPLATE=$(srcdir)/Resources/app
42 APPSUBDIRS=MacOS Resources
43 CACHERSRC=$(srcdir)/scripts/cachersrc.py
44 compileall=$(srcdir)/../Lib/compileall.py
46 installapps: install_Python install_pythonw install_BuildApplet install_PythonLauncher \
47 install_IDLE checkapplepython install_versionedtools
50 install_pythonw: pythonw
51 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
52 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
53 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
54 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
55 ifneq ($(LIPO_32BIT_FLAGS),)
56 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
57 lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
58 ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32"
59 ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
60 endif
64 # Install unix tools in /usr/local/bin. These are just aliases for the
65 # actual installation inside the framework.
67 installunixtools:
68 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
69 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
71 for fn in python pythonw idle pydoc python-config smtpd.py \
72 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
73 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
74 do \
75 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
76 done
80 # Like installunixtools, but only install links to the versioned binaries.
82 altinstallunixtools:
83 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
84 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
86 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
87 pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
88 do \
89 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
90 done
92 # By default most tools are installed without a version in their basename, to
93 # make it easier to install (and use) several python versions side-by-side move
94 # the tools to a version-specific name and add the non-versioned name as an
95 # alias.
96 install_versionedtools:
97 for fn in idle pydoc ;\
98 do \
99 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
100 continue ;\
101 fi ;\
102 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
103 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
104 done
105 if [ ! -h "$(DESTDIR)$(prefix)/bin/python-config" ]; then \
106 mv "$(DESTDIR)$(prefix)/bin/python-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\
107 ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python-config" ; \
109 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
110 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
111 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
115 pythonw: $(srcdir)/Tools/pythonw.c Makefile
116 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
118 install_PythonLauncher:
119 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
121 install_Python:
122 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
123 if test ! -d "$(DESTDIR)$$i"; then \
124 echo "Creating directory $(DESTDIR)$$i"; \
125 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
126 fi;\
127 done
128 @for i in $(APPSUBDIRS); do \
129 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
130 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
131 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
132 else true; \
133 fi; \
134 done
135 @for d in . $(APPSUBDIRS); \
136 do \
137 a=$(APPTEMPLATE)/$$d; \
138 if test ! -d $$a; then continue; else true; fi; \
139 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
140 for i in $$a/*; \
141 do \
142 case $$i in \
143 *CVS) ;; \
144 *.svn) ;; \
145 *.py[co]) ;; \
146 *.orig) ;; \
147 *~) ;; \
148 *idx) \
149 echo $(CPMAC) "$$i" $$b; \
150 $(CPMAC) "$$i" "$$b"; \
151 ;; \
152 *) \
153 if test -d $$i; then continue; fi; \
154 if test -x $$i; then \
155 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
156 $(INSTALL_SCRIPT) "$$i" "$$b"; \
157 else \
158 echo $(INSTALL_DATA) "$$i" "$$b"; \
159 $(INSTALL_DATA) "$$i" "$$b"; \
160 fi;; \
161 esac; \
162 done; \
163 done
164 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
165 sed -e "s!%bundleid%!$(PYTHONFRAMEWORKIDENTIFIER)!g" \
166 -e "s!%version%!`$(RUNSHARED) $(BUILDPYTHON) \
167 -c 'import platform; print(platform.python_version())'`!g" \
168 < "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in" \
169 > "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
170 rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
173 install_IDLE:
174 cd IDLE && make install
176 install_BuildApplet:
177 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
178 --destroot "$(DESTDIR)" \
179 --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
180 --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
181 $(srcdir)/scripts/BuildApplet.py
182 ifneq ($(LIPO_32BIT_FLAGS),)
183 rm "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python"
184 lipo $(LIPO_32BIT_FLAGS) -output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app/Contents/MacOS/Python" $(BUILDPYTHON)
185 endif
187 MACLIBDEST=$(LIBDEST)/plat-mac
188 MACTOOLSDEST=$(prefix)/Mac/Tools
189 MACTOOLSSRC=$(srcdir)/Mac/Tools
190 MACTOOLSSUBDIRS=IDE
192 installmacsubtree:
193 @for i in $(MACTOOLSDEST); \
194 do \
195 if test ! -d $(DESTDIR)$$i; then \
196 echo "Creating directory $(DESTDIR)$$i"; \
197 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
198 else true; \
199 fi; \
200 done
201 @for d in $(MACTOOLSSUBDIRS); \
202 do \
203 a=$(MACTOOLSSRC)/$$d; \
204 if test ! -d $$a; then continue; else true; fi; \
205 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
206 if test ! -d $$b; then \
207 echo "Creating directory $$b"; \
208 $(INSTALL) -d -m $(DIRMODE) $$b; \
209 else true; \
210 fi; \
211 done
212 @for d in $(MACTOOLSSUBDIRS); \
213 do \
214 a=$(MACTOOLSSRC)/$$d; \
215 if test ! -d $$a; then continue; else true; fi; \
216 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
217 for i in $$a/*; \
218 do \
219 case $$i in \
220 *CVS) ;; \
221 *.svn) ;; \
222 *.py[co]) ;; \
223 *.orig) ;; \
224 *~) ;; \
225 *.rsrc) \
226 echo $(CPMAC) $$i $$b ; \
227 $(CPMAC) $$i $$b ; \
228 ;; \
229 *) \
230 if test -d $$i; then continue; fi; \
231 if test -x $$i; then \
232 echo $(INSTALL_SCRIPT) $$i $$b; \
233 $(INSTALL_SCRIPT) $$i $$b; \
234 else \
235 echo $(INSTALL_DATA) $$i $$b; \
236 $(INSTALL_DATA) $$i $$b; \
237 fi;; \
238 esac; \
239 done; \
240 done
243 $(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
244 $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
245 $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
247 $(INSTALLED_PYTHONAPP): install_Python
249 installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
250 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
251 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
252 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
253 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
254 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
255 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
258 checkapplepython: $(srcdir)/Tools/fixapplepython23.py
259 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
260 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
261 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
265 clean:
266 rm pythonw
267 cd PythonLauncher && make clean
268 cd IDLE && make clean
270 Makefile: $(srcdir)/Makefile.in ../config.status
271 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status