build system done

This commit is contained in:
Kyle Isom 2025-04-10 19:41:41 -07:00
parent 25662a9120
commit aeed5bb515
4 changed files with 66 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.fasl
beepy
fw

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
files := $(wildcard *.lisp)
names := $(files:.lisp=)
.PHONY: all clean $(names)
all: $(names)
$(names): %: bin/% man/man1/%.1
bin/%: %.lisp build-binary.sh Makefile
mkdir -p bin
./build-binary.sh $<
mv $(@F) bin/
man/man1/%.1: %.lisp build-manual.sh Makefile
mkdir -p man/man1
./build-manual.sh $<
mv $(@F) man/man1/
clean:
rm -rf bin man *.fasl

View File

@ -17,3 +17,32 @@ sbcl --load "$LISP" \
:executable t :executable t
:save-runtime-options t :save-runtime-options t
:toplevel '$NAME:toplevel)" :toplevel '$NAME:toplevel)"
cat <<EOF
____ _ _ _ ____ _____ ____ ________ _ _ _____
| _ \ / \ | \ | |/ ___| ____| _ \ |__ / _ \| \ | | ____|
| | | |/ _ \ | \| | | _| _| | |_) | / / | | | \| | _|
| |_| / ___ \| |\ | |_| | |___| _ < / /| |_| | |\ | |___
|____/_/ \_\_| \_|\____|_____|_| \_\/____\___/|_| \_|_____|
EOF
# D A N G E R Z O N E
# Beepy needs this because the firmware files are owned by root.
# When building on macOS, I need need to make sure it works with
# some test-files.
if [ "$(uname -s)" = "Linux" ]
then
cat <<EOF
____ _ _ _ ____ _____ ____ ________ _ _ _____
| _ \ / \ | \ | |/ ___| ____| _ \ |__ / _ \| \ | | ____|
| | | |/ _ \ | \| | | _| _| | |_) | / / | | | \| | _|
| |_| / ___ \| |\ | |_| | |___| _ < / /| |_| | |\ | |___
|____/_/ \_\_| \_|\____|_____|_| \_\/____\___/|_| \_|_____|
EOF
echo "[+] warning: setting up ${NAME} with sticky-root permissions!"
sudo chown root:root ${NAME}
sudo chmod +s ${NAME}
fi

13
build-manual.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
LISP=$1
NAME=$(basename "$LISP" .lisp)
OUT="$NAME.1"
shift
sbcl --load "$LISP" \
--eval "(with-open-file (f \"$OUT\" :direction :output :if-exists :supersede)
(adopt:print-manual $NAME:*ui* :stream f))" \
--quit