968459116d06d3d43fb71d29369eeb09b7900d0f
[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  ProjectVersionInt
14
15 INTERP=perl
16
17 #
18 # install setup
19 #
20 INSTALL_SCRIPTS += $(SCRIPT_PROG)
21
22 ifneq "$(BIN_DIST)" "1"
23 SCRIPT_SUBST_VARS += libdir datadir RAWCPP TMPDIR SED
24 endif
25
26
27 #
28 # Prepend an infomercial if installing (binary-dist or the real thing).
29 #
30 ifeq "$(INSTALLING)" "1"
31 ifeq "$(BIN_DIST)" "1"
32 SCRIPT_PREFIX_FILES += prefix.txt
33 endif
34 endif
35
36 ifeq "$(INSTALLING)" "1"
37 TOP_PWD:=$(prefix)
38 else
39 TOP_PWD:=$(FPTOOLS_TOP_ABS)
40 endif
41
42 #
43 # Before really installing the script, we have to
44 # reconfigure it such that the paths it refers to,
45 # point to the installed utils.
46 #
47 install ::
48         $(RM) $(SCRIPT_PROG)
49         $(MAKE) $(MFLAGS) INSTALLING=1 $(SCRIPT_PROG)
50
51 CLEAN_FILES += $(SCRIPT_PROG) $(SCRIPT_LINK)
52
53 include $(TOP)/mk/target.mk
54
55 #
56 # Hack to re-create the in-situ build tree script after 
57 # having just installed it (if you don't, confusion ensues
58 # if you try to use the build tree copy afterwards..)
59 #
60 install ::
61         @$(RM) $(SCRIPT_PROG)
62         @$(MAKE) $(MFLAGS) $(SCRIPT_PROG)