-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathMakefile
49 lines (34 loc) · 1.11 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
.PHONY: clean clippy lint fmt all release debug ubuntu_shell
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
LDFLAGS=-framework Foundation -framework Security
endif
ifeq ($(UNAME_S), Linux)
LDFLAGS=-lcrypt -lm -lpthread -lrt -ldl
endif
LDFLAGS += -lz
all: release debug
debug:
bash -c "find target/debug | grep -i 'librubyfmt-.*\.a' | xargs rm; exit 0"
cargo build
release:
bash -c "find target/release | grep -i 'librubyfmt-.*\.a' | xargs rm; exit 0"
cargo build --release
target/c_main_debug: target/debug/deps/librubyfmt-*.a src/main.c
clang -O3 src/main.c $< $(LDFLAGS) -o $@
target/c_main_release: target/release/deps/librubyfmt-*.a src/main.c
clang -O3 src/main.c $< $(LDFLAGS) -o $@
target/release/deps/librubyfmt-*.a: release
target/debug/deps/librubyfmt-*.a: debug
ubuntu_shell:
docker build -t rubyfmt_testing_container:$(shell git rev-parse HEAD) -f ./dockerfiles/build.Dockerfile ./
docker run -it rubyfmt_testing_container:$(shell git rev-parse HEAD) bash
lint: clippy
./script/lints/lint_fixtures.sh
./script/lints/lint_scripts.sh
clean:
rm -rf target/
fmt:
cargo fmt
clippy:
cargo clippy