1# This Makefile is designed to be simple and readable.  It does not
2# aim at portability.  It requires GNU Make.
3
4BASE = calc
5BISON = bison
6XSLTPROC = xsltproc
7
8all: $(BASE)
9
10%.c %.h %.xml %.gv: %.y
11	$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
12
13$(BASE): $(BASE).o
14	$(CC) $(CFLAGS) -o $@ $^
15
16run: $(BASE)
17	@echo "Type arithmetic expressions.  Quit with ctrl-d."
18	./$<
19
20html: $(BASE).html
21%.html: %.xml
22	$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
23
24CLEANFILES =									\
25  $(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
26
27clean:
28	rm -f $(CLEANFILES)
29