чување 7e52ac3005b71e688d342bf395b5896c8d81f10a
родитељ 5fb4065263639dd14c47523b736c8646ffa4547a
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Thu, 28 Sep 2023 15:10:08 +0200
Make config.redo behave more like config.mk; synchronize changes to build
scripts and INSTALL from sled
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 9, додавања: 16(+), брисања: 28(-)
diff --git a/.gitignore b/.gitignore
@@ -16,7 +16,6 @@ cscope.out
nohup.out
*.gz
*.xz
-config.redo
index.html
slweb
slweb.1
diff --git a/INSTALL b/INSTALL
@@ -1,7 +1,7 @@
Prerequisites
=============
-* C compiler (GCC-compatible) - ${SLWEB_CC:-gcc -g}
+* C compiler - defaults in config.redo
* gzip
@@ -35,7 +35,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, SLWEB_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.
diff --git a/config.redo b/config.redo
@@ -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:-:}
diff --git a/default.o.do b/default.o.do
@@ -1,5 +1,3 @@
redo-ifchange $2.c
-if [ -r ./config.redo ]; then
- . ./config.redo
-fi
-${SLWEB_CC:-gcc -g} -Wall -std=c99 -o $3 -c $2.c
+. ./config.redo
+${CC} -o $3 -c $2.c
diff --git a/defs.h b/defs.h
@@ -5,10 +5,6 @@
#ifndef __DEFS_H
#define __DEFS_H
-#define _POSIX_C_SOURCE 200809L
-#define _DEFAULT_SOURCE
-#define _XOPEN_SOURCE
-
#include <ctype.h>
#include <dirent.h>
#include <errno.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
DOCDIR=$PREFIX/share/doc/slweb
MANDIR=$PREFIX/share/man/man1
diff --git a/slweb.c b/slweb.c
@@ -2187,8 +2187,7 @@ process_madeby(FILE* output)
{
print_output(output,
"<div id=\"made-by\"><p><small>\n"
- "Generated by <a href=\"%s\">"
- "slweb</a>\n"
+ "Generated by <a href=\"%s\">slweb</a>\n"
"© %s Strahinya Radich.\n"
"</small></p></div><!--made-by-->\n",
MADEBY_URL, COPYRIGHTYEAR);
diff --git a/slweb.do b/slweb.do
@@ -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,4 +6,5 @@ for f in *.h *.c; do
echo $f
echo $f | sed -e's/\.c$/.o/g'
done | xargs redo-ifchange
-${SLWEB_CC:-gcc -g} -Wall -std=c99 -o $3 slweb.o utf8.o
+${CC} -o $3 slweb.o utf8.o
+${STRIP} $3
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
DOCDIR=$PREFIX/share/doc/slweb
MANDIR=$PREFIX/share/man/man1