From 2e96fc06f325110af8c7177c0c60694eed5fd245 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 2 Jan 2024 17:28:59 -0300 Subject: Fix the build system. The improvements are: - use most of the default "Makefile" for standard packaging; - also use the default ".gitignore" with for the derived assets; - don't impose so many $CFLAGS on the user. GCC still needs to be given the `-ffreestanding` flag explicitly for us to get a good binary; - stop using ad-hoc tools/* scripts, and avoid the code-generation anti-pattern overall on the build. Some of the generated files were checked-in, and some were removed; - remove empty files; - use POSIX make(1) over gmake; - add fuzz targets; - partial "install" and "uninstall" targets; - complete "clean" target. The shortcomings are: - only working on x86_64. More platforms coming soon; - code is still messy: way too many warnings, GNU/BSD specific extensions, inline assembly, and all kinds of unportable code; - still only works with GCC and GCC-like compilers, and completly fails with tcc(1) and cproc(1); - the `deps.mk` file is being maintained manually. As I work on the source files I'll finish automating its generation with `mkdeps.sh`; - still seems to be coupled with Linux; - still is missing tests setup; - still uses `#include <$NAME.h>` instead of the correct `#include "$NAME.h"` form. The generated libgrovel.a did match the previous lib/libc.a 100%. --- mkdeps.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 mkdeps.sh (limited to 'mkdeps.sh') diff --git a/mkdeps.sh b/mkdeps.sh new file mode 100755 index 00000000..440b5600 --- /dev/null +++ b/mkdeps.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -eu + +varlist() { + printf '%s = \\\n' "$1" + sed 's|^\(.*\)$|\t\1 \\|' + printf '\n' +} + +cfiles() { + git ls-files src/ | grep '\.c$' | grep -v '^src/main\.c$' | sort +} + +export LANG=POSIX.UTF-8 + +find doc/*.en.*.in 2>/dev/null | sort | varlist 'manpages.en.in' ||: +echo 'manpages.in = $(manpages.en.in)' +printf 'catalogs.en.msg = %s\n' "$(find src/ -name '*.msg')" +echo 'catalogs.msg = $(catalogs.en.msg)' +printf '\n' + +find tests/fuzz/*.c | sort | varlist 'fuzz.c' +find tests/fuzz/*.c | sort | awk -F. '{ printf "%s.xa: %s.o\n", $1, $1 }' +find tests/fuzz/*.c | sort | awk -F. '{ printf "%s.bin-check: %s.bin\n", $1, $1 }' +printf '\n\n' + +cfiles | varlist 'sources.c' +ldev deps $(cfiles) -- cgit v1.2.3