commit bd26166e4ae7b46e3edffe0a5c3572acbde160c6
parent cddb66f7e068f7e0e86f3645ea56ade4f5cdc039
Author: Friedel Schön <[email protected]>
Date: Mon, 29 May 2023 18:01:58 +0200
adding automatic %VERSION% to makefile
Diffstat:
21 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,3 +1,5 @@
+VERSION = 0.3.2
+
# Directories
SRC_DIR := src
BUILD_DIR := build
@@ -9,9 +11,11 @@ ROFF_DIR := man
# Compiler Options
CC ?= clang
-CFLAGS += -g -std=gnu99 -Wpedantic -Wunused-result -Wno-gnu-zero-variadic-macro-arguments
+CFLAGS += -I$(INCLUDE_DIR) -DVERSION=\"$(VERSION)\" -g -std=gnu99 -Werror -Wpedantic -Wpedantic -Wno-gnu-zero-variadic-macro-arguments
LDFLAGS += -fPIE
+SED ?= sed
+
# Executable-specific flags
finit_FLAGS := -static
@@ -54,11 +58,11 @@ $(INTERMED_DIRS):
# Object rules
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c $(INCLUDE_FILES) | $(BUILD_DIR)
- $(CC) -o $@ -c -I$(INCLUDE_DIR) $(CFLAGS) $<
+ $(CC) -o $@ -c $(CFLAGS) $<
# Executables
$(BIN_DIR)/%: $(EXEC_DIR)/%.c $(INCLUDE_FILES) $(OBJ_FILES) | $(BIN_DIR)
- $(CC) -o $@ -I$(INCLUDE_DIR) $(CFLAGS) $< $(OBJ_FILES) $($(notdir $@)_FLAGS) $(LDFLAGS)
+ $(CC) -o $@ $(CFLAGS) $< $(OBJ_FILES) $($(notdir $@)_FLAGS) $(LDFLAGS)
$(BIN_DIR)/%: $(EXEC_DIR)/%.sh | $(BIN_DIR)
cp $< $@
@@ -71,10 +75,10 @@ $(BIN_DIR)/%: $(EXEC_DIR)/%.lnk | $(BIN_DIR)
# Manual targets
$(ROFF_DIR)/%: $(MAN_DIR)/%.md | $(ROFF_DIR)
- md2man-roff $< > $@
+ $(SED) 's/%VERSION%/$(VERSION)/' $< | md2man-roff > $@
$(ROFF_DIR)/%: $(MAN_DIR)/%.roff | $(ROFF_DIR)
- cp $< $@
+ $(SED) 's/%VERSION%/$(VERSION)/' $< > $@
# Debug
compile_flags.txt:
diff --git a/include/config.h b/include/config.h
@@ -1,5 +1,8 @@
#pragma once
+// the current version, VERSION must be defined by compiler-flag -DVERSION=\"x.x.x\"
+#define SV_VERSION VERSION
+
// seconds to wait for a service before it gets killed
#ifndef SV_STOP_TIMEOUT
# define SV_STOP_TIMEOUT 5
@@ -55,11 +58,6 @@
# define SV_RESUME_EXEC "/usr/share/fiss/resume"
#endif
-// the current version
-#ifndef SV_VERSION
-# define SV_VERSION "0.3.0"
-#endif
-
// time to wait to accept new connection
#ifndef SV_CHECK_INTERVAL
# define SV_CHECK_INTERVAL 3 // seconds
diff --git a/man/chpst.8 b/man/chpst.8
@@ -1,4 +1,4 @@
-.TH chpst 8 "MAY 2023" "0.2.2" "fiss man page"
+.TH chpst 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
\fB\fCchpst\fR \- runs a program with a changed process state
diff --git a/man/fsvc.8 b/man/fsvc.8
@@ -1,4 +1,4 @@
-.TH fsvc 8 "MAY 2023" "0.2.2" "fiss man page"
+.TH fsvc 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
\fB\fCfsvc\fR \- fiss' service controller
diff --git a/man/fsvs.8 b/man/fsvs.8
@@ -1,4 +1,4 @@
-.TH fsvs 8 "MAY 2023" "0.2.2" "fiss man page"
+.TH fsvs 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
\fB\fCfsvs\fR \- friedel's service superviser
diff --git a/man/halt.8 b/man/halt.8
@@ -1,4 +1,4 @@
-.TH halt 8 "MAY 2023" "0.2.2" "fiss man page"
+.TH halt 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
halt, reboot, poweroff \- stop the system
diff --git a/man/modules-load.8 b/man/modules-load.8
@@ -1,4 +1,4 @@
-.TH modules\-load 8 "MAY 2023" "0.2.2" "fiss man page"
+.TH modules\-load 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
\fB\fCmodules\-load\fR \- configure kernel modules at boot
diff --git a/man/shutdown.8 b/man/shutdown.8
@@ -1,4 +1,4 @@
-.TH shutdown 8 "MAY 2023" "0.2.2" "fiss man page"
+.TH shutdown 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
\fB\fCshutdown\fR – bring down the system.S
diff --git a/man/sigremap.8 b/man/sigremap.8
@@ -1,4 +1,4 @@
-.TH sigremap 8 "MAY 2023" "0.2.2" "fiss man page"
+.TH sigremap 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
\fB\fCsigremap\fR \- a minimal init system for Linux containers
diff --git a/man/vlogger.1 b/man/vlogger.1
@@ -1,4 +1,4 @@
-.TH vlogger 1 "MAY 2023" "0.2.2" "fiss man page"
+.TH vlogger 1 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
\fB\fCvlogger\fR \- log messages to syslog or an arbitrary executable
diff --git a/man/zzz.8 b/man/zzz.8
@@ -1,4 +1,4 @@
-.TH zzz 8 "MAY 2023" "0.1.2" "fiss man page"
+.TH zzz 8 "MAY 2023" "0.3.2" "fiss man page"
.SH NAME
.PP
zzz \- suspend or hibernate your system
diff --git a/src/exec/halt.c b/src/exec/halt.c
@@ -56,7 +56,7 @@ int main(int argc, char* argv[]) {
write_wtmp(1);
return 0;
default:
- fprintf(stderr, "Usage: %s [-n] [-f] [-d] [-w] [-B]", progname);
+ fprintf(stderr, "Usage: %s [-n] [-f] [-d] [-w] [-B]", prog);
return 1;
}
diff --git a/src/man/chpst.8.md b/src/man/chpst.8.md
@@ -1,4 +1,4 @@
-# chpst 8 "MAY 2023" "0.2.2" "fiss man page"
+# chpst 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/fsvc.8.md b/src/man/fsvc.8.md
@@ -1,4 +1,4 @@
-# fsvc 8 "MAY 2023" "0.2.2" "fiss man page"
+# fsvc 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/fsvs.8.md b/src/man/fsvs.8.md
@@ -1,4 +1,4 @@
-# fsvs 8 "MAY 2023" "0.2.2" "fiss man page"
+# fsvs 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/halt.8.md b/src/man/halt.8.md
@@ -1,4 +1,4 @@
-# halt 8 "MAY 2023" "0.2.2" "fiss man page"
+# halt 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/modules-load.8.md b/src/man/modules-load.8.md
@@ -1,4 +1,4 @@
-# modules-load 8 "MAY 2023" "0.2.2" "fiss man page"
+# modules-load 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/shutdown.8.md b/src/man/shutdown.8.md
@@ -1,4 +1,4 @@
-# shutdown 8 "MAY 2023" "0.2.2" "fiss man page"
+# shutdown 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/sigremap.8.md b/src/man/sigremap.8.md
@@ -1,4 +1,4 @@
-# sigremap 8 "MAY 2023" "0.2.2" "fiss man page"
+# sigremap 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/vlogger.1.md b/src/man/vlogger.1.md
@@ -1,4 +1,4 @@
-# vlogger 1 "MAY 2023" "0.2.2" "fiss man page"
+# vlogger 1 "MAY 2023" "%VERSION%" "fiss man page"
## NAME
diff --git a/src/man/zzz.8.md b/src/man/zzz.8.md
@@ -1,4 +1,4 @@
-# zzz 8 "MAY 2023" "0.1.2" "fiss man page"
+# zzz 8 "MAY 2023" "%VERSION%" "fiss man page"
## NAME