-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
42 lines (33 loc) · 996 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
36
37
38
39
40
41
42
BIN := dnsmasq/src/dnsmasq
PATCH_DIR := patches
PATCHES := $(sort $(wildcard $(PATCH_DIR)/*.patch))
PATCHED := $(sort $(patsubst $(PATCH_DIR)/%.patch, $(PATCH_DIR)/%.patched, $(PATCHES)))
# turn on/off for regex or regex_ipset
DNSMASQ_COPTS="-DHAVE_REGEX -DHAVE_REGEX_IPSET"
all:$(BIN)
.PHONY: submodule
submodule:
cd dnsmasq && $(MAKE) COPTS=$(DNSMASQ_COPTS)
$(BIN):$(PATCHED)
cd dnsmasq && $(MAKE) COPTS=$(DNSMASQ_COPTS)
$(MAKE) remove_patched
$(MAKE) reset_submodule
# disable parallel build for patching files
# for preventing from producing out of order chunks
.NOTPARALLEL: %.patched
%.patched:%.patch
@echo "Applying $^"
@patch -p 1 -d dnsmasq < $^ && touch $@
@echo
.PHONY: reset_submodule
reset_submodule:
git submodule foreach --recursive git reset --hard
.PHONY: remove_patched
remove_patched:
find . \( -name \*.orig -o -name \*.rej \) -delete
rm -rf $(PATCHED)
.PHONY: clean
clean:
$(MAKE) -C dnsmasq clean
$(MAKE) remove_patched
$(MAKE) reset_submodule