options: rename --defines as --header
[bison.git] / examples / c / bistromathic / Makefile
blob9efeeb8d30df165bdd007277c8121500c52fb8f0
1 # This Makefile is designed to be simple and readable. It does not
2 # aim at portability. It requires GNU Make.
4 BASE = bistromathic
5 BISON = bison
6 XSLTPROC = xsltproc
8 # We need to find the headers and libs for readline (and possibly intl).
9 # You probably need to customize this for your own environment.
10 CPPFLAGS = -I/opt/local/include
11 LDFLAGS = -L/opt/local/lib
13 # Find the translation catalogue for Bison's generated messagess.
14 BISON_LOCALEDIR = $(shell $(BISON) $(BISON_FLAGS) --print-localedir)
15 CPPFLAGS += -DENABLE_NLS -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
17 LIBS = -lreadline -lm # In some environments, -lintl is needed.
19 all: $(BASE)
21 %.c %.h %.xml %.gv: %.y
22 $(BISON) $(BISONFLAGS) --header --xml --graph=$*.gv -o $*.c $<
24 $(BASE): parse.o
25 $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
27 run: $(BASE)
28 @echo "Type bistromathic expressions. Quit with ctrl-d."
29 ./$<
31 html: $(BASE).html
32 %.html: %.xml
33 $(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
35 CLEANFILES = \
36 $(BASE) *.o \
37 parse.[ch] parse.output parse.xml parse.html parse.gv
39 clean:
40 rm -f $(CLEANFILES)