-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (50 loc) · 1.42 KB
/
Makefile
File metadata and controls
66 lines (50 loc) · 1.42 KB
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
65
66
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man/man8
CC ?= cc
CSTD ?= -std=c11
CFLAGS ?= -O2 -g -Wall -Wextra -Wpedantic -Wno-unused-parameter \
-Wshadow -Wstrict-prototypes -Wmissing-prototypes \
-fstack-protector-strong -D_GNU_SOURCE
LDFLAGS ?=
LDLIBS ?=
SRC := \
src/log.c \
src/util.c \
src/buf.c \
src/path.c \
src/fan.c \
src/output.c \
src/policy.c \
src/config.c \
src/daemon.c \
src/main.c
OBJ := $(SRC:.c=.o)
BIN := fanotifyd
UNIT_SRC := tests/unit_main.c src/buf.c src/util.c src/log.c src/config.c src/output.c src/path.c src/policy.c src/fan.c src/daemon.c
UNIT_BIN := tests/unit
PIVOT_BIN := tests/pivot_writer
.PHONY: all clean install test unit integration check format
all: $(BIN)
$(BIN): $(OBJ)
$(CC) $(CSTD) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
%.o: %.c
$(CC) $(CSTD) $(CFLAGS) -Isrc -c -o $@ $<
$(UNIT_BIN): $(UNIT_SRC)
$(CC) $(CSTD) $(CFLAGS) -Isrc -o $@ $^
$(PIVOT_BIN): tests/pivot_writer.c
$(CC) $(CSTD) $(CFLAGS) -o $@ $<
unit: $(UNIT_BIN)
@echo "[unit] running $(UNIT_BIN)"
@$(UNIT_BIN)
integration: $(BIN) $(PIVOT_BIN)
@echo "[integration] running tests/run.sh"
@sh tests/run.sh
test: unit
@echo "[test] integration tests require root and are run via 'make integration'"
check: test
clean:
rm -f $(OBJ) $(BIN) $(UNIT_BIN) $(PIVOT_BIN)
install: $(BIN)
install -d $(DESTDIR)$(BINDIR)
install -m 0755 $(BIN) $(DESTDIR)$(BINDIR)/$(BIN)