summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-04-05 17:09:10 -0300
committerEuAndreh <eu@euandre.org>2024-04-05 17:13:44 -0300
commit905dab9e4bcfc9c768d4c9e57d5021624b7b499e (patch)
tree06eb4021d5fb2063c5c7aa71838c221971b334d8
parentMove unit tests out of src/*.c into tests/ (diff)
downloadpindaiba-905dab9e4bcfc9c768d4c9e57d5021624b7b499e.tar.gz
pindaiba-905dab9e4bcfc9c768d4c9e57d5021624b7b499e.tar.xz
rm -rf tools/ doc/*
-rw-r--r--Makefile6
-rw-r--r--deps.mk9
-rw-r--r--doc/pindaiba.en.1.in5
-rw-r--r--doc/pindaiba.recipes.en.7.in0
-rw-r--r--doc/pindaiba.tutorial.en.7.in0
-rw-r--r--doc/pindaiba.why.en.7.in14
-rwxr-xr-xmkdeps.sh4
-rw-r--r--tools/lib.sh49
-rwxr-xr-xtools/makehelp.sh149
-rwxr-xr-xtools/manpages.sh122
10 files changed, 1 insertions, 357 deletions
diff --git a/Makefile b/Makefile
index 57d93fa..3db4dd3 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,6 @@ LDLIBS = -lsiphash
all:
include deps.mk
-manpages = $(manpages.in:.in=)
catalogs.cat = $(catalogs.msg:.msg=.cat)
sources.h = $(sources.c:.c=.h)
@@ -74,7 +73,6 @@ sources = \
derived-assets = \
lib$(NAME).a \
src/config.h \
- $(manpages) \
$(catalogs.cat) \
$(sources.o) \
$(tests.o) \
@@ -102,7 +100,7 @@ all: $(derived-assets)
lib$(NAME).a: $(sources.o)
$(NAME).a: $(sources.o) src/main.o
$(fuzz.bin): lib$(NAME).a
-$(manpages) src/config.h: Makefile deps.mk
+src/config.h: Makefile deps.mk
$(sources.o) $(tests.o): Makefile deps.mk src/config.h
src/main.o tests/slurp.o: Makefile deps.mk src/config.h
tests/slurp.o: tests/slurp.h
@@ -167,7 +165,6 @@ install: all
mkdir -p "$$dir"; \
cp src/$(NAME)."$$l".cat "$$dir"/$(NAME).cat; \
done
- sh tools/manpages.sh -ip '$(DESTDIR)$(MANDIR)' $(manpages)
## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror
## of the "install" target, and removes *all* that was installed.
@@ -182,7 +179,6 @@ uninstall:
for l in $(LANGUAGES); do \
rm -f '$(DESTDIR)$(LOCALEDIR)'/"$$l"/LC_MESSAGES/$(NAME).cat; \
done
- sh tools/manpages.sh -up '$(DESTDIR)$(MANDIR)' $(manpages)
## Show this help.
diff --git a/deps.mk b/deps.mk
index 96f319a..a88a9a9 100644
--- a/deps.mk
+++ b/deps.mk
@@ -1,13 +1,4 @@
-manpages.en.in = \
- doc/pindaiba.en.1.in \
- doc/pindaiba.recipes.en.7.in \
- doc/pindaiba.tutorial.en.7.in \
- doc/pindaiba.why.en.7.in \
-
catalogs.en.msg = src/pindaiba.en.msg
-manpages.in = \
- $(manpages.en.in) \
-
catalogs.msg = \
$(catalogs.en.msg) \
diff --git a/doc/pindaiba.en.1.in b/doc/pindaiba.en.1.in
deleted file mode 100644
index 8ff1d8c..0000000
--- a/doc/pindaiba.en.1.in
+++ /dev/null
@@ -1,5 +0,0 @@
-.TH XABLAU 1 DATE "OIOJI" "OIJOIJ"
-
-.SH NAME
-
-woeifj
diff --git a/doc/pindaiba.recipes.en.7.in b/doc/pindaiba.recipes.en.7.in
deleted file mode 100644
index e69de29..0000000
--- a/doc/pindaiba.recipes.en.7.in
+++ /dev/null
diff --git a/doc/pindaiba.tutorial.en.7.in b/doc/pindaiba.tutorial.en.7.in
deleted file mode 100644
index e69de29..0000000
--- a/doc/pindaiba.tutorial.en.7.in
+++ /dev/null
diff --git a/doc/pindaiba.why.en.7.in b/doc/pindaiba.why.en.7.in
deleted file mode 100644
index 6cd923d..0000000
--- a/doc/pindaiba.why.en.7.in
+++ /dev/null
@@ -1,14 +0,0 @@
-.TH WOEIJF
-
-My quality standard for a C library is:
-- it is C, not C/C++;
-- it has test;
-- it uses sanitizers and fuzzing;
-- it works with more than one C compiler (notably, gcc, clang, tcc, scc and
- cproc);
-- it has `.POSIX` as a rule in its Makefile;
-- it uses make, and atmost, a ./configure script;
-- it works with more than one C implementation (notably, bmake, gnumake and ?);
-- it has an `install` and an `uninstall` target;
-
-8cc, c, chibicc, lacc, lcc
diff --git a/mkdeps.sh b/mkdeps.sh
index b3e6459..9fde709 100755
--- a/mkdeps.sh
+++ b/mkdeps.sh
@@ -22,12 +22,8 @@ langs() {
}' Makefile
}
-NAME="$(awk '/^NAME = / { print $3 }' Makefile)"
-find doc/*.en.*.in | varlist 'manpages.en.in'
-# langs
printf 'catalogs.en.msg = %s\n' "$(find src/ -name '*.msg')"
-langs | sed 's|^\(.*\)$|$(manpages.\1.in)|' | varlist 'manpages.in'
langs | sed 's|^\(.*\)$|$(catalogs.\1.msg)|' | varlist 'catalogs.msg'
find tests/fuzz/*.c | varlist 'fuzz.c'
diff --git a/tools/lib.sh b/tools/lib.sh
deleted file mode 100644
index 0412d7c..0000000
--- a/tools/lib.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-assert_arg() {
- if [ -z "$1" ]; then
- printf 'Missing %s.\n\n' "$2" >&2
- cat <<-'EOF'
- usage >&2
- exit 2
- EOF
- fi
-}
-
-uuid() {
- od -xN20 /dev/urandom |
- head -n1 |
- awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}'
-}
-
-tmpname() {
- echo "${TMPDIR:-/tmp}/uuid-tmpname with spaces.$(uuid)"
-}
-
-mkstemp() {
- name="$(tmpname)"
- touch "$name"
- echo "$name"
-}
-
-mkdtemp() {
- name="$(tmpname)"
- mkdir "$name"
- echo "$name"
-}
-
-END="\033[0m"
-yellow() {
- YELLOW="\033[0;33m"
- printf "${YELLOW}${1}${END}"
-}
-
-green() {
- GREEN="\033[0;32m"
- printf "${GREEN}${1}${END}"
-}
-
-red() {
- RED="\033[0;31m"
- printf "${RED}${1}${END}"
-}
diff --git a/tools/makehelp.sh b/tools/makehelp.sh
deleted file mode 100755
index e6118de..0000000
--- a/tools/makehelp.sh
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/sh
-set -eu
-
-. tools/lib.sh
-
-
-usage() {
- cat <<-'EOF'
- Usage:
- makehelp.sh < MAKEFILE
- makehelp.sh -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
-
- Options:
- -h, --help show this message
-
-
- Generate a help message from the given Makefile.
-
- Any target or variable commented with two "#" characters gets
- picked up. Multi-line comments are supported:
-
- VAR1 = 1
- # a comment
- VAR2 = 2
- ## another comment -> this one is included in the docs
- VAR3 = 3
-
- ## with a big
- ## comment, which is also included
- a-target:
-
-
- Examples:
-
- Generate help messages from "Makefile":
-
- $ aux/makehelp.sh < Makefile
-
-
- Generate help messages for all targets:
-
- $ cat Makefile dev.mk | aux/makehelp.sh
- EOF
-}
-
-
-for flag in "$@"; do
- case "$flag" in
- (--)
- break
- ;;
- (--help)
- usage
- help
- exit
- ;;
- (*)
- ;;
- esac
-done
-
-while getopts 'h' flag; do
- case "$flag" in
- (h)
- usage
- help
- exit
- ;;
- (*)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-
-TARGETS="$(mkstemp)"
-VARIABLES="$(mkstemp)"
-trap 'rm -f "$TARGETS" "$VARIABLES"' EXIT
-
-awk -vCOLUMN=15 -vTARGETS="$TARGETS" -vVARIABLES="$VARIABLES" '
-function indent(n, where) {
- for (INDENT = 0; INDENT < n; INDENT++) {
- printf " " > where
- }
-}
-
-/^## / { doc[len++] = substr($0, 4) }
-
-/^[-_a-zA-Z]+:/ && len {
- printf "\033[36m%s\033[0m", substr($1, 1, length($1) - 1) > TARGETS
- for (i = 0; i < len; i++) {
- n = COLUMN - (i == 0 ? length($1) - 1 : 0)
- indent(n, TARGETS)
- printf "%s\n", doc[i] > TARGETS
- }
- len = 0
-}
-
-/^.++=/ && len {
- printf "\033[36m%s\033[0m", $1 > VARIABLES
- for (i = 0; i < len; i++) {
- n = COLUMN - (i == 0 ? length($1) : 0)
- indent(n, VARIABLES)
- printf "%s\n", doc[i] > VARIABLES
- }
- len = 0
-}'
-
-
-
-indent() {
- sed 's|^| |'
-}
-
-cat <<-EOF
- Usage:
-
- make [VARIABLE=value...] [target...]
-
-
- Targets:
-
- $(indent < "$TARGETS")
-
-
- Variables:
-
- $(indent < "$VARIABLES")
-
-
- Examples:
-
- Build "all", the default target:
-
- $ make
-
-
- Test and install, with \$(DESTDIR) set to "tmp/":
-
- $ make DESTDIR=tmp check install
-EOF
diff --git a/tools/manpages.sh b/tools/manpages.sh
deleted file mode 100755
index ba5107f..0000000
--- a/tools/manpages.sh
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh
-set -eu
-
-. tools/lib.sh
-
-
-usage() {
- cat <<-'EOF'
- Usage:
- sh doc/manpages.sh -i|-u -p MANDIR FILE...
- sh doc/manpages.sh -h
- EOF
-}
-
-help() {
- cat <<-'EOF'
-
-
- Options:
- -i set ACTION=install
- -u set ACTION=uninstall
- -p MANDIR use $MANDIR as the prefix directory
- -h, --help show this message
-
-
- Installs/uninstalls manpage files into MANDIR using the original
- filename as a hint towards which subdirectory to pick: the
- `prog.ru.1` file is installed under the `man1/` directory
- hierarchy under the `ru/` language folder. When then language
- is `en`, a the toplevel `man1/` gets a symlink to the `en/`
- language folder:
-
- man/
- en/
- man1/
- prog.1
- ru/
- man1/
- prog.1
- man1/
- prog.1 -> ../en/man1/prog.1
-
-
- Examples:
-
- Install prog.en.1 under `/usr/man`:
-
- $ sh doc/manpages.sh -ip/usr/man prog.en.1
-
-
- Uninstall all files listed under doc/ from `$PREFIX`:
-
- sh doc/manpages.sh -up "$PREFIX" doc/*.[0-9]
- EOF
-}
-
-
-for flag in "$@"; do
- case "$flag" in
- (--)
- break
- ;;
- (--help)
- usage
- help
- exit
- ;;
- (*)
- ;;
- esac
-done
-
-while getopts 'iup:h' flag; do
- case "$flag" in
- (i)
- ACTION=install
- ;;
- (u)
- ACTION=uninstall
- ;;
- (p)
- MANDIR="$OPTARG"
- ;;
- (h)
- usage
- help
- exit
- ;;
- (*)
- usage >&2
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
-
-eval "$(assert_arg "${ACTION:-}" '-[iu] for choosing action')"
-eval "$(assert_arg "${MANDIR:-}" '-p MANDIR')"
-eval "$(assert_arg "${1:-}" 'FILE...')"
-
-
-for f in "$@"; do
- l="$(echo "$f" | awk -F. '{print $(NF-1)}')"
- n="$(echo "$f" | awk -F. '{print $NF}')"
- case "$ACTION" in
- (install)
- to_name="$(basename "${f%."$l"."$n"}.$n")"
- mkdir -p "$MANDIR/$l/man$n"
- cp "$f" "$MANDIR/$l/man$n/$to_name"
- ;;
- (uninstall)
- to_name="$(basename "${f%."$l"."$n"}.$n")"
- rm -f \
- "$MANDIR/$l/man$n/$to_name" \
- "$MANDIR/man$n/$to_name"
- ;;
- (*)
- echo "Bad ACTION: $ACTION"
- exit 1
- ;;
- esac
-done