sled

Једноставни уређивач текста
git clone https://git.sr.ht/~strahinja/sled
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување e46739f42f7b96b343b9af3ab72fd6c51b0ab016
родитељ 7ba9b462b5fb2488971992faa0a7d9725451dbc5
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Thu, 28 Sep 2023 14:05:20 +0200

Make config.redo behave more like config.mk; move feature test macro
definitions from source to config.redo

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
M.gitignore | 1-
MINSTALL | 11+++++------
Aconfig.redo | 3+++
Mdefault.o.do | 7++-----
Mdraw.c | 4----
Minstall.do | 5+----
Msled.c | 4----
Msled.do | 7++-----
Muninstall.do | 5+----
измењених датотека: 9, додавања: 14(+), брисања: 33(-)

diff --git a/.gitignore b/.gitignore @@ -20,7 +20,6 @@ nohup.out *.pdf *.1 *.pkg.tar.zst -config.redo src PKGBUILD _config.h diff --git a/INSTALL b/INSTALL @@ -1,7 +1,7 @@ Prerequisites ============= -* C compiler (GCC-compatible) - ${SLED_CC:-gcc -g} +* C compiler - defaults in config.redo * gzip @@ -24,16 +24,15 @@ 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, SLED_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, SLED_CC and PREFIX +are specified in config.redo. OpenBSD ------- -Set SLED_CC to cc and define _BSD_SOURCE, eg: +Replace gcc in SLED_CC with cc and add -D_BSD_SOURCE, eg: # SLED_CC='cc -g -Wall -D_BSD_SOURCE' ./do install diff --git a/config.redo b/config.redo @@ -0,0 +1,3 @@ +PREFIX=${PREFIX:-/usr/local} +SLED_CC=${SLED_CC:-gcc -g -Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=200809L \ +-D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE} diff --git a/default.o.do b/default.o.do @@ -1,8 +1,5 @@ sed -n '/^#include "/s/^#include "\([^"]*\)"/\1/p' ${2%.o}.c | \ xargs redo-ifchange redo-ifchange $2.c -if [ -r ./config.redo ]; then - . ./config.redo -fi -SLED_CC=${SLED_CC:-gcc -g} -${SLED_CC} -Wall -std=c99 -c $2.c -o $3 +. ./config.redo +${SLED_CC} -c $2.c -o $3 diff --git a/draw.c b/draw.c @@ -2,10 +2,6 @@ * any later version. Copyright (C) 2022-2023 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ -#define _POSIX_C_SOURCE 200809L -#define _DEFAULT_SOURCE -#define _XOPEN_SOURCE - #include <errno.h> #include <stdio.h> #include <stdlib.h> diff --git a/install.do b/install.do @@ -1,8 +1,5 @@ redo-ifchange all -if [ -r ./config.redo ]; then - . ./config.redo -fi -PREFIX=${PREFIX:-/usr/local} +. ./config.redo BINDIR=$PREFIX/bin MANDIR=$PREFIX/share/man/man1 for executable in sled sledv; do diff --git a/sled.c b/sled.c @@ -2,10 +2,6 @@ * any later version. Copyright (C) 2022-2023 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ -#define _POSIX_C_SOURCE 200809L -#define _DEFAULT_SOURCE -#define _XOPEN_SOURCE - #include <errno.h> #include <fcntl.h> #include <signal.h> diff --git a/sled.do b/sled.do @@ -1,6 +1,3 @@ redo-ifchange sled.o draw.o util.o -if [ -r ./config.redo ]; then - . ./config.redo -fi -SLED_CC=${SLED_CC:-gcc -g} -${SLED_CC} -Wall -std=c99 -o $3 sled.o draw.o util.o >/dev/null +. ./config.redo +${SLED_CC} -o $3 sled.o draw.o util.o >/dev/null diff --git a/uninstall.do b/uninstall.do @@ -1,8 +1,5 @@ redo-always -if [ -r ./config.redo ]; then - . ./config.redo -fi -PREFIX=${PREFIX:-/usr/local} +. ./config.redo BINDIR=$PREFIX/bin MANDIR=$PREFIX/share/man/man1 rm -f $BINDIR/sled $BINDIR/sledv $MANDIR/sled.1.gz