Makefile 1013 Bytes
Newer Older
Taddeüs Kroes's avatar
Taddeüs Kroes committed
1
RESULT    := mincss
2 3 4
PRE_TGTS  := types
MODULES   := util stringify parser lexer parse color main
ALL_NAMES := $(PRE_TGTS) $(MODULES)
5

Taddeüs Kroes's avatar
Taddeüs Kroes committed
6
OCAMLCFLAGS  := -g
7
OCAMLLDFLAGS :=
Taddeüs Kroes's avatar
Taddeüs Kroes committed
8 9 10 11
OCAMLLDLIBS  := str.cmxa

OCAMLLEX  := ocamllex
OCAMLYACC := menhir --infer --explain --dump
12

13
.PHONY: all clean
14
.PRECIOUS: $(addprefix .cmi,$(ALL_NAMES))
15

16
all: $(RESULT)
17

18
%.ml: %.mll
Taddeüs Kroes's avatar
Taddeüs Kroes committed
19
	$(OCAMLLEX) -o $@ $<
20

21
%.ml: %.mly
Taddeüs Kroes's avatar
Taddeüs Kroes committed
22
	$(OCAMLYACC) $<
23

24 25
%.cmi: %.mli
	ocamlc -c $(OCAMLCFLAGS) -o $@ $<
26

27 28 29
%.cmx: %.ml
	ocamlfind ocamlopt -package batteries -c $(OCAMLCFLAGS) -o $@ $(<:.cmi=.ml)

30
$(RESULT): $(addsuffix .cmx,$(ALL_NAMES))
31 32
	ocamlopt -o $@ $(OCAMLLDFLAGS) $(OCAMLLDLIBS) $^

Taddeüs Kroes's avatar
Taddeüs Kroes committed
33
# intra-module dependencies
Taddeüs Kroes's avatar
Taddeüs Kroes committed
34 35
lexer.cmi: lexer.ml
parser.cmx: parser.cmi lexer.cmi
Taddeüs Kroes's avatar
Taddeüs Kroes committed
36
parser.mli: parser.ml
Taddeüs Kroes's avatar
Taddeüs Kroes committed
37
parse.cmx: lexer.cmi parser.cmx
38
main.cmx: parse.cmx util.cmx color.cmx
39
util.cmx: OCAMLCFLAGS += -pp cpp
40
$(addsuffix .cmx,$(MODULES)): $(addsuffix .cmi,$(PRE_TGTS))
Taddeüs Kroes's avatar
Taddeüs Kroes committed
41

42
clean:
43 44
	rm -f *.cmi *.cmx *.o lexer.ml parser.ml parser.mli parser.conflicts \
		parser.automaton $(RESULT)