PageRenderTime 446ms CodeModel.GetById 140ms app.highlight 108ms RepoModel.GetById 194ms app.codeStats 0ms

/Mac/Makefile.in

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