+rename/ParseType.hs : rename/ParseType.y
+ @$(RM) rename/ParseType.hs rename/ParseType.hinfo
+ $(HAPPY) $(HAPPY_OPTS) -g rename/ParseType.y
+ @chmod 444 rename/ParseType.hs
+
+rename/ParseUnfolding.hs : rename/ParseUnfolding.y
+ @$(RM) rename/ParseUnfolding.hs rename/ParseUnfolding.hinfo
+ $(HAPPY) $(HAPPY_OPTS) -g rename/ParseUnfolding.y
+ @chmod 444 rename/ParseUnfolding.hs
+
+#----------------------------------------------------------------------
+#
+# Building the stand-alone parser
+#
+all :: hsp
+
+hsp: parser/printtree.o parser/main.o libhsp.a
+ $(CC) -o $@ $(CC_OPTS) $^
+
+CLEAN_FILES += hsp
+#-----------------------------------------------------------------------------
+# Interface files
+
+# LoopHack.lhc is an SLPJ addition to fix a profiling problem. See comments
+# inside it. (compilation is handled by the suffix rules).
+
+#
+# Building the loop breakers from .lhi (0.2x) or .hi-boot (2.xx) files
+#
+ifeq ($(Ghc2_0),YES)
+
+BOOT_HI_STEMS = $(basename $(wildcard */*.hi-boot))
+
+hi-boot ::
+ @for n in $(BOOT_HI_STEMS); \
+ do \
+ echo Creating $$n.hi ; \
+ $(RM) $$n.hi ; \
+ $(CP) $$n.hi-boot $$n.hi || ( $(RM) $$n.hi && exit 1 ) ; \
+ done
+#
+# Have the collector *Loop.hs interface files be generated just after having
+# created the .hi's from the .hi-boot's.
+
+hi-boot :: $(patsubst %.hs,%.hi,$(LOOPS_HS))
+
+else
+%.hi : %.lhi
+ $(RM) $@
+ $(UNLIT) $< $@ || ( $(RM) $@ && exit 1 )
+ @chmod 444 $@
+endif
+
+boot :: hi-boot
+
+#-----------------------------------------------------------------------------
+# Linking
+
+SRC_LD_OPTS += -no-link-chk
+
+# Build-specific
+#SRC_LD_OPTS += "-pgml time gcc -B/projects/unsupported/gnu/sparc-sunos5/bin/g"
+
+
+#-----------------------------------------------------------------------------
+# install
+
+# We don't want hsc treated as an ordinary executable,
+# but put it together with the libraries.
+# Also don't want any interface files intstalled
+
+INSTALL_LIBEXECS += hsc hsp
+
+#-----------------------------------------------------------------------------
+# depend
+
+# If we're using a 1.2 compiler to compile the compiler, need the old mkdepend stuff
+#
+# ToDo: define sep MKDEPENDHS_1.2 variable so that it can be readily overridden
+# in a build.mk file.
+#
+ifeq ($(Ghc2_0),NO)
+MKDEPENDHS = $(MKDEPENDHS_1_2)
+endif
+
+#
+# Before doing `make depend', need to build all derived Haskell source files
+#
+depend :: $(LOOPS) $(SRCS_UGNHS) rename/ParseIface.hs rename/ParseUnfolding.hs rename/ParseType.hs
+
+
+ifeq "$(GhcWithHscBuiltViaC)" "YES"
+SRC_MKDEPENDHS_OPTS += -o .hc
+# When booting from .hc, (hackily) remove the suffix rule for
+# .l?hs -> .o, so that the .hc -> .o is used instead.
+%.$(way_)o : %.lhs
+%.$(way_)o : %.hs
+else
+ SRCS_MKDEPENDHS = $(SRCS_HC) # should add $(LOOPS) ?
+endif
+
+
+#-----------------------------------------------------------------------------
+# clean
+
+CLEAN_FILES += $(wildcard */*.$(way_)o */*.$(way_)hi) \
+ $(SRCS_UGNC) $(SRCS_UGNH) \
+ $(SRCS_UGNHS)\
+ parser/hslexer.c parser/hsparser.tab.h parser/hsparser.tab.c
+
+# Extra tidy, remove the .hc files (if you've got them).
+MAINTAINER_CLEAN_FILES += $(wildcard */*.hc)
+
+
+#-----------------------------------------------------------------------------
+# TAGS
+
+SRC_HSTAGS_OPTS += -fglasgow-exts -cpp
+
+
+#-----------------------------------------------------------------------------
+# Include target-rule boilerplate
+
+include $(TOP)/mk/target.mk
+
+
+#