-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (49 loc) · 1.52 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
CC = gcc
CFLAGS = -Wall -Wextra -Werror -pedantic -Wno-stringop-overflow -Wno-format-truncation -Werror=implicit-function-declaration -std=gnu99 -g3 -DDO_DEBUG=1
LDFLAGS = -lncurses -ltinfo -ltermcap -lm -Wl,--gc-sections -lpthread -ldl
READFILES = data/hours.dat data/monsters.dat data/moria_gcustom.mst
WRITEFILES = data/death.log data/moriamas.dat data/moriatop.dat data/moriatrd.dat
DATAFILES = $(READFILES) $(WRITEFILES)
RSFILES = $(shell find src/ -type f -name '*.rs')
CFILES = $(shell find src/ -type f -name '*.c')
HFILES = $(shell find src/ -type f -name '*.h')
OBJFILES = $(shell find src/ -type f -name '*.o')
.PHONY: all
all: omoria
.c.o:
$(CC) $(CFLAGS) -c -o $*.o $*.c
omoria: $(OBJFILES) $(RSFILES)
cargo build
$(CC) $(OBJFILES) target/debug/libomoria.a $(LDFLAGS) -o $@
.PHONY: run
run: omoria
>debug_rust.out
RUST_BACKTRACE=1 ./omoria
.PHONY: pre-commit
pre-commit:
rustfmt $$(git diff --cached --name-only | grep ".*\.rs$$")
#clang-format -i $$(git diff --cached --name-only | grep ".*\.[ch]$$")
cargo test
.PHONY: test
test:
cargo test
.PHONY: debug
debug: omoria
>debug_rust.out
RUST_BACKTRACE=1 rust-gdb ./omoria
.PHONY: nodata
nodata ::
$(RM) data/hours.dat data/death.log data/moriamas.dat data/moriatop.dat data/moriatrd.dat data/moria_gcustom.mst data/TRADE.DUMP
.PHONY: clean
clean ::
$(RM) $(OBJFILES) core omoria
.PHONY: ctags
ctags:
@ctags -R . --exclude .git
@rusty-tags vi
.PHONY: format
format:
@rustfmt $(RSFILES)
#@clang-format -i $(CFILES) $(HFILES)
.PHONY: spotless
spotless : nodata clean