diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2012-09-05 11:43:42 +0100 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2012-09-05 11:43:42 +0100 |
commit | 1c7bc7e17ace1e457c4c0336353f142aef36d254 (patch) | |
tree | 5aa8a948e25d05bd8f0ba0ab271d4f4f946d2d33 /src | |
parent | d908eab7b9976c2b402cb92fa5ac77a89a112de4 (diff) | |
download | nsgenbind-1c7bc7e17ace1e457c4c0336353f142aef36d254.tar.gz nsgenbind-1c7bc7e17ace1e457c4c0336353f142aef36d254.tar.bz2 |
Fix up bison usage
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 67 | ||||
-rw-r--r-- | src/genbind-parser.y | 2 | ||||
-rw-r--r-- | src/webidl-parser.y | 2 |
3 files changed, 23 insertions, 48 deletions
diff --git a/src/Makefile b/src/Makefile index 6b328ae..232a7dd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,42 +1,9 @@ -# +CFLAGS := $(CFLAGS) -I$(BUILDDIR) -Isrc/ -#CFLAGS+=-Wall - -#.PHONY: all clean - -#all: genjsbind - -#genjsbind: genjsbind.o genbind-parser.o genbind-lexer.o webidl-parser.o webidl-lexer.o -# $(CC) -o $@ $^ - -#webidl-parser.o: webidl-parser.c webidl-parser.h webidl-lexer.h - -#webidl-parser.h webidl-parser.c: webidl-parser.y -# bison -t $< - -#webidl-lexer.h: webidl-lexer.c - -#webidl-lexer.c: webidl-lexer.l -# flex $< - - -#genbind-parser.o: genbind-parser.c genbind-parser.h genbind-lexer.h - -#genbind-parser.h genbind-parser.c: genbind-parser.y -# bison -t $< - -#genbind-lexer.h: genbind-lexer.c - -#genbind-lexer.c: genbind-lexer.l -# flex $< - - -#genjsbind.o: webidl-parser.h genbind-parser.h - -#clean: -# $(RM) genjsbind genjsbind.o webidl-parser.c webidl-lexer.c webidl-lexer.h webidl-parser.h genbind-parser.c genbind-lexer.c genbind-lexer.h genbind-parser.h *.o +# Sources in this directory +DIR_SOURCES := genjsbind.c -CFLAGS+=-I$(BUILDDIR) -Isrc/ +SOURCES := $(SOURCES) $(BUILDDIR)/genbind-parser.c $(BUILDDIR)/genbind-lexer.c $(BUILDDIR)/webidl-parser.c $(BUILDDIR)/webidl-lexer.c $(BUILDDIR)/%-lexer.c $(BUILDDIR)/%-lexer.h: src/%-lexer.l $(VQ)$(ECHO) " FLEX: $<" @@ -44,15 +11,27 @@ $(BUILDDIR)/%-lexer.c $(BUILDDIR)/%-lexer.h: src/%-lexer.l $(BUILDDIR)/%-lexer.c: $(BUILDDIR)/%-parser.h +# Bison 2.6 and later require api.prefix, but this breaks Bison 2.5 and earlier. +bisonvsn := $(word 4,$(shell bison --version)) +bisonmaj := $(word 1,$(subst ., ,$(bisonvsn))) +bisonmin := $(word 2,$(subst ., ,$(bisonvsn))) +ifeq ($(bisonmaj),1) + BISON_DEFINES = --name-prefix=$(*F)_ +else + ifeq ($(bisonmaj),2) + ifneq ($(findstring $(bisonmin),"0 1 2 3 4 5"),) + BISON_DEFINES = --name-prefix=$(*F)_ + else + BISON_DEFINES = --define=api.prefix=$(*F)_ + endif + else + BISON_DEFINES = --define=api.prefix=$(*F)_ + endif +endif + $(BUILDDIR)/%-parser.c $(BUILDDIR)/%-parser.h: src/%-parser.y $(VQ)$(ECHO) " BISON: $<" - $(Q)bison -d -t --output=$(BUILDDIR)/$(*F)-parser.c --defines=$(BUILDDIR)/$(*F)-parser.h $< - - -# Sources in this directory -DIR_SOURCES := genjsbind.c - -SOURCES := $(SOURCES) $(BUILDDIR)/genbind-parser.c $(BUILDDIR)/genbind-lexer.c $(BUILDDIR)/webidl-parser.c $(BUILDDIR)/webidl-lexer.c + $(Q)bison -d -t $(BISON_DEFINES) --output=$(BUILDDIR)/$(*F)-parser.c --defines=$(BUILDDIR)/$(*F)-parser.h $< # Grab the core makefile include $(NSBUILD)/Makefile.subdir diff --git a/src/genbind-parser.y b/src/genbind-parser.y index 42330f7..cad20b4 100644 --- a/src/genbind-parser.y +++ b/src/genbind-parser.y @@ -29,8 +29,6 @@ int genbind_wrap() %} %define api.pure -%define api.prefix "genbind_" -%name-prefix "genbind_" %union { diff --git a/src/webidl-parser.y b/src/webidl-parser.y index bcc93ba..73ed2c6 100644 --- a/src/webidl-parser.y +++ b/src/webidl-parser.y @@ -32,8 +32,6 @@ int webidl_wrap() %locations %define api.pure -%define api.prefix "webidl_" -%name-prefix "webidl_" %union { |