blob: 8cabb281c8e1599effe55657f0e45009c6482637 [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
Benjamin Petersonde9c8692008-07-01 18:23:09 +000048installapps: install_PythonLauncher install_IDLE checkapplepython install_pythonw \
49 install_versionedtools
Thomas Wouters477c8d52006-05-27 19:21:47 +000050
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:
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000162 test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
163 -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
164 cp -PR IDLE/IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)"
Benjamin Petersonbbea7972008-07-05 22:51:21 +0000165 ln -sf $(INSTALLED_PYTHONAPP) "$(DESDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
Benjamin Petersonde9c8692008-07-01 18:23:09 +0000166 touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000167
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000168$(INSTALLED_PYTHONAPP): install_Python
Thomas Wouters477c8d52006-05-27 19:21:47 +0000169
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000170installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
Thomas Wouters477c8d52006-05-27 19:21:47 +0000171 $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000172 $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
173 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000174 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000175 $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
176 "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
Thomas Wouters477c8d52006-05-27 19:21:47 +0000177
178
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000179checkapplepython: $(srcdir)/Tools/fixapplepython23.py
180 @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000181 echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
Thomas Wouters73e5a5b2006-06-08 15:35:45 +0000182 echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
Thomas Wouters477c8d52006-05-27 19:21:47 +0000183 fi
184
185
186clean:
187 rm pythonw
188 cd PythonLauncher && make clean
Thomas Wouters89f507f2006-12-13 04:49:30 +0000189
190Makefile: $(srcdir)/Makefile.in ../config.status
191 cd .. && CONFIG_FILES=Mac/Makefile CONFIG_HEADERS= $(SHELL) ./config.status