-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (30 loc) · 1.02 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
MAINFILES := verify-upload.c hash-service.c
MAIN_EXECS := $(patsubst %.c, %, $(MAINFILES))
CC := gcc
CFLAGS := -Wall -Werror
LIBS := -lpthread
SRC := $(wildcard *.c)
SRC_DEPS := $(filter-out $(MAINFILES), $(wildcard *.c))
DEPS_HEADERS := $(patsubst %.c, %.h, $(SRC_DEPS))
TESTS := $(wildcard test/*.c)
TESTS_EXCLUDE :=
TESTS_EXCLUDE_PATH := $(patsubst %, test/%, $(TESTS_EXCLUDE))
TEST_ALL_EXECS := $(patsubst %.c, %, $(wildcard test/*.c))
TEST_EXECS := $(filter-out $(TESTS_EXCLUDE_PATH), $(TEST_ALL_EXECS))
all: $(MAIN_EXECS)
.PHONY: test clean install
install: verify-upload hash-service
cp hash-service /usr/local/bin
cp verify-upload /usr/local/bin
verify-upload: verify-upload.c $(SRC_DEPS)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
hash-service: hash-service.c $(SRC_DEPS)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
tests/%: tests/%.c $(SRC_DEPS) $(DEPS_HEADERS)
$(info $^)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
test: $(TEST_EXECS)
for x in $(TEST_EXECS); do ./$$x || exit 1; done
clean:
@rm -f $(MAIN_EXECS)
@rm -f $(TEST_ALL_EXECS)