blob: 34734d041305610ebb96d0f7a7ff79b8056f41ee [file] [log] [blame]
Thomas Wouters477c8d52006-05-27 19:21:47 +00001# 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@
Thomas Wouters73e5a5b2006-06-08 15:35:45 +00006builddir = ..
7srcdir=@srcdir@
Thomas Wouters0e3f5912006-08-11 14:57:12 +00008prefix=@prefix@
Thomas Wouters477c8d52006-05-27 19:21:47 +00009LIBDEST=$(prefix)/lib/python$(VERSION)
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000010RUNSHARED=@RUNSHARED@
11BUILDEXE=@BUILDEXEEXT@
12BUILDPYTHON=$(builddir)/python$(BUILDEXE)
Thomas Wouters477c8d52006-05-27 19:21:47 +000013DESTDIR=
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000014LDFLAGS=@LDFLAGS@
15FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
Christian Heimes81ee3ef2008-05-04 22:42:01 +000016PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
17
Thomas Wouters477c8d52006-05-27 19:21:47 +000018
19# These are normally glimpsed from the previous set
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000020bindir=$(prefix)/bin
Christian Heimes81ee3ef2008-05-04 22:42:01 +000021PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION)
Thomas Wouters477c8d52006-05-27 19:21:47 +000022APPINSTALLDIR=$(prefix)/Resources/Python.app
23
24# Variables for installing the "normal" unix binaries
Christian Heimes81ee3ef2008-05-04 22:42:01 +000025INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)
Thomas Wouters477c8d52006-05-27 19:21:47 +000026
27# Items more-or-less copied from the main Makefile
28DIRMODE=755
29FILEMODE=644
30INSTALL=@INSTALL@
31INSTALL_SYMLINK=ln -fsn
32INSTALL_PROGRAM=@INSTALL_PROGRAM@
33INSTALL_SCRIPT= @INSTALL_SCRIPT@
34INSTALL_DATA=@INSTALL_DATA@
35LN=@LN@
36STRIPFLAG=-s
37CPMAC=/Developer/Tools/CpMac
38
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000039APPTEMPLATE=$(srcdir)/Resources/app
Thomas Wouters477c8d52006-05-27 19:21:47 +000040APPSUBDIRS=MacOS Resources Resources/English.lproj \
41 Resources/English.lproj/Documentation \
42 Resources/English.lproj/Documentation/doc \
43 Resources/English.lproj/Documentation/ide
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000044DOCDIR=$(srcdir)/Resources/app/Resources/English.lproj/Documentation
Thomas Wouters477c8d52006-05-27 19:21:47 +000045DOCINDEX=$(DOCDIR)/"Documentation idx"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000046CACHERSRC=$(srcdir)/scripts/cachersrc.py
47compileall=$(srcdir)/../Lib/compileall.py
Thomas Wouters477c8d52006-05-27 19:21:47 +000048
49installapps: install_Python install_BuildApplet install_PythonLauncher \
50 install_IDLE checkapplepython install_pythonw install_versionedtools
51
52install_pythonw: pythonw
53 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
54 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
55 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
56 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
57
58#
59# Install unix tools in /usr/local/bin. These are just aliases for the
60# actual installation inside the framework.
61#
62installunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000063 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
64 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000065 fi
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000066 for fn in python pythonw idle pydoc python-config smtpd.py \
67 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
68 pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000069 do \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000070 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000071 done
72
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000073#
74# Like installunixtools, but only install links to the versioned binaries.
75#
76altinstallunixtools:
77 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
78 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
79 fi
80 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
81 pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
82 do \
83 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
84 done
85
86
Thomas Wouters477c8d52006-05-27 19:21:47 +000087# By default most tools are installed without a version in their basename, to
88# make it easier to install (and use) several python versions side-by-side move
89# the tools to a version-specific name and add the non-versioned name as an
90# alias.
91install_versionedtools:
92 for fn in idle pydoc python-config ;\
93 do \
94 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
95 continue ;\
96 fi ;\
97 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
98 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
99 done
100 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
101 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
102 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
103 fi
104
105
Thomas Wouters89f507f2006-12-13 04:49:30 +0000106pythonw: $(srcdir)/Tools/pythonw.c Makefile
Thomas Wouters477c8d52006-05-27 19:21:47 +0000107 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000108 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
Thomas Wouters477c8d52006-05-27 19:21:47 +0000109
110
111install_PythonLauncher:
112 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
113
114install_Python:
115 @if test ! -f $(DOCINDEX); then \
116 echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
117 fi
118 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
119 if test ! -d "$(DESTDIR)$$i"; then \
120 echo "Creating directory $(DESTDIR)$$i"; \
121 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
122 fi;\
123 done
124 @for i in $(APPSUBDIRS); do \
125 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
126 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
127 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
128 else true; \
129 fi; \
130 done
131 @for d in . $(APPSUBDIRS); \
132 do \
133 a=$(APPTEMPLATE)/$$d; \
134 if test ! -d $$a; then continue; else true; fi; \
135 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
136 for i in $$a/*; \
137 do \
138 case $$i in \
139 *CVS) ;; \
140 *.svn) ;; \
141 *.py[co]) ;; \
142 *.orig) ;; \
143 *~) ;; \
144 *idx) \
145 echo $(CPMAC) "$$i" $$b; \
146 $(CPMAC) "$$i" "$$b"; \
147 ;; \
148 *) \
149 if test -d $$i; then continue; fi; \
150 if test -x $$i; then \
151 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
152 $(INSTALL_SCRIPT) "$$i" "$$b"; \
153 else \
154 echo $(INSTALL_DATA) "$$i" "$$b"; \
155 $(INSTALL_DATA) "$$i" "$$b"; \
156 fi;; \
157 esac; \
158 done; \
159 done
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000160 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000161
162install_IDLE:
163 cd IDLE && make install
164
165install_BuildApplet:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000166 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000167 --destroot "$(DESTDIR)" \
168 --python $(INSTALLED_PYTHONAPP) \
169 --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000170 $(srcdir)/scripts/BuildApplet.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000171
172MACLIBDEST=$(LIBDEST)/plat-mac
173MACTOOLSDEST=$(prefix)/Mac/Tools
174MACTOOLSSRC=$(srcdir)/Mac/Tools
175MACTOOLSSUBDIRS=IDE
176
177installmacsubtree:
178 @for i in $(MACTOOLSDEST); \
179 do \
180 if test ! -d $(DESTDIR)$$i; then \
181 echo "Creating directory $(DESTDIR)$$i"; \
182 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
183 else true; \
184 fi; \
185 done
186 @for d in $(MACTOOLSSUBDIRS); \
187 do \
188 a=$(MACTOOLSSRC)/$$d; \
189 if test ! -d $$a; then continue; else true; fi; \
190 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
191 if test ! -d $$b; then \
192 echo "Creating directory $$b"; \
193 $(INSTALL) -d -m $(DIRMODE) $$b; \
194 else true; \
195 fi; \
196 done
197 @for d in $(MACTOOLSSUBDIRS); \
198 do \
199 a=$(MACTOOLSSRC)/$$d; \
200 if test ! -d $$a; then continue; else true; fi; \
201 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
202 for i in $$a/*; \
203 do \
204 case $$i in \
205 *CVS) ;; \
206 *.svn) ;; \
207 *.py[co]) ;; \
208 *.orig) ;; \
209 *~) ;; \
210 *.rsrc) \
211 echo $(CPMAC) $$i $$b ; \
212 $(CPMAC) $$i $$b ; \
213 ;; \
214 *) \
215 if test -d $$i; then continue; fi; \
216 if test -x $$i; then \
217 echo $(INSTALL_SCRIPT) $$i $$b; \
218 $(INSTALL_SCRIPT) $$i $$b; \
219 else \
220 echo $(INSTALL_DATA) $$i $$b; \
221 $(INSTALL_DATA) $$i $$b; \
222 fi;; \
223 esac; \
224 done; \
225 done
226
227
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000228 $(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
229 $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
230 $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000231
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000232$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000233
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000234installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000235 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000236 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
237 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000238 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000239 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
240 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000241
242
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000243checkapplepython: $(srcdir)/Tools/fixapplepython23.py
244 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000245 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000246 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000247 fi
248
249
250clean:
251 rm pythonw
252 cd PythonLauncher && make clean
253 cd IDLE && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000254
255Makefile: $(srcdir)/Makefile.in ../config.status
256 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status