-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
65 lines (58 loc) · 2.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
INPUT_DIRECTORY=${CURDIR}/countries
OUTPUT_DIRECTORY=${CURDIR}
OUTPUT_SRC_DIRECTORY=${OUTPUT_DIRECTORY}/src
CODE_GENERATOR_DIRECTORY=${CURDIR}/keshvar-code-generator/
build:
@ echo "\n\n" && echo "Building without default features..."
cargo build --no-default-features
@ ls -sh target/debug/*keshvar*
@ echo "\n\n" && echo "Building with default features..."
cargo build
@ ls -sh target/debug/*keshvar*
@ echo "\n\n" && echo "Building with 'geo' feature..."
cargo build --features "geo"
@ ls -sh target/debug/*keshvar*
@ echo "\n\n" && echo "Building with 'translations' feature..."
cargo build --features "translations"
@ ls -sh target/debug/*keshvar*
@ echo "\n\n" && echo "Building with 'subdivisions' feature..."
cargo build --features "subdivisions"
@ echo "\n\n" && echo "Building with 'search-translations' feature..."
cargo build --features "search-translations"
@ ls -sh target/debug/*keshvar*
@ echo "\n\n" && echo "Building with all features..."
cargo build --no-default-features --all-features
@ ls -sh target/debug/*keshvar*
generate:
@ echo "Removing auto-generated codes..."
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/countries/* && touch ${OUTPUT_SRC_DIRECTORY}/countries/mod.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/search/* && touch ${OUTPUT_SRC_DIRECTORY}/search/mod.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/alpha2.rs && touch ${OUTPUT_SRC_DIRECTORY}/alpha2.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/alpha3.rs && touch ${OUTPUT_SRC_DIRECTORY}/alpha3.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/consts.rs && touch ${OUTPUT_SRC_DIRECTORY}/consts.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/region.rs && touch ${OUTPUT_SRC_DIRECTORY}/region.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/gec.rs && touch ${OUTPUT_SRC_DIRECTORY}/gec.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/ioc.rs && touch ${OUTPUT_SRC_DIRECTORY}/ioc.rs
@ rm -rf ${OUTPUT_SRC_DIRECTORY}/currency_code.rs && touch ${OUTPUT_SRC_DIRECTORY}/currency_code.rs
@ rm -rf build.log
@ echo "Generating new codes..."
@ cd ${CODE_GENERATOR_DIRECTORY} && cargo run -- ${INPUT_DIRECTORY} ${OUTPUT_DIRECTORY}
@ echo "Compiling newly generated codes"
@ ${MAKE} build
check-style:
@ echo "Checking code-generator style..."
@ cd ${CODE_GENERATOR_DIRECTORY} && cargo fmt --check
@ echo "Checking generated source style..."
cargo fmt --check > /dev/null
format-style:
@ echo "Formatting code-generator style..."
@ cd ${CODE_GENERATOR_DIRECTORY} && cargo fmt
@ echo "Formatting generated source style..."
cargo fmt
test:
@echo "Running tests..."
cargo test --all-features
clippy:
@echo "Running Clippy..."
cargo clippy --all-features
.PHONY: build generate check-style format-style test clippy