Makefile 1.31 KB
Newer Older
Taddeüs Kroes's avatar
Taddeüs Kroes committed
1
RESULT    := mincss
2
PRE_TGTS  := types
3 4
MODULES   := color_names util stringify parser lexer parse simple shorthand \
             duplicates main
5
ALL_NAMES := $(PRE_TGTS) $(MODULES)
6

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

OCAMLLEX  := ocamllex
OCAMLYACC := menhir --infer --explain --dump
13
OCAMLOPT_GETOPT := ocamlfind opt -linkpkg -package getopt
14

15
.PHONY: all clean
16
.PRECIOUS: $(addprefix .cmi,$(ALL_NAMES))
17

18
all: $(RESULT)
19

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

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

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

29
%.cmx: %.ml
Taddeüs Kroes's avatar
Taddeüs Kroes committed
30
	ocamlopt -c $(OCAMLCFLAGS) -o $@ $(<:.cmi=.ml)
31

32 33 34
main.cmx: main.ml
	$(OCAMLOPT_GETOPT) -c $(OCAMLCFLAGS) -o $@ $(<:.cmi=.ml)

35
$(RESULT): $(addsuffix .cmx,$(ALL_NAMES))
36
	$(OCAMLOPT_GETOPT) -o $@ $(OCAMLLDFLAGS) $(OCAMLLDLIBS) $^
37

Taddeüs Kroes's avatar
Taddeüs Kroes committed
38
# module dependencies
Taddeüs Kroes's avatar
Taddeüs Kroes committed
39
lexer.cmi: lexer.ml
Taddeüs Kroes's avatar
Taddeüs Kroes committed
40
parser.cmx: parser.cmi lexer.cmx
Taddeüs Kroes's avatar
Taddeüs Kroes committed
41
parser.mli: parser.ml
Taddeüs Kroes's avatar
Taddeüs Kroes committed
42
parse.cmx: lexer.cmi parser.cmx
43
main.cmx: parse.cmx util.cmx simple.cmx shorthand.cmx duplicates.cmx
44
util.cmx: OCAMLCFLAGS += -pp cpp
45 46
util.cmx simple.cmx: color_names.cmx
stringify.cmx parser.cmx simple.cmx shorthand.cmx: util.cmi
47
$(addsuffix .cmx,$(MODULES)): $(addsuffix .cmi,$(PRE_TGTS))
Taddeüs Kroes's avatar
Taddeüs Kroes committed
48

Taddeüs Kroes's avatar
Taddeüs Kroes committed
49 50 51
%.html: %.md
	markdown $^ > $@

52
clean:
53
	rm -f *.cmi *.cmx *.o lexer.ml parser.ml parser.mli parser.conflicts \
Taddeüs Kroes's avatar
Taddeüs Kroes committed
54
		parser.automaton README.html $(RESULT)