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