Makefile 1.85 KB
Newer Older
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
COMPILER	?= ocamlbuild
ROOTDIR		?= ../..
SRCDIR		?= src
EXTDIR		?= $(SRCDIR)/externals

LIBFLAGS	?= -libs nums,netstring,pcre,ulexing\
 -lflags -I,`ocamlfind query netstring` -lflags -I,`ocamlfind query pcre`\
 -lflags -I,`ocamlfind query ulex`
DEBUGFLAGS	?= -cflags -g -lflags -g

INEXTFILES	= misc/custom.ml misc/encodings.ml misc/upool.ml misc/ns.ml\
 types/sortedList.ml types/ident.ml misc/html.ml types/sequence.ml\
 types/patterns.ml parser/cduce_loc.mli parser/cduce_loc.ml typing/typed.ml\
 types/builtin_defs.ml parser/ast.ml typing/typepat.mli typing/typepat.ml\
 types/externals.mli types/externals.ml typing/typer.ml\
 runtime/run_dispatch.ml runtime/explain.ml schema/schema_pcre.ml\
 schema/schema_xml.mli schema/schema_xml.ml schema/schema_common.mli\
 schema/schema_common.ml runtime/eval.mli runtime/eval.ml compile/compile.ml\
 types/compunit.mli types/compunit.ml types/var.ml types/boolVar.ml\
 misc/imap.ml types/atoms.ml types/intervals.ml types/chars.mli types/chars.ml\
 misc/bool.mli misc/bool.ml types/types.mli misc/stats.mli misc/stats.ml\
 types/normal.mli types/normal.ml misc/pretty.mli misc/pretty.ml\
 types/types.ml compile/auto_pat.mli runtime/value.mli runtime/value.ml\
 schema/schema_types.mli schema/schema_validator.mli schema/schema_builtin.mli\
 schema/schema_builtin.ml schema/schema_validator.ml compile/lambda.ml
EXTFILES	= $(INEXTFILES:%=$(ROOTDIR)/%)

RM		?= rm -f
OUT		?= main.native
OUTDEBUG	?= main.byte

.PHONY: clean check test _import

all: _import
	$(COMPILER) -use-ocamlfind $(LIBFLAGS) $(OUT)

debug: _import
	$(COMPILER) -use-ocamlfind $(DEBUGFLAGS) $(LIBFLAGS) $(OUTDEBUG)

_import:
	@echo -n "Copying external files..."
	@test -d $(EXTDIR) || mkdir $(EXTDIR)
	@cp $(EXTFILES) $(EXTDIR)
	@echo "done"

clean:
	$(COMPILER) -clean
	test $(EXTDIR) = "src" || test $(EXTDIR) = "." || $(RM) -r $(EXTDIR)

check: test

test: all
	tests/test.sh