]> git.lizzy.rs Git - rust.git/blob - mk/grammar.mk
Remove deprecated functionality
[rust.git] / mk / grammar.mk
1 # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
4 #
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
10
11 BG = $(CFG_BUILD_DIR)/grammar/
12 SG = $(S)src/grammar/
13 B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
14 L = $(B)lib/rustlib/$(CFG_BUILD)/lib
15 LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
16 RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD))
17
18 # Run the reference lexer against libsyntax and compare the tokens and spans.
19 # If "// ignore-lexer-test" is present in the file, it will be ignored.
20 #
21 # $(1) is the file to test.
22 define LEXER_TEST
23 grep "// ignore-lexer-test" $(1) ; \
24   if [ $$? -eq 1 ]; then \
25    CLASSPATH=$(B)grammar $(CFG_GRUN) RustLexer tokens -tokens < $(1) \
26    | $(B)grammar/verify $(1) ; \
27   fi
28 endef
29
30 $(BG):
31         $(Q)mkdir -p $(BG)
32
33 $(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4
34         $(Q)$(CFG_ANTLR4) -o $(BG) $(SG)RustLexer.g4
35         $(Q)$(CFG_JAVAC) -d $(BG) $(BG)RustLexer.java
36
37 check-build-lexer-verifier: $(BG)verify
38
39 ifeq ($(NO_REBUILD),)
40 VERIFY_DEPS :=  rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.rustc
41 else
42 VERIFY_DEPS :=
43 endif
44
45 $(BG)verify: $(BG) $(SG)verify.rs $(VERIFY_DEPS)
46         $(Q)$(RUSTC) --out-dir $(BG) -L $(L) $(SG)verify.rs
47
48 ifdef CFG_JAVAC
49 ifdef CFG_ANTLR4
50 ifdef CFG_GRUN
51 check-lexer: $(BG) $(BG)RustLexer.class check-build-lexer-verifier
52         $(info Verifying libsyntax against the reference lexer ...)
53         $(Q)$(SG)check.sh $(S) "$(BG)" \
54                 "$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens"
55 else
56 $(info cfg: grun not available, skipping lexer test...)
57 check-lexer:
58
59 endif
60 else
61 $(info cfg: antlr4 not available, skipping lexer test...)
62 check-lexer:
63
64 endif
65 else
66 $(info cfg: javac not available, skipping lexer test...)
67 check-lexer:
68
69 endif