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