~strahinja/lav-sdl

9554f661af8ff04439b9b5ccba27a3321a4b6b54 — Страхиња Радић 4 months ago 5936bce
Make config.redo behave more like config.mk; synchronize changes to build
scripts and INSTALL from sled

Signed-off-by: Страхиња Радић <contact@strahinja.org>
8 files changed, 15 insertions(+), 28 deletions(-)

M .gitignore
M INSTALL
A config.redo
M default.o.do
M install.do
M lav-sdl.c
M lav-sdl.do
M uninstall.do
M .gitignore => .gitignore +0 -1
@@ 17,7 17,6 @@ nohup.out
*.gz
*.xz
!*.xcf.xz
config.redo
lav-sdl
date
local.h

M INSTALL => INSTALL +4 -5
@@ 1,7 1,7 @@
Prerequisites
=============

* C compiler (GCC-compatible) - ${CC:-gcc -g}
* C compiler - defaults in config.redo
* gzip
* libSDL (SDL2, SDL2_image)



@@ 25,7 25,6 @@ if you don't:
Persistent build configuration file
-----------------------------------

If a file config.redo exists in the build directory, it will be sourced when
building targets which also accept configuration through environment variables.
For example, CC and PREFIX can be specified in config.redo, eliminating
the need to pass them with each build.
The file config.redo will be sourced when building targets which also accept
configuration through environment variables.  For example, CC and PREFIX
are specified in config.redo.

A config.redo => config.redo +4 -0
@@ 0,0 1,4 @@
PREFIX=${PREFIX:-/usr/local}
CC=${CC:-gcc -g -Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=200809L \
-D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE}
STRIP=${STRIP:-:}

M default.o.do => default.o.do +2 -5
@@ 1,7 1,4 @@
redo-ifchange $2.c
if [ -r ./config.redo ]; then
	. ./config.redo
fi
CC=${CC:-gcc -g}
. ./config.redo
INCLUDES=$(pkg-config --cflags sdl2)
$CC -Wall -std=c99 $INCLUDES -o $3 -c $2.c
$CC $INCLUDES -o $3 -c $2.c

M install.do => install.do +1 -4
@@ 1,8 1,5 @@
redo-ifchange all
if [ -r ./config.redo ]; then
	. ./config.redo
fi
PREFIX=${PREFIX:-/usr/local}
. ./config.redo
BINDIR=$PREFIX/bin
if [ -z "$DATADIR" ]; then
	DATADIR=$PREFIX/share/lav-sdl

M lav-sdl.c => lav-sdl.c +0 -4
@@ 2,10 2,6 @@
 * any later version. Copyright (C) 2023  Strahinya Radich.
 * See the file LICENSE for exact copyright and license details. */

#define _POSIX_C_SOURCE 200809L
#define _DEFAULT_SOURCE
#define _XOPEN_SOURCE

#include <SDL.h>
#include <SDL_image.h>
#include <errno.h>

M lav-sdl.do => lav-sdl.do +3 -5
@@ 1,6 1,4 @@
if [ -r ./config.redo ]; then
	. ./config.redo
fi
. ./config.redo
for f in *.h.in; do
	echo $f | sed -e's/\.in$//g'
done | xargs redo-ifchange


@@ 8,8 6,8 @@ for f in *.h *.c; do
	echo $f
	echo $f | sed -e's/\.c$/.o/g'
done | xargs redo-ifchange
CC=${CC:-gcc -g}
LIBS=$(pkg-config --libs sdl2)
LIBS="$LIBS $(pkg-config --libs SDL2_image)"
LIBS="$LIBS -lm"
$CC -Wall -std=c99 -o $3 lav-sdl.o $LIBS
$CC -o $3 lav-sdl.o $LIBS
$STRIP $3

M uninstall.do => uninstall.do +1 -4
@@ 1,7 1,4 @@
if [ -r ./config.redo ]; then
	. ./config.redo
fi
PREFIX=${PREFIX:-/usr/local}
. ./config.redo
BINDIR=$PREFIX/bin
if [ -z "$DATADIR" ]; then
	DATADIR=$PREFIX/share/lav-sdl