-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (45 loc) · 1.6 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
56
57
58
59
60
61
62
63
64
TARGET = build/bin/sudo
ORIGINAL_REPO = original
# We don't want to use sudo in certain contexts (e.g., in a Docker container), so we guard it
# behind this. It will simply do nothing if sudo is not present.
SUDO := $(shell which sudo)
SAFE_TARGET = safe/$(TARGET)
BACKDOORED_TARGET = backdoored/$(TARGET)
GROUND_TRUTH_TARGET = ground-truth/$(TARGET)
all: safe backdoored ground-truth
safe: $(SAFE_TARGET)
backdoored: $(BACKDOORED_TARGET)
ground-truth: $(GROUND_TRUTH_TARGET)
$(SAFE_TARGET): $(ORIGINAL_REPO)
$(SUDO) rm -rf safe/
cp -r $(ORIGINAL_REPO) safe/
cd safe/ && \
patch -p1 < ../patches/base.patch && \
./configure --prefix=$(realpath .)/safe/build --without-pam && \
$(SUDO) make -j32 && \
$(SUDO) make install
$(BACKDOORED_TARGET): $(ORIGINAL_REPO) patches/backdoored.patch
$(SUDO) rm -rf backdoored/
cp -r $(ORIGINAL_REPO) backdoored/
cd backdoored/ && \
patch -p1 < ../patches/base.patch && \
patch -p1 < ../patches/backdoored.patch && \
./configure --prefix=$(realpath .)/backdoored/build --without-pam && \
$(SUDO) make -j32 && \
$(SUDO) make install
$(GROUND_TRUTH_TARGET): $(ORIGINAL_REPO) patches/ground-truth.patch
$(SUDO) rm -rf ground-truth/
cp -r $(ORIGINAL_REPO) ground-truth/
cd ground-truth/ && \
patch -p1 < ../patches/base.patch && \
patch -p1 < ../patches/ground-truth.patch && \
./configure --prefix=$(realpath .)/ground-truth/build --without-pam && \
$(SUDO) make -j32 && \
$(SUDO) make install
clean:
$(SUDO) rm -rf safe/ backdoored/ ground-truth/
setup:
# No-op.
teardown:
# No-op.
.PHONY: clean all safe backdoored ground-truth setup teardown