Makefile 1.15 KB
Newer Older
Taddeüs Kroes's avatar
Taddeüs Kroes committed
1
RESULT    := mincss
2
PRE_TGTS  := types
Taddeüs Kroes's avatar
Taddeüs Kroes committed
3
MODULES   := color_names util stringify parser lexer parse selector color \
4
             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

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

17
all: $(RESULT)
18

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

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

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

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

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

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

45
clean:
46 47
	rm -f *.cmi *.cmx *.o lexer.ml parser.ml parser.mli parser.conflicts \
		parser.automaton $(RESULT)