-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (43 loc) · 1.09 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
CC := clang
CFLAGS ?= -Weverything -I.
ifeq ($(shell uname),Darwin)
LDFLAGS ?=
else
LDFLAGS ?= -Wl,-PIC,-ldl,-rpath,/usr/lib/swift/linux,-lswiftCore,-L/usr/lib/swift/linux
endif
EXECUTABLE ?= skit
OTHER_CFLAGS ?= -g
PREFIX ?= /usr/local/bin
HEADERS = $(wildcard *.h)
SRCS = $(wildcard *.c)
OBJS = $(patsubst %.c,%.o,$(SRCS))
%.o: %.c $(HEADERS) sourcekitd/sourcekitd.h
$(CC) -c -o $@ $< $(CFLAGS) $(OTHER_CFLAGS)
$(EXECUTABLE): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(OTHER_CFLAGS) $(LDFLAGS)
.PHONY: release
release: OTHER_CFLAGS = -O3
release: clean $(EXECUTABLE)
.PHONY: install
install: release
install $(EXECUTABLE) $(PREFIX)
.PHONY: uninstall
uninstall:
rm "$(PREFIX)/$(EXECUTABLE)"
.PHONY: clean
clean:
rm -f $(EXECUTABLE)
rm -f $(OBJS)
find . -name "*.pyc" -delete
.PHONY: test
test: $(EXECUTABLE)
python -m unittest discover -s tests
.PHONY: format
format: $(SRCS) $(HEADERS)
clang-format -i $(SRCS) $(HEADERS)
.PHONY: check-format
check-format: $(SRCS) $(HEADERS)
@which clang-format
set -o pipefail; \
! clang-format -output-replacements-xml $(SRCS) $(HEADERS) \
| grep "<replacement "