6f8fe79c051aeb7f926222a4e4ac734632e3149e
[ghc-hetmet.git] / ghc / utils / mkdependHS / Makefile
1 TOP=../..
2 include $(TOP)/mk/boilerplate.mk
3 include $(TOP)/mk/version.mk
4 INSTALLING=0
5
6 boot :: all
7
8 SCRIPT_PROG=mkdependHS
9 SCRIPT_OBJS=mkdependHS.prl
10 SCRIPT_SUBST_VARS= \
11  TOP_PWD \
12  INSTALLING \
13  RAWCPP \
14  HscIfaceFileVersion
15
16 INTERP=perl
17
18 #
19 # install setup
20 #
21 INSTALL_LIB_SCRIPTS += $(SCRIPT_PROG)
22
23 ifneq "$(BIN_DIST)" "1"
24 SCRIPT_SUBST_VARS += libdir datadir TMPDIR SED
25 endif
26
27
28 #
29 # Prepend an infomercial if installing (binary-dist or the real thing).
30 #
31 ifeq "$(INSTALLING)" "1"
32 ifeq "$(BIN_DIST)" "1"
33 SCRIPT_PREFIX_FILES += prefix.txt
34 endif
35 endif
36
37 ifeq "$(INSTALLING)" "1"
38 TOP_PWD:=$(prefix)
39 else
40 TOP_PWD:=$(FPTOOLS_TOP_ABS)
41 endif
42
43 #
44 # Before really installing the script, we have to
45 # reconfigure it such that the paths it refers to,
46 # point to the installed utils.
47 #
48 install ::
49         $(RM) $(SCRIPT_PROG)
50         $(MAKE) $(MFLAGS) INSTALLING=1 $(SCRIPT_PROG)
51
52 CLEAN_FILES += $(SCRIPT_PROG) $(SCRIPT_LINK)
53
54 include $(TOP)/mk/target.mk
55
56 #
57 # Hack to re-create the in-situ build tree script after 
58 # having just installed it (if you don't, confusion ensues
59 # if you try to use the build tree copy afterwards..)
60 #
61 install ::
62         @$(RM) $(SCRIPT_PROG)
63         @$(MAKE) $(MFLAGS) BIN_DIST=0 INSTALLING=0 $(SCRIPT_PROG)