6350a011b250e0ef8ce736c696213dc9558e9f8d
[ghc-hetmet.git] / ghc / utils / hstags / Makefile
1 TOP=../..
2 include $(TOP)/mk/boilerplate.mk
3
4 # No ways
5 WAYS=
6
7 # Note: might be overridden from cmd-line (see install rule below)
8 INSTALLING=0
9
10 C_PROG=hstags-help
11
12 SCRIPT_PROG=hstags
13 SCRIPT_OBJS=hstags.prl
14
15 SCRIPT_SUBST_VARS=\
16  INSTALLING \
17  TMPDIR \
18  TOP_PWD \
19  PROJECTVERSION
20
21 ifneq "$(BIN_DIST)" "1"
22 SCRIPT_SUBST_VARS += INSTLIBDIR_GHC
23 endif
24
25 #
26 # The hstags script is configured with different
27 # set of config variables, depending on whether it
28 # is to be installed or not.
29 #
30 ifeq "$(INSTALLING)" "1"
31 TOP_PWD := $(prefix)
32 ifeq "$(BIN_DIST)" "1"
33 SCRIPT_PREFIX_FILES += prefix.txt
34 else
35 INSTLIBDIR_GHC=$(libdir)
36 endif
37 else
38 TOP_PWD := $(FPTOOLS_TOP_ABS)
39 INSTLIBDIR_GHC=$(libdir)
40 HSP_IMPORTS:="$(TOP_PWD)/ghc/lib/ghc":"$(TOP_PWD)/ghc/lib/required":"$(TOP_PWD)/ghc/lib/glaExts":"$(TOP_PWD)/ghc/lib/concurrent"
41 SCRIPT_SUBST_VARS += HSP_IMPORTS
42 endif
43
44 #
45 # no INTERP: do *not* want #! script stuck on the front
46 #
47 # what's the deal? I'll add it for now (and perhaps pay for it later :-)
48 #  -- SOF
49 INTERP=$(PERL)
50
51 #
52 # install setup
53 #
54 INSTALL_PROGS=$(SCRIPT_PROG)
55 INSTALL_LIBEXECS=$(C_PROG)
56
57 #
58 # Before really installing the script, we have to
59 # reconfigure it such that the paths it refers to,
60 # point to the installed utils.
61 #
62 install ::
63         @$(RM) $(SCRIPT_PROG)
64         @$(MAKE) $(MFLAGS) INSTALLING=1 $(SCRIPT_PROG)
65
66
67 CLEAN_FILES += $(SCRIPT_PROG)
68 include $(TOP)/mk/target.mk
69
70
71 # Hack to re-create the in-situ build tree script after 
72 # having just installed it.
73 #
74 install ::
75         @$(RM) $(SCRIPT_PROG)
76         @$(MAKE) $(MFLAGS) BIN_DIST=0 $(SCRIPT_PROG)
77