vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

Makefile

(2148B)


      1 -include ../../config.mk
      2 
      3 ALL = buffer-test map-test array-test text-test
      4 SRC = $(wildcard ccan/*/*.c)
      5 CFLAGS += -I. -I../.. -DBUFFER_SIZE=4 -DBLOCK_SIZE=4
      6 
      7 test: $(ALL)
      8 	@./buffer-test
      9 	@./map-test
     10 	@./array-test
     11 	@./text-test
     12 
     13 config.h:
     14 	@echo Generating ccan configuration header
     15 	@${CC} ccan-config.c -o ccan-config && ./ccan-config "${CC}" ${CFLAGS} > config.h
     16 
     17 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
     18 	@echo Compiling $@ binary
     19 	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@
     20 
     21 buffer-test: config.h buffer-test.c ../../buffer.c
     22 	@echo Compiling $@ binary
     23 	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} buffer-test.c ${SRC} ${LDFLAGS} -o $@
     24 
     25 map-test: config.h map-test.c ../../map.c
     26 	@echo Compiling $@ binary
     27 	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@
     28 
     29 array-test: config.h array-test.c ../../array.c
     30 	@echo Compiling $@ binary
     31 	@${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${SRC} ${LDFLAGS} -o $@
     32 
     33 debug: clean
     34 	$(MAKE) CFLAGS_EXTRA='${CFLAGS_EXTRA} ${CFLAGS_DEBUG}'
     35 
     36 coverage: clean
     37 	$(MAKE) CFLAGS_EXTRA='--coverage'
     38 
     39 asan: clean
     40 	$(MAKE) CFLAGS_EXTRA='-fsanitize=address'
     41 
     42 ubsan: clean
     43 	$(MAKE) CFLAGS_EXTRA='-fsanitize=undefined'
     44 
     45 msan: clean
     46 	$(MAKE) CFLAGS_EXTRA='-fsanitize=memory -fsanitize-memory-track-origins'
     47 
     48 valgrind: clean ${ALL}
     49 	@for test in ${ALL}; do \
     50 		valgrind --leak-check=full --log-file="$$test.valgrind" "./$$test"; \
     51 		cat "$$test.valgrind"; \
     52 		grep LEAK "$$test.valgrind" >/dev/null && exit 1 || true; \
     53 	done
     54 
     55 tis: clean
     56 	$(MAKE) CC="tis-interpreter.sh --cc" CFLAGS='"${CFLAGS} ${CFLAGS_STD} -DHAVE_MEMRCHR=0 -DTIS_INTERPRETER=1"' CFLAGS_STD='' CFLAGS_LIBC='' LDFLAGS='#' $(ALL)
     57 
     58 clean:
     59 	@echo cleaning
     60 	@rm -f ccan-config config.h
     61 	@rm -f data symlink hardlink
     62 	@rm -f $(ALL)
     63 	@rm -f *.gcov *.gcda *.gcno
     64 	@rm -f *.valgrind
     65 
     66 .PHONY: clean debug coverage tis valgrind asan ubsan msan