Makefile
1.32 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
57
58
59
60
61
62
63
64
65
66
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))
# XXX/output.pl produces fz-XXX, the flatzinc-to-XXX compiler
FZBACKS = $(patsubst %/output.pl,%,$(wildcard */output.pl))
FZSEM = $(patsubst %/output.pl,fz-%,$(wildcard */output.pl))
FZPLFILES = $(foreach B,$(FZBACKS),$(wildcard $B/*.pl))
FZOFILES = $(patsubst %.pl,%.o,$(FZPLFILES))
FZAFILES = $(patsubst %,lib%.a,$(FZBACKS))
# 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) $(FZOFILES) $(FZAFILES)
fzp: $(OBJ)
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB)
fz-%: $(PLOFILES) lib%.a
$(GPLC) -o $@ $+
lib%.a: $(FZOFILES)
ar rv $@ $+
%.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) $(PLOFILES) \
$(FZOFILES) $(FZAFILES) \
$(GENCFILES) $(OTHER) core
clobber: clean
$(RM) $(EXE_FILE)
.PHONY: distclean
distclean: clobber