-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (49 loc) · 2.05 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
include Makefile.common
INCLUDES=-I $(LLVMOCAMLLIB) -I parsing -I typing -I codegen -I dyn
OCAMLFLAGS=-g $(INCLUDES)
OCAMLOPTFLAGS=-warn-error P -g $(INCLUDES)
OCAMLLLVMFLAGS=-cclib -lstdc++ -cclib -L. -cclib -lruntime \
llvm.cmxa llvm_executionengine.cmxa llvm_target.cmxa llvm_scalar_opts.cmxa \
llvm_analysis.cmxa llvm_bitwriter.cmxa llvm_bitreader.cmxa
CFLAGS=-I runtime
SUBDIRS=parsing typing runtime codegen dyn .
PARSING=parsing/ast.cmx parsing/parser.cmi parsing/parser.cmx parsing/lexer.cmx \
parsing/parse.cmx parsing/elaborate.cmx
TYPING=typing/types.cmx typing/typing.cmx typing/gamma.cmx typing/subst.cmx \
typing/operations.cmx typing/unify.cmx typing/texpr.cmx typing/inferBasic.cmx
CODEGEN=codegen/cgil.cmx codegen/lambda_lifting.cmx codegen/currying.cmx \
codegen/monomorphize.cmx codegen/semant.cmx codegen/codegen.cmx \
codegen/llvm_codegen.cmx
DYNAMIC=dyn/lambda.cmx dyn/value.cmx dyn/initialBasis.cmx dyn/runtime.cmx dyn/eval.cmx \
dyn/dynpipeline.cmx dyn/main.cmx
TL_OBJS=utils.cmx $(PARSING) $(TYPING) $(CODEGEN) pipeline.cmx main.cmx
DTL_OBJS=utils.cmx $(PARSING) $(DYNAMIC)
RUNTIME=libruntime$(DLLEXT)
all: tensorlang dyntl
tensorlang: $(TL_OBJS) initial_basis.bc $(RUNTIME)
$(OCAMLOPT) -o $@ $(OCAMLOPTFLAGS) $(OCAMLLLVMFLAGS) $(filter %.cmx, $(TL_OBJS))
dyntl: $(DTL_OBJS)
$(OCAMLOPT) -o $@ $(OCAMLOPTFLAGS) $(filter %.cmx, $(DTL_OBJS))
$(RUNTIME) : runtime/runtime.o
gcc $(CFLAGS) $< `$(LLVMCONFIG) --ldflags --libs` -shared -o $@
scratch: test
./test > scratch.ll 2>&1
llc scratch.ll
gcc scratch.s -o scratch
clean:
rm -f tensorlang dyntl
rm -f parsing/parser.ml parsing/parser.mli parsing/lexer.ml parsing/lexer.mli parsing/parser.output
for dir in $(SUBDIRS); do \
rm -f $$dir/*.cm[iox] $$dir/*.o *~; \
rm -f $$dir/*.so $$dir/*.tar.*; \
rm -f $$dir/*.s \
rm -f scratch* \
rm -f a.out \
rm -f $$dir/*.ll $$dir/*.bc; \
done
tar: clean
tar -czf $(OUTPUT).tar.gz *
# Dependencies
depend:
$(OCAMLDEP) $(INCLUDES) *.mli *.ml > .depend
#include .depend