-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
66 lines (51 loc) · 1.53 KB
/
Makefile
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
GHC=ghc
GHCFLAGS += -Wall
RUNGHC=runghc
RUNGHCFLAGS=-Wall -fno-warn-unused-imports
HAPPY=happy
HAPPYFLAGS=-agci
ALEX=alex
ALEXFLAGS=-gi
LIBSRC = $(shell find Language -type f) \
dist/build/Language/C/Parser/Lexer.hs \
dist/build/Language/C/Parser/Parser.hs
#
# To support cabal sandbox
#
ifneq ($(wildcard .cabal-sandbox/*-packages.conf.d),)
GHCFLAGS += \
-no-user-package-db \
-package-db $(wildcard .cabal-sandbox/*-packages.conf.d)
RUNGHCFLAGS += \
-no-user-package-db \
-package-db --ghc-arg=$(wildcard .cabal-sandbox/*-packages.conf.d)
endif
#
# Support Cabal's MIN_VERSION
#
GHCFLAGS += -DFULL_HASKELL_ANTIQUOTES -I. -optP-include -optPdist/build/autogen/cabal_macros.h
.PHONY : all
all : Language/C/Syntax-instances.hs
.PHONY : clean
clean :
rm -rf parse obj \
dist/build/Language/C/Parser/Lexer.hs \
dist/build/Language/C/Parser/Parser.hs
dist/build/autogen/cabal_macros.h :
cabal build
dist/build/Language/C/Parser/Parser.hs : Language/C/Parser/Parser.y dist/build/autogen/cabal_macros.h
$(HAPPY) $(HAPPYFLAGS) -o $@ $<
dist/build/Language/C/Parser/Lexer.hs : Language/C/Parser/Lexer.x dist/build/autogen/cabal_macros.h
$(ALEX) $(ALEXFLAGS) -o $@ $<
Language/C/Syntax-instances.hs : bin/gen-instances.hs bin/Derive.hs
$(RUNGHC) $(RUNGHCFLAGS) -ibin -DONLY_TYPEDEFS $< > $@ || rm -f $@
test : Test.hs $(LIBSRC)
@mkdir -p obj
$(GHC) $(GHCFLAGS) --make $< -odir obj -hidir obj \
-i. -idist/build \
-o $@
neg : Neg.hs $(LIBSRC)
@mkdir -p obj
$(GHC) $(GHCFLAGS) --make $< -odir obj -hidir obj \
-i. -idist/build \
-o $@