-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
55 lines (42 loc) · 975 Bytes
/
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
define cargotoml
[package]
name = "PACKAGE"
version = "0.1.0"
authors = ["$(shell git config user.name) <$(shell git config user.email)>"]
edition = "2018"
[lib]
crate_type = ["dylib"]
[dependencies]
rustbot = { path = "../rustbot" }
endef
export cargotoml
define librs
use rustbot::prelude::*;
#[no_mangle]
pub fn get_meta(meta: &mut dyn Meta) {
meta.cmd("foo", Command::new(foo));
}
fn foo(ctx: &dyn Context, args: &str) -> Result<()> {
Ok(())
}
endef
export librs
mod_%:
mkdir -p "$@/src"
echo "$$cargotoml" | sed 's/PACKAGE/$@/g' > $@/Cargo.toml
echo "$$librs" > $@/src/lib.rs
mkdir_data:
mkdir -p data/
.PHONY: data
data: mkdir_data data/airports.csv
define AIRPORT_PROCESSING
import csv
import sys
for row in csv.reader(sys.stdin):
print(",".join(row[4:8]))
endef
export AIRPORT_PROCESSING
data/airports.csv:
curl -s https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat \
| python -c "$$AIRPORT_PROCESSING" \
> $@