Makefile
1.02 KB
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
SRC =
OBJ = flatzinc.tab.o
GENCFILES = flatzinc.tab.c lex.yy.c
OTHER = flatzinc.output
PLFILES = $(filter-out out-%.pl,$(wildcard *.pl))
PLOFILES = $(patsubst %.pl,%.o,$(PLFILES))
# out-XXX.pl produces fz-XXX, the flatzinc-to-XXX compiler
FZSEM = $(patsubst out-%.pl,fz-%,$(wildcard out-*.pl))
# NOTE: we need to pass the `-l' flag to ensure the scanner internal
# variable `yylineno' is available.
#
LEX = flex
LEXFLAGS = -l
LEXLIB =
YACC = bison
YACCFLAGS = -v
CC = gcc
CFLAGS = -g -O
GPLC = gplc
RM = /bin/rm -f
%.ast:: %.fzn
fzp < $< > $@
all: fzp $(FZSEM) $(PLOFILES) $(patsubst %.pl,%.o,$(wildcard out-*.pl))
fzp: $(OBJ)
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB)
fz-%: out-%.o $(PLOFILES)
$(GPLC) -o $@ $+
%.o: %.pl
$(GPLC) $(GPLCFLAGS) -c $<
flatzinc.tab.c: flatzinc.y lex.yy.c
$(YACC) $(YACCFLAGS) flatzinc.y
lex.yy.c: flatzinc.l
$(LEX) $(LEXFLAGS) flatzinc.l
clean:
$(RM) $(OBJ) $(GENCFILES) $(OTHER) core
clobber: clean
$(RM) $(EXE_FILE)
.PHONY: distclean
distclean: clobber