fart/parser/Makefile
Josh Holtrop dcbdf4e2ec updated parser Makefile to include dependency information
git-svn-id: svn://anubis/fart/trunk@105 7f9b0f55-74a9-4bce-be96-3c2cd072584d
2009-02-16 01:21:28 +00:00

46 lines
838 B
Makefile

FLEX := flex
BISON := bison
PARSER := parser
COBJS := lex.yy.o
CXXOBJS := $(PARSER).tab.o
OBJS := $(COBJS) $(CXXOBJS)
all: $(OBJS)
%.o: %.c
$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
%.o: %.cc
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
$(PARSER).tab.cc $(PARSER).tab.hh: $(PARSER).yy
$(BISON) -d $<
lex.yy.o: lex.yy.c
lex.yy.c: $(PARSER).tab.hh
lex.yy.c: $(PARSER).lex
$(FLEX) $<
# Make dependency files
%.dep: %.c
@set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.dep: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
-rm -f lex.yy.c $(PARSER).tab.cc $(PARSER).tab.hh *~ *.o *.dep
# Include dependency files
include $(OBJS:.o=.dep)