Commit 2ae2c2a3a42a029de29c28deee2d965199bccd7c
1 parent
aa862a87
Exists in
master
allow for multiple back-end targets; keep .o files from Prolog
Showing
1 changed file
with
11 additions
and
4 deletions
Show diff stats
fz/Makefile
@@ -3,7 +3,11 @@ OBJ = flatzinc.tab.o | @@ -3,7 +3,11 @@ OBJ = flatzinc.tab.o | ||
3 | GENCFILES = flatzinc.tab.c lex.yy.c | 3 | GENCFILES = flatzinc.tab.c lex.yy.c |
4 | OTHER = flatzinc.output | 4 | OTHER = flatzinc.output |
5 | 5 | ||
6 | -PLFILES = $(wildcard *.pl) | 6 | +PLFILES = $(filter-out out-%.pl,$(wildcard *.pl)) |
7 | +PLOFILES = $(patsubst %.pl,%.o,$(PLFILES)) | ||
8 | + | ||
9 | +# out-XXX.pl produces fz-XXX, the flatzinc-to-XXX compiler | ||
10 | +FZSEM = $(patsubst out-%.pl,fz-%,$(wildcard out-*.pl)) | ||
7 | 11 | ||
8 | # NOTE: we need to pass the `-l' flag to ensure the scanner internal | 12 | # NOTE: we need to pass the `-l' flag to ensure the scanner internal |
9 | # variable `yylineno' is available. | 13 | # variable `yylineno' is available. |
@@ -25,13 +29,16 @@ RM = /bin/rm -f | @@ -25,13 +29,16 @@ RM = /bin/rm -f | ||
25 | %.ast:: %.fzn | 29 | %.ast:: %.fzn |
26 | fzp < $< > $@ | 30 | fzp < $< > $@ |
27 | 31 | ||
28 | -all: fzp fzsem | 32 | +all: fzp $(FZSEM) $(PLOFILES) $(patsubst %.pl,%.o,$(wildcard out-*.pl)) |
29 | 33 | ||
30 | fzp: $(OBJ) | 34 | fzp: $(OBJ) |
31 | $(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB) | 35 | $(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB) |
32 | 36 | ||
33 | -fzsem: $(PLFILES) | ||
34 | - $(GPLC) -o $@ $(PLFILES) | 37 | +fz-%: out-%.o $(PLOFILES) |
38 | + $(GPLC) -o $@ $+ | ||
39 | + | ||
40 | +%.o: %.pl | ||
41 | + $(GPLC) $(GPLCFLAGS) -c $< | ||
35 | 42 | ||
36 | flatzinc.tab.c: flatzinc.y lex.yy.c | 43 | flatzinc.tab.c: flatzinc.y lex.yy.c |
37 | $(YACC) $(YACCFLAGS) flatzinc.y | 44 | $(YACC) $(YACCFLAGS) flatzinc.y |