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