# $Id$ # # common rules for compilation of bison parser generator generated files. # # this file is automatically included if BISON is set # # Variables: # # srcdir ... source directory. # CC ... path of GNU C compiler # BISON ... The path of the bison binary. # BISONFLAGS... Flags to pass to bison # YSOURCES ... list of *.y files to be processed by bison # ABI_CFLAGS... ABI-specific CFLAGS, determined by common-compile.mk # EXT_CFLAGS... pkg-config CFLAGS, determined by common-compile.mk # INCLUDES ... list of optional include directories # CFLAGS ... C options like -Wall -g -O2 # BISONSOURCES=$(addsuffix _bison.c,$(basename $(YSOURCES))) BISONOBJS=$(addsuffix _bison.o,$(basename $(YSOURCES))) BISONDEPENDS=$(addsuffix _bison.d,$(basename $(YSOURCES))) OBJS:=$(OBJS) $(BISONOBJS) DEPENDS:=$(DEPENDS) $(BISONDEPENDS) %_bison.c: $(srcdir)/%.y $(BISON) $(BISONFLAGS) -o $@ $< %_bison.o %_bison.d: %_bison.c $(CC) $(ABI_CFLAGS) $(CFLAGS) $(EXT_CFLAGS) $(INCLUDES) -MMD -MT '$*_bison.d $*_bison.o' -c $< -o $*_bison.o compile:: $(BISONSOURCES) clean:: rm -f $(BISONSOURCES)