Makefile-bin.in 9.51 KB
Newer Older
sof's avatar
sof committed
1
2
3
#
# @configure_input@
#
4
5
6
7
8
9
# Instructions for configuring an fptools package.
#
# There are two ways you can get started with an fptools package, either
# by using the unpacked distribution tree in-situ or by installing the
# package.
#
10
# Using the package directly is easy, just do `make in-place'. (The
sof's avatar
sof committed
11
12
# distribution will *not* work straight out of the box, you'll have to do
# this first)
13
14
15
16
17
18
19
20
21
22
23
#
# To install the package, you'll have to set one or more of the
# following variables:
#
#  * bindir 
#     path to directory of where you want the executables
#     to be installed.
#  * libdir
#     where you want the library archives to go.
#     Note, if you specify /usr/foo/lib for libdir,
#     the library files for your fptools package will be
sof's avatar
sof committed
24
#     installed in  /usr/foo/lib/<package>-<version>, e.g.,
25
#     /usr/foo/lib/ghc-2.07. If you don't want the package/version
26
27
28
29
30
31
32
#     directory appended, you'll have to modify $(real_libdir)
#     below.
#
#  * datadir
#     path to where the platform-independent files will go.
#     As for libdir, the effective path for the platform-indep
#     stuff is $(datadir)/<package>-<version>. If you want
sof's avatar
sof committed
33
#     complete control, see $(real_datadir)
34
35
#
#  * platform 
sof's avatar
sof committed
36
37
38
#     the platform you're installing for. The configure script
#     makes an educated guess, so you'll only have to set this
#     if it clashes with your reality, I guess.
39
40
41
42
43
#
#  * htmldir
#     where to install the documentation HTML files.
#  * dvidir
#     where to install the DVI files.
sof's avatar
sof committed
44
45
#  * infodir
#     where to install the Emacs info files
46
#
sof's avatar
sof committed
47
48
49
# Installing the documentation is not done as part of the `install' rule, but
# via `install-docs' (or if you want to be selective: `install-html', `install-dvi'
# and `install-info').
50
51
52
53
54
#
# For more complete instructions, consult the INSTALL file
# that came with the bundle, and/or consult the installation
# documentation in one of the document directories.
#
sof's avatar
sof committed
55
56
57
58
59
60
61
62
63
64
65
66
# Please report any bugs, problems etc. with installing and using this bundle
# Makefile setup to glasgow-haskell-bugs@dcs.gla.ac.uk
# 

# Where the different pieces of the bundle should go:
bindir      = @bindir@
libdir      = @libdir@
datadir     = @datadir@

platform    = @TargetPlatform@
prefix      = @prefix@
exec_prefix = @exec_prefix@
67

sof's avatar
sof committed
68
69
70
71
# default
infodir   = $(datadir)
htmldir   = $(datadir)
dvidir    = $(datadir)
72
73
74
75
76

#
# Putting the package stuff in package-specific
# directories:
#
sof's avatar
sof committed
77
78
79
80
real_libdir      = $(libdir)/$(package)-$(version)
real_datadir     = $(datadir)/$(package)-$(version)

PERL        = @PerlCmd@
81
SH	    = /bin/sh
sof's avatar
sof committed
82
83
RM          = rm -f
MV          = mv
84
CP          = cp
sof's avatar
sof committed
85
86
87
LN_S        = @LN_S@
CHMOD       = chmod
INSTALL	    = @INSTALL@
sof's avatar
sof committed
88
89
RAWCPP      = @RAWCPP@
SED	    = @SedCmd@
sof's avatar
sof committed
90
91
# sigh
INSTALL_DIR  = ./mkdirhier
92

sof's avatar
sof committed
93
94
#
# Set of package scripts for which you'd like a name-<version> symlink
sof's avatar
sof committed
95
# to be created, i.e., create a symlink, ghc-$(version), pointing to ghc to
sof's avatar
sof committed
96
97
# avoid version vertigo.
#
98
VERSION_SYMLINKS_FOR=$(package)
sof's avatar
sof committed
99
100

# Binaries to install
101
PACKAGE_BIN_INSTALL=$(PACKAGE_PRL_SCRIPTS) $(PACKAGE_SH_SCRIPTS) $(PACKAGE_BINS)
sof's avatar
sof committed
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

#----------end of user-serviceable parts------------
#
#
# How to install the different pieces
# 
INSTALL_BIN  = $(INSTALL) $(INSTALL_BIN_OPTS)
INSTALL_LIB  = $(INSTALL) $(INSTALL_LIB_OPTS)
INSTALL_DATA = $(INSTALL) $(INSTALL_DATA_OPTS)

# What's common to all installs
INSTALL_OPTS= $(EXTRA_INSTALL_OPTS)

BIN_PERMS = 755
LIB_PERMS = 644

INSTALL_BIN_OPTS  = -m $(BIN_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_BIN_OPTS)
INSTALL_LIB_OPTS  = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_LIB_OPTS)
INSTALL_DATA_OPTS = -m $(LIB_PERMS) $(INSTALL_OPTS) $(EXTRA_INSTALL_DATA_OPTS)

.PHONY: in-place config-pkgs mk-version-symlinks install-dirs install

config-pkgs ::
	@echo "Configuring $(package), version $(version), on $(platform) ..."
126
	@for i in $(PACKAGE_PRL_SCRIPTS); do \
sof's avatar
sof committed
127
128
	   echo "Creating a configured version of $$i .."; \
	   $(RM) bin/$(platform)/$(package)-$(version)/$$i.bak; \
129
	   if [ -f bin/$(platform)/$(package)-$(version)/$$i ]; then $(MV) bin/$(platform)/$(package)-$(version)/$$i bin/$(platform)/$(package)-$(version)/$$i.bak; fi; \
sof's avatar
sof committed
130
	   echo "#! $(PERL)"  		        		> bin/$(platform)/$(package)-$(version)/$$i ; \
131
132
133
134
135
136
	   echo '$$'"bindir='$(bindir)';"                        >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"libdir='$(real_libdir)';"                   >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"libexecdir='$(real_libdir)';"               >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"datadir='$(real_datadir)';"                 >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"SED='$(SED)';"		>> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"RAWCPP='$(RAWCPP)';"		>> bin/$(platform)/$(package)-$(version)/$$i ; \
sof's avatar
sof committed
137
	   cat bin/$(platform)/$(package)-$(version)/$$i.prl   >> bin/$(platform)/$(package)-$(version)/$$i ; \
sof's avatar
sof committed
138
139
140
	   $(CHMOD) $(BIN_PERMS) bin/$(platform)/$(package)-$(version)/$$i; \
	   echo "Done."; \
	done
141
	@for i in $(PACKAGE_LIB_PRL_SCRIPTS); do \
sof's avatar
sof committed
142
143
	   echo "Creating a configured version of $$i .."; \
	   $(RM) lib/$(platform)/$(package)-$(version)/$$i.bak; \
144
	   if [ -f lib/$(platform)/$(package)-$(version)/$$i ]; then $(MV) lib/$(platform)/$(package)-$(version)/$$i lib/$(platform)/$(package)-$(version)/$$i.bak; fi; \
sof's avatar
sof committed
145
	   echo "#! $(PERL)"                      > lib/$(platform)/$(package)-$(version)/$$i ; \
146
147
148
149
150
151
	   echo '$$'"bindir='$(bindir)';"          >> lib/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"libdir='$(real_libdir)';"     >> lib/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"libexecdir='$(real_libdir)';" >> lib/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"datadir='$(real_datadir)';"   >> lib/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"SED='$(SED)';"		 >> lib/$(platform)/$(package)-$(version)/$$i ; \
	   echo '$$'"RAWCPP='$(RAWCPP)';"		 >> lib/$(platform)/$(package)-$(version)/$$i ; \
sof's avatar
sof committed
152
	   cat lib/$(platform)/$(package)-$(version)/$$i.prl >> lib/$(platform)/$(package)-$(version)/$$i; \
sof's avatar
sof committed
153
154
155
	   $(CHMOD) $(BIN_PERMS) lib/$(platform)/$(package)-$(version)/$$i; \
	   echo "Done."; \
	done
156
157
158
	@for i in $(PACKAGE_SH_SCRIPTS); do \
	   echo "Creating a configured version of $$i .."; \
	   $(RM) bin/$(platform)/$(package)-$(version)/$$i.bak; \
159
	   if [ -f bin/$(platform)/$(package)-$(version)/$$i ]; then $(MV) bin/$(platform)/$(package)-$(version)/$$i bin/$(platform)/$(package)-$(version)/$$i.bak; fi; \
160
	   echo "#! $(SH)"                      > bin/$(platform)/$(package)-$(version)/$$i ; \
161
162
163
164
165
166
	   echo "bindir='$(bindir)'"          >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo "libdir='$(real_libdir)'"     >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo "libexecdir='$(real_libdir)'" >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo "datadir='$(real_datadir)'"   >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo "SED='$(SED)'"			 >> bin/$(platform)/$(package)-$(version)/$$i ; \
	   echo "RAWCPP='$(RAWCPP)'"		 >> bin/$(platform)/$(package)-$(version)/$$i ; \
167
168
169
170
	   cat bin/$(platform)/$(package)-$(version)/$$i.sh >> bin/$(platform)/$(package)-$(version)/$$i; \
	   $(CHMOD) $(BIN_PERMS) bin/$(platform)/$(package)-$(version)/$$i; \
	   echo "Done."; \
	done
171
172


sof's avatar
sof committed
173
mk-version-symlinks ::
174
175
176
177
178
	@for i in $(VERSION_SYMLINKS_FOR) ""; do \
	  if [ "x$$i" != "x" ]; then \
	     echo "Symlinking $$i to $$i-$(version)"; \
	     (cd bin/$(platform)/$(package)-$(version); $(RM) $$i-$(version); $(LN_S) $$i $$i-$(version) ); \
	  fi;\
sof's avatar
sof committed
179
	done
180

sof's avatar
sof committed
181
182
183
184
in-place ::
	$(MAKE) $(MFLAGS) config-pkgs bindir=`pwd`/bin/$(platform)/$(package)-$(version) libdir=`pwd`/lib/$(platform) datadir=`pwd`/share/$(package)-$(version)
	$(MAKE) $(MFLAGS) mk-version-symlinks
	@echo "Finished configuring..to use, add `pwd`/bin/$(platform)/$(package)-$(version) to your PATH."
185

sof's avatar
sof committed
186
187
install-dirs ::
	$(INSTALL_DIR) $(bindir)
sof's avatar
sof committed
188
	(cd lib/$(platform)/$(package)-$(version); find . -type d -exec sh -c '../../../$(INSTALL_DIR) $$0 $(real_libdir)/$$0' {} \; )
sof's avatar
sof committed
189
	(cd share/$(package)-$(version); find . -type d -exec sh -c '../../$(INSTALL_DIR) $(real_datadir)/$$0' {} \; )
190

sof's avatar
sof committed
191
install :: config-pkgs mk-version-symlinks install-dirs install-bin install-libs install-datas
192

sof's avatar
sof committed
193
.PHONY: install-bin install-libs install-datas
194

sof's avatar
sof committed
195
install-bin:
196
	for i in $(PACKAGE_BIN_INSTALL); do \
sof's avatar
sof committed
197
	   $(INSTALL_BIN) bin/$(platform)/$(package)-$(version)/$$i $(bindir); \
198
	done;
sof's avatar
sof committed
199
	for i in $(VERSION_SYMLINKS_FOR) ""; do \
200
201
202
203
204
205
206
	   if [ "x$$i" != "x" ]; then 		\
	   	( cd $(bindir); 		\
		  $(RM) $$i-$(version);		\
		  $(MV) $$i $$i-$(version);	\
		  $(LN_S) $$i-$(version) $$i	\
		); 				\
	   fi; 					\
sof's avatar
sof committed
207
	done
208
209


sof's avatar
sof committed
210
install-libs:
sof's avatar
sof committed
211
	(cd lib/$(platform)/$(package)-$(version); find . -type f -exec sh -c '$(CP) $$0 $(real_libdir)/$$0' {} \; )
212

sof's avatar
sof committed
213
install-datas:
sof's avatar
sof committed
214
	(cd share/$(package)-$(version); find . -type f -exec sh -c '$(INSTALL_DATA) $$0 $(real_datadir)/$$0' {} \; )
215

sof's avatar
sof committed
216
217
218
219
220
show-install-setup:
	@echo "Install setup..."
	@echo "bindir  = $(bindir)"
	@echo "libdir  = $(libdir) (real_libdir  = $(real_libdir))"
	@echo "datadir = $(datadir) (real_datadir = $(real_datadir))"
221

sof's avatar
sof committed
222
223
224
225
#
# Documentation targets, install-docs for the whole lot, or
# install-{dvi,html,info}
#
226

sof's avatar
sof committed
227
.PHONY: show-install-setup install-docs install-html install-info install-dirs-dvi install-dirs-html install-dirs-info
228

sof's avatar
sof committed
229
install-docs : install-html install-dvi install-info
230
231

install-dvi: install-dirs-dvi
sof's avatar
sof committed
232
	$(INSTALL_DATA) dvi/$(package)-$(version)/* $(dvidir)
233
234

install-info: install-dirs-info
sof's avatar
sof committed
235
	$(INSTALL_DATA) info/$(package)-$(version)/* $(infodir)
236
237

install-html: install-dirs-html
sof's avatar
sof committed
238
239
240
241
242
243
244
245
246
247
	$(INSTALL_DATA) html/$(package)-$(version)/* $(htmldir)

install-dirs-html:
	$(INSTALL_DIR) $(htmldir) 

install-dirs-info:
	$(INSTALL_DIR) $(infodir) 

install-dirs-dvi:
	$(INSTALL_DIR) $(dvidir) 
248