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