File: Makefile

package info (click to toggle)
vis 0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,388 kB
  • sloc: ansic: 22,372; sh: 950; makefile: 356; python: 47
file content (66 lines) | stat: -rw-r--r-- 2,134 bytes parent folder | download | duplicates (2)
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
65
66
-include ../../config.mk

ALL = buffer-test map-test array-test text-test
SRC = $(wildcard ccan/*/*.c)
CFLAGS += -I. -I../.. -DBUFFER_SIZE=4 -DBLOCK_SIZE=4

test: $(ALL)
	@./buffer-test
	@./map-test
	@./array-test
	@./text-test

config.h:
	@echo Generating ccan configuration header
	@${CC} ccan-config.c -o ccan-config && ./ccan-config > config.h

text-test: config.h text-test.c ../../text.c ../../text-common.c ../../text-io.c ../../text-iterator.c ../../text-util.c ../../text-motions.c ../../text-objects.c ../../text-regex.c ../../array.c
	@echo Compiling $@ binary
	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@

buffer-test: config.h buffer-test.c ../../buffer.c
	@echo Compiling $@ binary
	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@

map-test: config.h map-test.c ../../map.c
	@echo Compiling $@ binary
	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@

array-test: config.h array-test.c ../../array.c
	@echo Compiling $@ binary
	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@

debug: clean
	$(MAKE) CFLAGS_EXTRA='${CFLAGS_EXTRA} ${CFLAGS_DEBUG}'

coverage: clean
	$(MAKE) CFLAGS_EXTRA='--coverage'

asan: clean
	$(MAKE) CFLAGS_EXTRA='-fsanitize=address'

ubsan: clean
	$(MAKE) CFLAGS_EXTRA='-fsanitize=undefined'

msan: clean
	$(MAKE) CFLAGS_EXTRA='-fsanitize=memory -fsanitize-memory-track-origins'

valgrind: clean ${ALL}
	@for test in ${ALL}; do \
		valgrind --leak-check=full --log-file="$$test.valgrind" "./$$test"; \
		cat "$$test.valgrind"; \
		grep LEAK "$$test.valgrind" >/dev/null && exit 1 || true; \
	done

tis: clean
	$(MAKE) CC="tis-interpreter.sh --cc" CFLAGS='"${CFLAGS} ${CFLAGS_STD} -DHAVE_MEMRCHR=0 -DTIS_INTERPRETER=1"' CFLAGS_STD='' CFLAGS_LIBC='' LDFLAGS='#' $(ALL)

clean:
	@echo cleaning
	@rm -f ccan-config config.h
	@rm -f data symlink hardlink
	@rm -f $(ALL)
	@rm -f *.gcov *.gcda *.gcno
	@rm -f *.valgrind

.PHONY: clean debug coverage tis valgrind asan ubsan msan