summaryrefslogtreecommitdiff
path: root/rules/hs-suffix-rules-srcdir.mk
blob: e909db5b4237349ed7e287ef464f9ce706662859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------


define hs-suffix-rules-srcdir
# args: $1 = dir,  $2 = distdir, $3 = srcdir

# Preprocessing Haskell source

ifneq "$$(BINDIST)" "YES"

$1/$2/build/%.hs : $1/$3/%.ly | $$$$(dir $$$$@)/.
	$$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@

$1/$2/build/%.hs : $1/$3/%.y | $$$$(dir $$$$@)/.
	$$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@

$1/$2/build/%.hs : $1/$2/build/%.ly | $$$$(dir $$$$@)/.
	$$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@

$1/$2/build/%.hs : $1/$2/build/%.y | $$$$(dir $$$$@)/.
	$$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@

$1/$2/build/%.hs : $1/$3/%.x | $$$$(dir $$$$@)/.
	$$(call cmd,ALEX) $$($1_$2_ALL_ALEX_OPTS) $$< -o $$@

$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$3/%.hsc $$$$(hsc2hs_INPLACE) | $$$$(dir $$$$@)/.
	$$(call cmd,hsc2hs_INPLACE) $$($1_$2_ALL_HSC2HS_OPTS) $$< -o $$@

# Now the rules for hs-boot files.

$1/$2/build/%.hs-boot : $1/$3/%.hs-boot
	"$$(CP)" $$< $$@

$1/$2/build/%.lhs-boot : $1/$3/%.lhs-boot
	"$$(CP)" $$< $$@

endif

endef