-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
35 lines (26 loc) · 838 Bytes
/
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
CFLAGS += -std=c99 -O3 -g -Wall -Wextra -Werror -Wno-type-limits
TIMEOUT ?= 10
CONFIG_DIR ?= examples
OUT_DIR := out
INSTALL_DIR ?= /opt/interception
TARGETS := $(addprefix $(OUT_DIR)/,$(notdir $(wildcard $(CONFIG_DIR)/*)))
.PHONY: all
all: $(TARGETS)
$(OUT_DIR)/%: k2k.c $(CONFIG_DIR)/%/map-rules.h.in $(CONFIG_DIR)/%/tap-rules.h.in $(CONFIG_DIR)/%/multi-rules.h.in | $(OUT_DIR)
$(CC) $(CFLAGS) -I$(CONFIG_DIR) -I$(CONFIG_DIR)/$* $< -o $@
$(OUT_DIR):
mkdir $@
%-rules.h.in:
touch $@
.PHONY: clean
clean:
rm -rf $(OUT_DIR)
.PHONY: install
install:
# If you have run `make test` then do not forget to run `make clean` after. Otherwise you may install with debug logs on.
install -D --strip -t $(INSTALL_DIR) $(TARGETS)
.PHONY: test
test:
CFLAGS=-DVERBOSE make
make install
timeout $(TIMEOUT) udevmon -c /etc/udevmon.yaml