]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - Makefile
Makefile: CFLAGS: Don't trigger errors for some warnings
[thirdparty/man-pages.git] / Makefile
index 60a8a3a0eb534225d62105502ba4b4e3b3f94720..cea48edae41cc60f6ff8652350971d9fb2efca8d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,9 @@
 #
 ########################################################################
 
+SHELL := /bin/bash -Eeuo pipefail
+
+
 MAKEFLAGS += --no-print-directory
 MAKEFLAGS += --warn-undefined-variables
 
@@ -106,6 +109,10 @@ DEFAULT_CFLAGS += -Wall
 DEFAULT_CFLAGS += -Wextra
 DEAFULT_CFLAGS += -Wstrict-prototypes
 DEFAULT_CFLAGS += -Werror
+DEFAULT_CFLAGS += -Wno-error=unused-parameter
+DEFAULT_CFLAGS += -Wno-error=sign-compare
+DEFAULT_CFLAGS += -Wno-error=format
+DEFAULT_CFLAGS += -Wno-error=uninitialized
 EXTRA_CFLAGS   :=
 CFLAGS         := $(DEFAULT_CFLAGS) $(EXTRA_CFLAGS)
 
@@ -217,14 +224,16 @@ _man8pages  := $(filter %$(man8ext),$(_manpages))
 _LINT_groff :=$(patsubst $(MANDIR)/%,$(_LINTDIR)/%.lint.groff.touch,$(LINTMAN))
 _LINT_mandoc:=$(patsubst $(MANDIR)/%,$(_LINTDIR)/%.lint.mandoc.touch,$(LINTMAN))
 _SRCPAGEDIRS:=$(patsubst $(MANDIR)/%,$(_SRCDIR)/%.d,$(LINTMAN))
-_UNITS_c    :=$(sort $(patsubst $(MANDIR)/%,$(_SRCDIR)/%,$(shell \
+_UNITS_src  :=$(sort $(patsubst $(MANDIR)/%,$(_SRCDIR)/%,$(shell \
                find $(MANDIR)/man?/ -type f \
                | grep '$(manext)$$' \
                | xargs grep -l '^\.TH ' \
                | while read m; do \
                        <$$m \
-                       sed -n "s,^\... SRC BEGIN (\(.*.c\))$$,$$m.d/\1,p"; \
+                       sed -n "s,^\... SRC BEGIN (\(.*.[ch]\))$$,$$m.d/\1,p"; \
                done)))
+_UNITS_h    := $(filter %.h,$(_UNITS_src))
+_UNITS_c    := $(filter %.c,$(_UNITS_src))
 _UNITS_o    := $(patsubst %.c,%.o,$(_UNITS_c))
 _UNITS_bin  := $(patsubst %.c,%,$(_UNITS_c))
 _LINT_clang-tidy := $(patsubst %.c,%.lint.clang-tidy.touch,$(_UNITS_c))
@@ -321,9 +330,11 @@ $(_SRCPAGEDIRS): $(_SRCDIR)/%.d: $(MANDIR)/% | $$(@D)/.
        $(MKDIR) $@
        touch $@
 
-$(_UNITS_c): $$(@D)
+$(_UNITS_src): $$(patsubst $(_SRCDIR)/%.d,$(MANDIR)/%,$$(@D)) | $$(@D)
+$(_UNITS_c):   $$(filter $$(@D)/%.h,$(_UNITS_h))
+$(_UNITS_src):
        $(info SED      $@)
-       <$(patsubst $(_SRCDIR)/%.d,$(MANDIR)/%,$<) \
+       <$< \
        sed -n \
                -e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
                -e '/^\.SH EXAMPLES/p' \
@@ -331,8 +342,7 @@ $(_UNITS_c): $$(@D)
        | $(MAN) -P cat -l - \
        | sed '/^[^ ]/d' \
        | sed 's/^       //' \
-       >$@ \
-       || exit $$?
+       >$@
 
 $(_UNITS_o): $(_SRCDIR)/%.o: $(_SRCDIR)/%.c
        $(info CC       $@)
@@ -371,7 +381,7 @@ lint    := $(foreach x,$(linters),lint-$(x))
 $(_LINT_clang-tidy): %.lint.clang-tidy.touch: %.c
        $(info LINT (clang-tidy)        $@)
        $(CLANG-TIDY) $(CLANG-TIDYFLAGS) $< -- $(CPPFLAGS) $(CFLAGS) 2>&1 \
-       | sed '/generated\.$$/d' || exit $$?
+       | sed '/generated\.$$/d'
        touch $@
 
 $(_LINT_iwyu): %.lint.iwyu.touch: %.c
@@ -413,7 +423,7 @@ lint: $(lint)
 # The sed removes the lines "Content-type: text/html\n\n"
 $(_HTMLPAGES): $(_HTMLDIR)/%.html: $(MANDIR)/% | $$(@D)/.
        $(info MAN2HTML $@)
-       $(MAN2HTML) $(MAN2HTMLFLAGS) $< | sed -e 1,2d >$@ || exit $$?
+       $(MAN2HTML) $(MAN2HTMLFLAGS) $< | sed -e 1,2d >$@
 
 $(_HTMLDIRS): %/.: | $$(dir %). $(_HTMLDIR)/.