Makefile 1.14 KB
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))
FZOFILES =      $(patsubst %,%/*.o,$(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)

fzp:	$(OBJ)
	$(CC) $(CFLAGS) -o $@ $(OBJ) $(LEXLIB)

fz-%:	%/output.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) $(PLOFILES) $(FZOFILES) $(GENCFILES) $(OTHER) core

clobber:	clean
		$(RM) $(EXE_FILE)

.PHONY: distclean
distclean: clobber