build: extend maintenance make targets
Extend the make-targets to be more useful:
- make parameters configurable via env-vars
- add more warnings
#
#
-# The gcc warning sets -Wall and -Wextra enable some annoying warnings, which
-# we really do not care about. Disable them here.
+# The gcc warning-sets -Wall and -Wextra enable some annoying warnings, which
+# we really do not care about. Disable them here. Additionally, add some
+# warnings that we consider mandatory for our code-base.
#
MYCFLAGS= \
-Wno-unused-parameter \
- -Wno-maybe-uninitialized
+ -Wno-maybe-uninitialized \
+ -Wno-pointer-arith \
+ -Wno-unknown-warning-option \
+ \
+ -Wundef \
+ -Wlogical-op \
+ -Wmissing-include-dirs \
+ -Wold-style-definition \
+ -Wdeclaration-after-statement \
+ -Wfloat-equal \
+ -Wsuggest-attribute=noreturn \
+ -Wstrict-prototypes \
+ -Wredundant-decls \
+ -Wmissing-noreturn \
+ -Wshadow \
+ -Wendif-labels \
+ -Wstrict-aliasing=3 \
+ -Wwrite-strings \
+ -Wdate-time \
+ -Wnested-externs \
+ -Werror=overflow \
+ -Werror=missing-prototypes \
+ -Werror=implicit-function-declaration \
+ -Werror=missing-declarations \
+ -Werror=return-type \
+ -Werror=incompatible-pointer-types \
+ -Werror=format=2
+
+BUILDDIR?="$$PWD/mybuild"
all:
@echo "Available targets:"
@@ -24,23 +53,26 @@ all:
.PHONY: all
meson:
- rm -Rf ./mybuild
+ rm -Rf ${BUILDDIR}
CFLAGS="${MYCFLAGS} $$CFLAGS" \
meson \
- ./mybuild \
+ ${BUILDDIR} \
--prefix /usr \
--buildtype debugoptimized \
- --warnlevel 2
+ --warnlevel 2 \
+ ${MESONFLAGS}
.PHONY: meson
ninja:
ninja \
- -C ./mybuild
+ -C ${BUILDDIR} \
+ ${NINJAFLAGS}
.PHONY: ninja
test:
ninja \
- -C ./mybuild \
+ -C ${BUILDDIR} \
+ ${NINJAFLAGS} \
test
.PHONY: test
@@ -52,6 +84,6 @@ run:
systemd-nspawn \
-b \
-D test/osi/rootfs/ \
- --bind-ro "$$PWD/mybuild/src/dbus-broker:/usr/bin/dbus-broker" \
- --bind-ro "$$PWD/mybuild/src/dbus-broker-launch:/usr/bin/dbus-broker-launch"
+ --bind-ro "${BUILDDIR}/src/dbus-broker:/usr/bin/dbus-broker" \
+ --bind-ro "${BUILDDIR}/src/dbus-broker-launch:/usr/bin/dbus-broker-launch"
.PHONY: run
