4 # Instructions for configuring an fptools package.
6 # There are two ways you can get started with an fptools package, either
7 # by using the unpacked distribution tree in-situ or by installing the
10 # Using the package directly is easy, just do `make in-place'. (The
11 # distribution will *not* work straight out of the box, you'll have to do
14 # To install the package, you'll have to set one or more of the
15 # following variables:
18 # path to directory of where you want the executables
21 # where you want the library archives to go.
22 # Note, if you specify /usr/foo/lib for libdir,
23 # the library files for your fptools package will be
24 # installed in /usr/foo/lib/<package>-<version>, e.g.,
25 # /usr/foo/lib/ghc-3.00. If you don't want the package/version
26 # directory appended, you'll have to modify $(real_libdir)
30 # path to where the platform-independent files will go.
31 # As for libdir, the effective path for the platform-indep
32 # stuff is $(datadir)/<package>-<version>. If you want
33 # complete control, see $(real_datadir)
36 # the platform you're installing for. The configure script
37 # makes an educated guess, so you'll only have to set this
38 # if it clashes with your reality, I guess.
41 # where to install the documentation HTML files.
43 # where to install the DVI files.
45 # where to install the Emacs info files
47 # Installing the documentation is not done as part of the `install' rule, but
48 # via `install-docs' (or if you want to be selective: `install-html', `install-dvi'
49 # and `install-info').
51 # For more complete instructions, consult the INSTALL file
52 # that came with the bundle, and/or consult the installation
53 # documentation in one of the document directories.
55 # Please report any bugs, problems etc. with installing and using this bundle
56 # Makefile setup to glasgow-haskell-bugs@dcs.gla.ac.uk
59 # Where the different pieces of the bundle should go:
61 libdir = @libdir@/$(package)-$(version)
62 datadir = @datadir@/$(package)-$(version)
64 platform = @TargetPlatform@
66 exec_prefix = @exec_prefix@
87 INSTALL_DIR = ./mkdirhier
90 # Set of package scripts for which you'd like a name-<version> symlink
91 # to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to
92 # avoid version vertigo.
94 VERSION_SYMLINKS_FOR=$(package)
97 PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS)
99 #----------end of user-serviceable parts------------
102 # How to install the different pieces
104 INSTALL_BIN = $(INSTALL) $(INSTALL_BIN_OPTS)
105 INSTALL_LIB = $(INSTALL) $(INSTALL_LIB_OPTS)
106 INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS)
108 # What's common to all installs
109 INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)
114 INSTALL_BIN_OPTS = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS)
115 INSTALL_LIB_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS)
116 INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)
118 .PHONY: in-place config-pkgs mk-version-symlinks install-dirs install
121 @echo "Configuring $(package), version $(version), on $(platform) ..."
122 @for i in $(PACKAGE_PRL_SCRIPTS) ""; do \
123 if test "$$i"; then \
124 echo "Creating a configured version of $$i .."; \
125 $(RM) bin/$(platform)/$$i.bak; \
126 if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
127 echo "#! $(PERL)" > bin/$(platform)/$$i ; \
128 echo '$$'"bindir='$(bindir)';" >> bin/$(platform)/$$i ; \
129 echo '$$'"libdir='$(libdir)';" >> bin/$(platform)/$$i ; \
130 echo '$$'"libexecdir='$(libdir)';" >> bin/$(platform)/$$i ; \
131 echo '$$'"datadir='$(datadir)';" >> bin/$(platform)/$$i ; \
132 echo '$$'"SED='$(SED)';" >> bin/$(platform)/$$i ; \
133 echo '$$'"TMPDIR='$(TMPDIR)';" >> bin/$(platform)/$$i ; \
134 cat bin/$(platform)/$$i.prl >> bin/$(platform)/$$i ; \
135 $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
139 @for i in $(PACKAGE_LIB_PRL_SCRIPTS) ""; do \
140 if test "$$i"; then \
141 echo "Creating a configured version of $$i .."; \
142 $(RM) lib/$(platform)/$$i.bak; \
143 if [ -f lib/$(platform)/$$i ]; then $(MV) lib/$(platform)/$$i lib/$(platform)/$$i.bak; fi; \
144 echo "#! $(PERL)" > lib/$(platform)/$$i ; \
145 echo '$$'"bindir='$(bindir)';" >> lib/$(platform)/$$i ; \
146 echo '$$'"libdir='$(libdir)';" >> lib/$(platform)/$$i ; \
147 echo '$$'"libexecdir='$(libdir)';" >> lib/$(platform)/$$i ; \
148 echo '$$'"datadir='$(datadir)';" >> lib/$(platform)/$$i ; \
149 echo '$$'"SED='$(SED)';" >> lib/$(platform)/$$i ; \
150 echo '$$'"TMPDIR='$(TMPDIR)';" >> lib/$(platform)/$$i ; \
151 cat lib/$(platform)/$$i.prl >> lib/$(platform)/$$i; \
152 $(CHMOD) $(BIN_PERMS) lib/$(platform)/$$i; \
156 @for i in $(PACKAGE_SH_SCRIPTS) ""; do \
157 if test "$$i"; then \
158 echo "Creating a configured version of $$i .."; \
159 $(RM) bin/$(platform)/$$i.bak; \
160 if [ -f bin/$(platform)/$$i ]; then $(MV) bin/$(platform)/$$i bin/$(platform)/$$i.bak; fi; \
161 echo "#! $(SH)" > bin/$(platform)/$$i ; \
162 echo "bindir='$(bindir)'" >> bin/$(platform)/$$i ; \
163 echo "libdir='$(libdir)'" >> bin/$(platform)/$$i ; \
164 echo "libexecdir='$(libdir)'" >> bin/$(platform)/$$i ; \
165 echo "datadir='$(datadir)'" >> bin/$(platform)/$$i ; \
166 echo "SED='$(SED)'" >> bin/$(platform)/$$i ; \
167 echo "TMPDIR='$(TMPDIR)'" >> bin/$(platform)/$$i ; \
168 cat bin/$(platform)/$$i.sh >> bin/$(platform)/$$i; \
169 $(CHMOD) $(BIN_PERMS) bin/$(platform)/$$i; \
174 # Convert pwd's UNC reported path into DOS style
176 CURRENT_DIR = $(shell pwd | sed 's|^//\(.\)|\1:|' )
179 $(MAKE) $(MFLAGS) config-pkgs bindir=$(CURRENT_DIR)/bin/$(platform) libdir=$(CURRENT_DIR)/lib/$(platform) datadir=$(CURRENT_DIR)/share
180 @echo "Finished configuring..to use, add $(CURRENT_DIR)/bin/$(platform) to your PATH."
183 $(INSTALL_DIR) $(bindir)
184 (cd lib/$(platform); find . -type d -exec sh -c '../../$(INSTALL_DIR) $$0 $(libdir)/$$0' {} \; )
185 (cd share; find . -type d -exec sh -c '../$(INSTALL_DIR) $(datadir)/$$0' {} \; )
187 install :: config-pkgs install-dirs install-bin install-libs install-datas
189 .PHONY: install-bin install-libs install-datas
192 for i in $(PACKAGE_BIN_INSTALL) ""; do \
193 if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i $(bindir); fi; \
195 for i in $(PACKAGE_BINS) ""; do \
196 if test -n "$$i" ; then $(INSTALL_BIN) bin/$(platform)/$$i$(exeext) $(bindir); fi; \
198 for i in $(VERSION_SYMLINKS_FOR) ""; do \
199 if [ "x$$i" != "x" ]; then \
201 if ( $(PERL) -e '$$fn="'$$i'"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
202 echo "Creating a symbol link from $$i-$(version) to $$i"; \
204 $(LN_S) $$i-$(version) $$i; \
206 echo "Creating a symbol link from $$i-$(version) to $$i failed: \`$$i' already exists"; \
207 echo "Perhaps remove \`$$i' manually?"; \
216 (cd lib/$(platform); find . -type f -exec sh -c '$(CP) $$0 $(libdir)/$$0' {} \; )
219 (cd share; find . -type f -exec sh -c '$(INSTALL_DATA) $$0 $(datadir)/$$0' {} \; )
222 @echo "Install setup..."
223 @echo "bindir = $(bindir)"
224 @echo "libdir = $(libdir) (libdir = $(libdir))"
225 @echo "datadir = $(datadir) (datadir = $(datadir))"
228 # Documentation targets, install-docs for the whole lot, or
229 # install-{dvi,html,info}
232 .PHONY: show-install-setup install-docs install-html install-info install-dirs-dvi install-dirs-html install-dirs-info
234 install-docs : install-html install-dvi install-info
236 install-dvi: install-dirs-dvi
237 $(INSTALL_DATA) dvi/* $(dvidir)
239 install-info: install-dirs-info
240 $(INSTALL_DATA) info/* $(infodir)
242 install-html: install-dirs-html
243 $(INSTALL_DATA) html/* $(htmldir)
246 $(INSTALL_DIR) $(htmldir)
249 $(INSTALL_DIR) $(infodir)
252 $(INSTALL_DIR) $(dvidir)