aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-11-08 19:45:53 -0300
committerEuAndreh <eu@euandre.org>2022-11-08 19:45:53 -0300
commit256df54826d6cf0a298b71ebe3a9a463e7a16aef (patch)
treed7ea5a0389380782c8e5f52e0faea1e0992fe27e
parentdoc/: Add new manpages as empty files (diff)
downloadremembering-256df54826d6cf0a298b71ebe3a9a463e7a16aef.tar.gz
remembering-256df54826d6cf0a298b71ebe3a9a463e7a16aef.tar.xz
Makefile: Remove rules for C files
Diffstat (limited to '')
-rw-r--r--Makefile34
-rwxr-xr-xtests/assert-catgets.sh67
-rwxr-xr-xtests/c-lint.sh65
3 files changed, 4 insertions, 162 deletions
diff --git a/Makefile b/Makefile
index a3e84ec..9ebf6c6 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ CONTRIBLANGS =
.SUFFIXES:
-.SUFFIXES: .in .to .c .o
+.SUFFIXES: .in
.in:
sed \
@@ -20,12 +20,6 @@ CONTRIBLANGS =
< $< > $@
if [ -x $< ]; then chmod +x $@; fi
-.c.o:
- $(CC) $(CFLAGS) -o $@ -c $<
-
-.c.to:
- $(CC) $(CFLAGS) -DTEST -o $@ -c $<
-
manpages.en.in = \
doc/remembering.en.1.in \
@@ -39,34 +33,14 @@ manpages.in = $(manpages.en.in) \
doc/remembering.eo.5.in
manpages = $(manpages.in:.in=)
-sources = \
- src/logerr.c \
- src/remembering.c
-objects = $(sources:.c=.o)
-t-sources = $(sources) src/tests-lib.c
-t-objects = $(t-sources:.c=.to)
-
-all: src/remembering remembering $(manpages)
+all: src/remembering $(manpages)
-remembering: $(objects)
- $(CC) $(LDFLAGS) -o $@ $(objects) $(LDLIBS)
-
-remembering-tests: $(t-objects)
- $(CC) $(LDFLAGS) -o $@ $(t-objects) $(LDLIBS)
src/remembering: src/remembering.in
-$(objects) $(t-objects): src/config.h
-src/tests-lib.to: src/tests-lib.h
-src/logerr.o src/logerr.to: src/logerr.h
-src/remembering.o: src/logerr.o
-src/remembering.to: src/logerr.to src/tests-lib.to
-
-check: all remembering-tests
- ./remembering-tests
- sh tests/assert-catgets.sh $(t-sources)
- sh tests/c-lint.sh $(t-sources)
+
+check: src/remembering
sh tests/cli-opts.sh
sh tests/ranking.sh
sh tests/signals.sh
diff --git a/tests/assert-catgets.sh b/tests/assert-catgets.sh
deleted file mode 100755
index 885e186..0000000
--- a/tests/assert-catgets.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-set -eu
-
-assert_sequential_ids() {
- awk '
- BEGIN {
- n = 0
- }
-
- /^#define MSG_/ {
- if (++n != $3) {
- print "Bad sequential ID:"
- printf "%s:%s:%s\n", FILENAME, NR, $0
- printf "expected: %s\ngot: %s\n", n, $3
- exit 1
- }
- }
- ' "$1"
-}
-
-assert_consistent_msg_definitions() {
- awk '
- BEGIN {
- i = 0
- j = 0
- }
-
- /^#define MSG_/ {
- defines[i++] = $2
- }
-
- /^\t\[MSG_/ {
- msgs[j++] = substr($0, 3, index($0, "]") - 3)
- }
-
- END {
- for (n in defines) {
- if (defines[n] != msgs[n]) {
- printf "Order mismatch between #define"
- printf " and usage in MSGS[]:\n"
- printf "#define: %s\nMSGS[]: %s\n",
- defines[n], msgs[n]
- exit 1
- }
- }
- }
- ' "$1"
-}
-
-assert_no_unused_msgs() {
- DEFINES="$(mktemp)"
- USAGES="$(mktemp)"
- awk '/^#define MSG_/ { print $2 }' "$f" | sort > "$DEFINES"
- awk -F'_\\(' '
- /_\(MSG_/ { print substr($2, 0, index($2, ")") - 1) }
- ' "$f" | sort | uniq > "$USAGES"
- if ! diff "$DEFINES" "$USAGES"; then
- echo 'Some defined MSG_ items not being used' >&2
- exit 1
- fi
-}
-
-for f in "$@"; do
- assert_sequential_ids "$f"
- assert_consistent_msg_definitions "$f"
- assert_no_unused_msgs "$f"
-done
diff --git a/tests/c-lint.sh b/tests/c-lint.sh
deleted file mode 100755
index 0fa0b01..0000000
--- a/tests/c-lint.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-set -eu
-
-awk '
-BEGIN {
- ret = 0
- msg = "function not on the start of the line:"
-}
-
-/^[a-zA-Z0-9_]+ .+\(/ {
- if (ret == 0) {
- print msg
- }
- printf "%s:%s:%s\n", FILENAME, FNR, $0
- ret = 1
-}
-
-END {
- exit ret
-}
-' "$@"
-
-
-awk '
-BEGIN {
- ret = 0
- static = 1
- msg = "non-static function is not declared in a header:"
-}
-
-/^[a-zA-Z0-9_]+\(.*$/ && static == 0 {
- split($0, line, /\(/)
- fn_name = line[1]
- if (fn_name != "main") {
- header = substr(FILENAME, 0, length(FILENAME) - 2) ".h"
- if (system("grep -q ^\"" fn_name "\" \"" header "\"")) {
- if (ret == 0) {
- print msg
- }
- printf "%s:%s:%s\n", FILENAME, FNR, $0
- ret = 1
- }
- }
-}
-
-/^static / {
- static = 1
-}
-
-!/^static / {
- static = 0
-}
-
-END {
- exit ret
-}
-' "$@"
-
-
-RE='[a-z]+\(\) {'
-if grep -Eq "$RE" "$@"; then
- echo 'Functions with no argument without explicit "void" parameter:' >&2
- grep -En "$RE" "$@"
- exit 1
-fi