-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
101 lines (69 loc) · 2.22 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
### Compilers and flags ###
HC = ghc
HFLAGS = -O2 -XPolymorphicComponents -rtsopts
CC = gcc
CFLAGS = -Wall -O2 -finline-functions
STRIP = strip
### Targets ###
ALICE = alice
MOSES = provers/moses
ALICEDIR = Alice
MOSESDIR = moses
BUILDDIR = .build
BUILDOPT = -odir $(BUILDDIR) -hidir $(BUILDDIR)
PROFLOPT = -prof -auto-all -osuf p.o -hisuf p.hi $(BUILDOPT)
COVEROPT = -fhpc -osuf hpc.o -hisuf hpc.hi $(BUILDOPT)
all: $(ALICE) $(MOSES)
prof: $(ALICE).p
hpc: $(ALICE).hpc
.PHONY: all prof hpc $(ALICE) $(ALICE).p $(ALICE).hpc \
source binary getall clean depend
### Alice ###
$(ALICE): $(BUILDDIR)
$(HC) --make $(ALICEDIR)/Main.hs -o $@ $(HFLAGS) $(BUILDOPT)
$(if $(STRIP),$(STRIP) -s $@)
$(ALICE).p: $(BUILDDIR)
$(HC) --make $(ALICEDIR)/Main.hs -o $@ $(HFLAGS) $(PROFLOPT)
$(if $(STRIP),$(STRIP) -s $@)
$(ALICE).hpc: $(BUILDDIR)
$(HC) --make $(ALICEDIR)/Main.hs -o $@ $(HFLAGS) $(COVEROPT)
$(if $(STRIP),$(STRIP) -s $@)
### Moses ###
MOSESSRC = $(wildcard $(MOSESDIR)/*.c)
MOSESOBJ = $(addprefix $(BUILDDIR)/,$(MOSESSRC:.c=.o))
$(MOSES): $(BUILDDIR)/$(MOSESDIR) $(MOSESOBJ)
$(CC) -o $@ $(MOSESOBJ)
$(BUILDDIR)/$(MOSESDIR)/%.o: $(MOSESDIR)/%.c
$(CC) -o $@ $(CFLAGS) -c $<
### Create build directories ###
$(BUILDDIR):
mkdir -p $@
$(BUILDDIR)/$(MOSESDIR):
mkdir -p $@
### Janitory ###
clean:
rm -rf $(ALICE) $(ALICE).p $(ALICE).hpc .hpc $(MOSES) $(BUILDDIR) core
depend:
makedepend -Y -p $(BUILDDIR)/ -- $(CFLAGS) -- $(MOSESDIR)/*.c
rm Makefile.bak
### Release ###
TAR = tar --transform='s=^=$(RELNAME)/='
RELNAME = sad-$(shell git describe | cut -d- -f-2)
RELBIN = $(RELNAME).i386
COMMON = $(SUBDIR) $(TOPDIR)
SUBDIR = Alice moses doc examples
TOPDIR = Makefile COPYING README init.opt
SOURCE = $(COMMON) provers/provers.dat
BINARY = $(SOURCE) alice provers/moses
GETALL = $(COMMON) alice provers
source:
$(TAR) -czf $(RELNAME).tar.gz $(SOURCE)
binary: all
$(TAR) -cjf $(RELBIN).tar.bz2 $(BINARY)
getall: all
$(TAR) -cjf $(RELBIN).tar.bz2 $(GETALL)
# DO NOT DELETE
.ofiles/moses/core.o: moses/core.h moses/env.h moses/main.h moses/term.h
.ofiles/moses/env.o: moses/env.h moses/main.h moses/term.h
.ofiles/moses/main.o: moses/main.h moses/core.h moses/env.h moses/term.h
.ofiles/moses/term.o: moses/env.h moses/main.h moses/term.h