-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
59 lines (48 loc) · 1.58 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
# SPDX-License-Identifier: GPL-2.0-only
# GitBSLR is available under the same license as Git itself.
ifeq ($(shell uname -s),Darwin)
$(error This program does not function on macOS. I couldn't find a functional LD_PRELOAD equivalent.)
endif
OPT ?= 0
ifeq ($(OPT),0)
DEBUG ?= 1
else
DEBUG ?= 0
endif
CFLAGS = -g
CXXFLAGS = $(CFLAGS)
TRUE_FLAGS := -std=c++98 -fno-rtti -fvisibility=hidden
TRUE_FLAGS += -fvisibility=hidden -Wall -Wmissing-declarations -pipe -fno-exceptions
TRUE_FLAGS += -fPIC -ldl -Wl,-z,relro,-z,now,--no-undefined -shared
ifneq ($(OPT),0)
TRUE_FLAGS += -Os -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden
TRUE_FLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables
TRUE_FLAGS += -ffunction-sections -fdata-sections
TRUE_FLAGS += -fno-ident -DNDEBUG
TRUE_FLAGS += -Wl,--gc-sections,--build-id=none,--hash-style=gnu,--relax
ifneq ($(DEBUG),1)
TRUE_FLAGS += -s
CFLAGS =
endif
endif
TRUE_FLAGS += $(CXXFLAGS) $(LFLAGS)
gitbslr.so: main.cpp
$(CXX) $+ $(TRUE_FLAGS) -o $@ -lm
clean:
rm gitbslr.so
install:
./install.sh
uninstall:
./install.sh uninstall
test: gitbslr.so
sh test1.sh | tee /dev/stderr | grep -q 'Test passed'
sh test2.sh | tee /dev/stderr | grep -q 'Test passed'
sh test3.sh | tee /dev/stderr | grep -q 'Test passed'
sh test4.sh | tee /dev/stderr | grep -q 'Test passed'
sh test5.sh | tee /dev/stderr | grep -q 'Test passed'
sh test6.sh | tee /dev/stderr | grep -q 'Test passed'
sh test7.sh | tee /dev/stderr | grep -q 'Test passed'
rm -rf test/
echo All tests passed
check: test
.PHONY: clean install uninstall test check