blob: 01b8cd5cf849a9bcf2eb496303fa449f2980dc1e [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 +000046compileall=$(srcdir)/../Lib/compileall.py
Thomas Wouters477c8d52006-05-27 19:21:47 +000047
48installapps: install_Python install_BuildApplet install_PythonLauncher \
49 install_IDLE checkapplepython install_pythonw install_versionedtools
50
51install_pythonw: pythonw
52 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
53 $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
54 ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
55 ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
56
57#
58# Install unix tools in /usr/local/bin. These are just aliases for the
59# actual installation inside the framework.
60#
61installunixtools:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000062 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
63 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000064 fi
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000065 for fn in python pythonw idle pydoc python-config smtpd.py \
66 python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
67 pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000068 do \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000069 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
Thomas Wouters477c8d52006-05-27 19:21:47 +000070 done
71
Thomas Wouters73e5a5b2006-06-08 15:35:45 +000072#
73# Like installunixtools, but only install links to the versioned binaries.
74#
75altinstallunixtools:
76 if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
77 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
78 fi
79 for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
80 pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
81 do \
82 ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
83 done
84
85
Thomas Wouters477c8d52006-05-27 19:21:47 +000086# By default most tools are installed without a version in their basename, to
87# make it easier to install (and use) several python versions side-by-side move
88# the tools to a version-specific name and add the non-versioned name as an
89# alias.
90install_versionedtools:
91 for fn in idle pydoc python-config ;\
92 do \
93 if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
94 continue ;\
95 fi ;\
96 mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
97 ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
98 done
99 if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
100 mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
101 ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
102 fi
103
104
Thomas Wouters89f507f2006-12-13 04:49:30 +0000105pythonw: $(srcdir)/Tools/pythonw.c Makefile
Thomas Wouters477c8d52006-05-27 19:21:47 +0000106 $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000107 -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
Thomas Wouters477c8d52006-05-27 19:21:47 +0000108
109
110install_PythonLauncher:
111 cd PythonLauncher && make install DESTDIR=$(DESTDIR)
112
113install_Python:
114 @if test ! -f $(DOCINDEX); then \
115 echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
116 fi
117 @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
118 if test ! -d "$(DESTDIR)$$i"; then \
119 echo "Creating directory $(DESTDIR)$$i"; \
120 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \
121 fi;\
122 done
123 @for i in $(APPSUBDIRS); do \
124 if test ! -d "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; then \
125 echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
126 $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \
127 else true; \
128 fi; \
129 done
130 @for d in . $(APPSUBDIRS); \
131 do \
132 a=$(APPTEMPLATE)/$$d; \
133 if test ! -d $$a; then continue; else true; fi; \
134 b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \
135 for i in $$a/*; \
136 do \
137 case $$i in \
138 *CVS) ;; \
139 *.svn) ;; \
140 *.py[co]) ;; \
141 *.orig) ;; \
142 *~) ;; \
143 *idx) \
144 echo $(CPMAC) "$$i" $$b; \
145 $(CPMAC) "$$i" "$$b"; \
146 ;; \
147 *) \
148 if test -d $$i; then continue; fi; \
149 if test -x $$i; then \
150 echo $(INSTALL_SCRIPT) "$$i" "$$b"; \
151 $(INSTALL_SCRIPT) "$$i" "$$b"; \
152 else \
153 echo $(INSTALL_DATA) "$$i" "$$b"; \
154 $(INSTALL_DATA) "$$i" "$$b"; \
155 fi;; \
156 esac; \
157 done; \
158 done
Christian Heimes81ee3ef2008-05-04 22:42:01 +0000159 $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000160
161install_IDLE:
162 cd IDLE && make install
163
164install_BuildApplet:
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000165 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000166 --destroot "$(DESTDIR)" \
167 --python $(INSTALLED_PYTHONAPP) \
168 --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000169 $(srcdir)/scripts/BuildApplet.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000170
171MACLIBDEST=$(LIBDEST)/plat-mac
172MACTOOLSDEST=$(prefix)/Mac/Tools
173MACTOOLSSRC=$(srcdir)/Mac/Tools
174MACTOOLSSUBDIRS=IDE
175
176installmacsubtree:
177 @for i in $(MACTOOLSDEST); \
178 do \
179 if test ! -d $(DESTDIR)$$i; then \
180 echo "Creating directory $(DESTDIR)$$i"; \
181 $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
182 else true; \
183 fi; \
184 done
185 @for d in $(MACTOOLSSUBDIRS); \
186 do \
187 a=$(MACTOOLSSRC)/$$d; \
188 if test ! -d $$a; then continue; else true; fi; \
189 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
190 if test ! -d $$b; then \
191 echo "Creating directory $$b"; \
192 $(INSTALL) -d -m $(DIRMODE) $$b; \
193 else true; \
194 fi; \
195 done
196 @for d in $(MACTOOLSSUBDIRS); \
197 do \
198 a=$(MACTOOLSSRC)/$$d; \
199 if test ! -d $$a; then continue; else true; fi; \
200 b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \
201 for i in $$a/*; \
202 do \
203 case $$i in \
204 *CVS) ;; \
205 *.svn) ;; \
206 *.py[co]) ;; \
207 *.orig) ;; \
208 *~) ;; \
209 *.rsrc) \
210 echo $(CPMAC) $$i $$b ; \
211 $(CPMAC) $$i $$b ; \
212 ;; \
213 *) \
214 if test -d $$i; then continue; fi; \
215 if test -x $$i; then \
216 echo $(INSTALL_SCRIPT) $$i $$b; \
217 $(INSTALL_SCRIPT) $$i $$b; \
218 else \
219 echo $(INSTALL_DATA) $$i $$b; \
220 $(INSTALL_DATA) $$i $$b; \
221 fi;; \
222 esac; \
223 done; \
224 done
225
226
Georg Brandle1b5ac62008-06-04 13:06:58 +0000227 $(RUNSHARED) $(BUILDPYTHON) -Wi $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
228 $(RUNSHARED) $(BUILDPYTHON) -O -Wi $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
Thomas Wouters477c8d52006-05-27 19:21:47 +0000229
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000230$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000231
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000232installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000233 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000234 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
235 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000236 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000237 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
238 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000239
240
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000241checkapplepython: $(srcdir)/Tools/fixapplepython23.py
242 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000243 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000244 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000245 fi
246
247
248clean:
249 rm pythonw
250 cd PythonLauncher && make clean
251 cd IDLE && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000252
253Makefile: $(srcdir)/Makefile.in ../config.status
254 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status