]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
*.mk: Simplify build tree
authorAlejandro Colomar <alx@kernel.org>
Sun, 2 Apr 2023 13:30:34 +0000 (15:30 +0200)
committerAlejandro Colomar <alx@kernel.org>
Sun, 2 Apr 2023 13:30:36 +0000 (15:30 +0200)
Reuse $_MANDIR (.tmp/man/) for most stuff we build (with the exception
of `make dist`).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/build-src.mk
lib/build.mk
lib/lint-man.mk
lib/lint.mk

index 410af3abd0804d9eb168d02a9d60815ef54ab9d6..15382c6be64d47d9c7ef4c8e18948bb1a49cbaa7 100644 (file)
@@ -1,6 +1,6 @@
 ########################################################################
-# Copyright (C) 2021, 2022  Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier:  GPL-2.0  OR  LGPL-2.0
+# Copyright (C) 2021 - 2023  Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier:  GPL-3.0-or-later  OR  LGPL-3.0-or-later
 ########################################################################
 
 
@@ -55,9 +55,9 @@ LD  := $(CC) $(CFLAGS)
 MAN := man
 
 
-_SRCPAGEDIRS   := $(patsubst $(MANDIR)/%,$(_SRCDIR)/%.d,$(NONSO_MAN))
+_SRCPAGEDIRS   := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.d,$(NONSO_MAN))
 
-_UNITS_src_src := $(patsubst $(MANDIR)/%,$(_SRCDIR)/%,$(shell \
+_UNITS_src_src := $(patsubst $(MANDIR)/%,$(_MANDIR)/%,$(shell \
                $(FIND) $(MANDIR)/man*/ -type f \
                | $(GREP) '$(MANEXT)' \
                | $(XARGS) $(GREP) -l '^\.TH ' \
@@ -72,12 +72,12 @@ _UNITS_src_o   := $(patsubst %.c,%.o,$(_UNITS_src_c))
 _UNITS_src_bin := $(patsubst %.c,%,$(_UNITS_src_c))
 
 
-$(_SRCPAGEDIRS): $(_SRCDIR)/%.d: $(MANDIR)/% | $$(@D)/
+$(_SRCPAGEDIRS): $(_MANDIR)/%.d: $(MANDIR)/% | $$(@D)/
        +$(info MKDIR   $@)
        +$(MKDIR) $@
        +touch $@
 
-$(_UNITS_src_src): $$(patsubst $(_SRCDIR)/%.d,$(MANDIR)/%,$$(@D)) | $$(@D)
+$(_UNITS_src_src): $$(patsubst $(_MANDIR)/%.d,$(MANDIR)/%,$$(@D)) | $$(@D)
 $(_UNITS_src_c):   $$(filter $$(@D)/%.h,$(_UNITS_src_h))
 $(_UNITS_src_src):
        $(info SED      $@)
@@ -91,11 +91,11 @@ $(_UNITS_src_src):
        | $(SED) 's/^       //' \
        >$@
 
-$(_UNITS_src_o): $(_SRCDIR)/%.o: $(_SRCDIR)/%.c
+$(_UNITS_src_o): %.o: %.c
        $(info CC       $@)
        $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
 
-$(_UNITS_src_bin): $(_SRCDIR)/%: $(_SRCDIR)/%.o
+$(_UNITS_src_bin): %: %.o
        $(info LD       $@)
        $(LD) $(LDFLAGS) -o $@ $< $(LDLIBS)
 
index aab08698142fcbbfa8b0f0d12465ced2e73fc8b2..6c7493c5848dc6cda9552a483631f860243e4546 100644 (file)
@@ -1,6 +1,6 @@
 ########################################################################
-# Copyright (C) 2021, 2022  Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier:  GPL-2.0  OR  LGPL-2.0
+# Copyright (C) 2021 - 2023  Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier:  GPL-3.0-or-later  OR  LGPL-3.0-or-later
 ########################################################################
 
 
@@ -16,7 +16,6 @@ builddir := .tmp
 
 SYSCONFDIR := $(srcdir)/etc
 
-_SRCDIR := $(builddir)/src
 _MANDIR := $(builddir)/man
 
 
@@ -29,11 +28,9 @@ NONSO_MAN := $(shell $(FIND) $(MANDIR)/man*/ -type f \
                | $(XARGS) $(GREP) -l '^\.TH ' \
                | $(SORT))
 _MANDIRS := $(patsubst $(MANDIR)/%,$(_MANDIR)/%/,$(MANDIRS))
-_SRCDIRS := $(patsubst $(MANDIR)/%,$(_SRCDIR)/%/,$(MANDIRS))
 
 
 $(_MANDIRS): %/: | $$(dir %) $(_MANDIR)/
-$(_SRCDIRS): %/: | $$(dir %) $(_SRCDIR)/
 
 
 $(builddir)/%/:
index 92fec7ef89d9f1e3dbd32eda85a1c0bfd15df387..b896eb0e980d041512a367fe0b71dc3621e21c84 100644 (file)
@@ -21,15 +21,15 @@ MANDOCFLAGS         := $(DEFAULT_MANDOCFLAGS) $(EXTRA_MANDOCFLAGS)
 MANDOC              := mandoc
 
 
-_LINT_man_mandoc:=$(patsubst $(MANDIR)/%,$(_LINTDIR)/%.lint-man.mandoc.touch,$(NONSO_MAN))
-_LINT_man_tbl   :=$(patsubst $(MANDIR)/%,$(_LINTDIR)/%.lint-man.tbl.touch,$(NONSO_MAN))
+_LINT_man_mandoc:=$(patsubst $(MANDIR)/%,$(_MANDIR)/%.lint-man.mandoc.touch,$(NONSO_MAN))
+_LINT_man_tbl   :=$(patsubst $(MANDIR)/%,$(_MANDIR)/%.lint-man.tbl.touch,$(NONSO_MAN))
 
 
 linters_man := mandoc tbl
 lint_man    := $(foreach x,$(linters_man),lint-man-$(x))
 
 
-$(_LINT_man_mandoc): $(_LINTDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% | $$(@D)/
+$(_LINT_man_mandoc): $(_MANDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% | $$(@D)/
        $(info LINT (mandoc)    $@)
        ! ($(MANDOC) $(MANDOCFLAGS) $< 2>&1 \
           | $(GREP) -v 'STYLE: lower case character in document title:' \
@@ -43,7 +43,7 @@ $(_LINT_man_mandoc): $(_LINTDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% | $$(@D)/
        | $(GREP) '.' >&2
        touch $@
 
-$(_LINT_man_tbl): $(_LINTDIR)/%.lint-man.tbl.touch: $(MANDIR)/% | $$(@D)/
+$(_LINT_man_tbl): $(_MANDIR)/%.lint-man.tbl.touch: $(MANDIR)/% | $$(@D)/
        $(info LINT (tbl comment)       $@)
        if $(GREP) -q '^\.TS$$' $< && ! $(HEAD) -n1 $< | $(GREP) -q '\\" t$$'; \
        then \
index 347e8d12cbb88fff795b317855b733032957e67e..c81f283da87cc3374cf7ff7effa95082ba3765bf 100644 (file)
@@ -1,6 +1,6 @@
 ########################################################################
-# Copyright (C) 2021, 2022  Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier:  GPL-2.0  OR  LGPL-2.0
+# Copyright (C) 2021 - 2023  Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier:  GPL-3.0-or-later  OR  LGPL-3.0-or-later
 ########################################################################
 
 
@@ -8,22 +8,9 @@ ifndef MAKEFILE_LINT_INCLUDED
 MAKEFILE_LINT_INCLUDED := 1
 
 
-include $(srcdir)/lib/build.mk
-include $(srcdir)/lib/src.mk
-
-
-_LINTDIR   := $(builddir)/lint
-
-
-_LINTDIRS := $(patsubst $(MANDIR)/%,$(_LINTDIR)/%/,$(MANDIRS))
-
-
 lint := lint-c lint-man
 
 
-$(_LINTDIRS): %/: | $$(dir %) $(_LINTDIR)/
-
-
 .PHONY: lint
 lint: $(lint)
        @: