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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
# Copyright (c) 2020-2023 Brett Sheffield <bacs@librecast.net>
SHELL = @SHELL@
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
PACKAGE = @PACKAGE_NAME@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PROGRAM = @PACKAGE_NAME@
COVERITY_DIR := cov-int
COVERITY_TGZ := $(PACKAGE_NAME)-coverity-$(PACKAGE_VERSION).tgz
.PHONY: all src install clean installdirs
.PHONY: test check net-setup net-teardown setcap testfiles .FORCE
all: src
src distclean mostlyclean maintainer-clean dist dist-gzip setcap:
$(MAKE) -C src $@
install installdirs install-strip uninstall:
$(MAKE) -C src $@
$(MAKE) -C doc $@
clean:
$(MAKE) -C src $@
$(MAKE) -C test $@
fixme:
grep -n FIXME src/*.{c,h} test/*.{c,h}
todo:
grep -n TODO src/*.{c,h} test/*.{c,h}
test memcheck: src
$(MAKE) -C test $@/all
test/% memcheck/%: .FORCE src
$(MAKE) -C test $@
LOOPBANNER ?= echo
testloop:
num_ok=0; \
while $(MAKE) $(subst testloop,test,$@); do \
num_ok=$$(( $$num_ok + 1 )); \
echo; \
echo; \
$(LOOPBANNER) "OK $$num_ok"; \
echo; \
sleep 2; \
done; \
$(LOOPBANNER) "OK $$num_ok"
testloop/%:
num_ok=0; \
while $(MAKE) $(subst testloop,test,$@); do \
num_ok=$$(( $$num_ok + 1 )); \
echo; \
echo; \
$(LOOPBANNER) "OK $$num_ok"; \
echo; \
sleep 2; \
done; \
$(LOOPBANNER) "OK $$num_ok"
.FORCE: # always recompile
coverity: clean
PATH=$(PATH):../../coverity/bin/ cov-build --dir cov-int $(MAKE) src
tar czvf $(COVERITY_TGZ) $(COVERITY_DIR)
net-setup:
ip link add veth0 type veth peer name veth1
ip netns add vnet0
ip netns add vnet1
ip link set veth0 netns vnet0
ip link set veth1 netns vnet1
ip -n vnet0 link set veth0 up
ip -n vnet1 link set veth1 up
ip netns show
net-teardown:
ip -n vnet0 link set veth0 down
ip -n vnet1 link set veth1 down
ip -n vnet1 link set veth1 netns vnet0
ip -n vnet0 link del veth0 type veth peer name veth1
ip netns del vnet0
ip netns del vnet1
ip netns show
testfiles:
@dir="/tmp/lcsync/testfiles" ; \
echo $$dir ; \
mkdir -p $$dir; \
for z in {1..10}; do \
c=$$((2 ** $$z * 1024)); \
echo $$c; \
dd if=/dev/random of=$$dir/testfile.$$z bs=1024 count=$$c; \
done
|