1
1
CC ?= clang
2
2
TERMUX_BASE_DIR ?= /data/data/com.termux/files
3
- CFLAGS += -Wall -Wextra -Werror -Wshadow -fvisibility=hidden -std=c17 -Wno-error=tautological-pointer-compare
3
+ CFLAGS += -Wall -Wextra -Werror -Wshadow -fvisibility=hidden -std=c17
4
4
C_SOURCE := src/termux-exec.c src/exec-variants.c
5
- CLANG_FORMAT := clang-format --sort-includes --style="{ColumnLimit: 120}" $(C_SOURCE )
5
+ CLANG_FORMAT := clang-format --sort-includes --style="{ColumnLimit: 120}" $(C_SOURCE ) tests/fexecve.c tests/system-uname.c tests/print-argv0.c tests/popen.c
6
6
CLANG_TIDY ?= clang-tidy
7
7
8
8
ifeq ($(SANITIZE ) ,1)
11
11
CFLAGS += -O2
12
12
endif
13
13
14
+ ifeq ($(HOST_BUILD ) ,1)
15
+ CFLAGS += -Wno-error=tautological-pointer-compare
16
+ endif
17
+
14
18
libtermux-exec.so : $(C_SOURCE )
15
19
$(CC ) $(CFLAGS ) $(LDFLAGS ) $(C_SOURCE ) -DTERMUX_PREFIX=\" $(TERMUX_PREFIX ) \" -DTERMUX_BASE_DIR=\" $(TERMUX_BASE_DIR ) \" -shared -fPIC -o libtermux-exec.so
16
20
17
21
tests/fexecve : tests/fexecve.c
18
22
$(CC ) $(CFLAGS ) -DTERMUX_BASE_DIR=\" $(TERMUX_BASE_DIR ) \" $< -o $@
19
23
24
+ tests/popen : tests/popen.c
25
+ $(CC ) $(CFLAGS ) -DTERMUX_BASE_DIR=\" $(TERMUX_BASE_DIR ) \" $< -o $@
26
+
27
+ tests/system-uname : tests/system-uname.c
28
+ $(CC ) $(CFLAGS ) -DTERMUX_BASE_DIR=\" $(TERMUX_BASE_DIR ) \" $< -o $@
29
+
20
30
$(TERMUX_BASE_DIR ) /usr/bin/termux-exec-test-print-argv0 : tests/print-argv0.c
21
31
$(CC ) $(CFLAGS ) $< -o $@
22
32
@@ -31,9 +41,9 @@ uninstall:
31
41
32
42
on-device-tests :
33
43
make clean
34
- ASAN_OPTIONS=symbolize=0,detect_leaks=0 make SANITIZE=1 on-device-tests-internal
44
+ ASAN_OPTIONS=symbolize=0,detect_leaks=0 make on-device-tests-internal
35
45
36
- on-device-tests-internal : libtermux-exec.so tests/fexecve $(TERMUX_BASE_DIR ) /usr/bin/termux-exec-test-print-argv0
46
+ on-device-tests-internal : libtermux-exec.so tests/fexecve tests/popen tests/system-uname $(TERMUX_BASE_DIR ) /usr/bin/termux-exec-test-print-argv0
37
47
@LD_PRELOAD=${CURDIR} /libtermux-exec.so ./run-tests.sh
38
48
39
49
format :
43
53
$(CLANG_FORMAT ) --dry-run $(C_SOURCE )
44
54
$(CLANG_TIDY ) -warnings-as-errors=' *' $(C_SOURCE ) -- -DTERMUX_BASE_DIR=\" $(TERMUX_BASE_DIR ) \"
45
55
46
- test-binary : $( C_SOURCE )
47
- $(CC ) $(CFLAGS ) $(LDFLAGS ) $( C_SOURCE ) -g -fsanitize=address -fno-omit-frame-pointer -DUNIT_TEST=1 -DTERMUX_BASE_DIR=\" $(TERMUX_BASE_DIR ) \" -o test-binary
56
+ test-binary : src/termux-exec.c src/exec-variants.c
57
+ $(CC ) $(CFLAGS ) $(LDFLAGS ) $^ -g -fsanitize=address -fno-omit-frame-pointer -DUNIT_TEST=1 -DTERMUX_BASE_DIR=\" $(TERMUX_BASE_DIR ) \" -o test-binary
48
58
49
59
deb : libtermux-exec.so
50
60
termux-create-package termux-exec-debug.json
0 commit comments