diff options
author | John Hodge <tpg@mutabah.net> | 2015-09-26 12:59:13 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-09-26 12:59:13 +0800 |
commit | f6f4a432967cf0b077002d888bfe3aaceeffa4d3 (patch) | |
tree | d7d2f3d60e5db3f7dd053fa56ff2e02e71383468 /bnf/Makefile | |
parent | 61f800772a19534f3c4d113ac116b7ae54adae5b (diff) | |
download | mrust-f6f4a432967cf0b077002d888bfe3aaceeffa4d3.tar.gz |
BNF - Hack up module file loading, working on core::float_macros
Diffstat (limited to 'bnf/Makefile')
-rw-r--r-- | bnf/Makefile | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/bnf/Makefile b/bnf/Makefile index 175f6b9e..e85e5fa4 100644 --- a/bnf/Makefile +++ b/bnf/Makefile @@ -1,27 +1,36 @@ .SUFFIXES: -all: test.bin -TSTFILES := ../samples/1.rs -TSTFILES := $(addprefix ../../rust_os/libcore/, lib.rs str/mod.rs str/pattern.rs borrow.rs any.rs array.rs result.rs) +OBJS := main.o rust.tab.o rust.lex.o -test: test.bin $(TSTFILES) - $(foreach f,$(TSTFILES), ./test.bin "$f" &&) true +#TSTFILES := ../samples/1.rs +TSTFILES := ../../rust_os/rustc_src/libcore/lib.rs +#TSTFILES := $(addprefix ../../rust_os/libcore/, lib.rs str/mod.rs str/pattern.rs borrow.rs any.rs array.rs result.rs) + + + +all: test.bin -OBJS := rust.tab.o rust.lex.o +test: test.bin $(TSTFILES) + $(foreach f,$(TSTFILES), $(DBG) ./test.bin "$f" &&) true test.bin: $(OBJS) g++ -std=c++11 $(OBJS) -o $@ -%.o: %.cpp +%.o: %.cpp ast_types.hpp g++ -x c++ -std=c++11 $< -c -o $@ -I . -%.o: .gen/%.cpp +%.o: .gen/%.cpp ast_types.hpp g++ -x c++ -std=c++11 $< -c -o $@ -I . .gen/rust.tab.cpp: .gen/.rust.y @mkdir -p $(dir $@) - bison -o $@ $< -d --verbose + @echo [BISON] $@ + @bison -o $@ $< -d --verbose +# HACK: Bison emits duplicate entries in the union, remove those + @mv $(@:%.cpp=%.hpp) $(@:%.cpp=%.hpp.OLD) + @awk '{ if($$0 ~ /yacc.c:1909/) { ignore = 1; print $$0; } else if( ignore == 1 ) { trigger = $$0; ignore = 2; } else if( ignore == 2 ) { if($$0 == trigger) { ignore = 0 } } if( ignore > 0 ) { } else { print $$0; } }' < ${@:%.cpp=%.hpp.OLD} > $(@:%.cpp=%.hpp) +.gen/rust.tab.hpp: .gen/rust.tab.cpp .gen/.rust.y: Makefile rust.y rust_expr.y.h rust_tts.y.h @mkdir -p $(dir $@) @@ -33,5 +42,7 @@ test.bin: $(OBJS) .gen/rust.lex.cpp: rust.lex @mkdir -p $(dir $@) flex -o $@ $< - + + +main.cpp: .gen/rust.tab.hpp |