From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 03/12] Makefile: Ugly hack to get a "plain" Markdown version of README Date: Thu, 18 Aug 2022 22:22:26 +0200 Message-ID: <20220818202235.1591828-4-sbrivio@redhat.com> In-Reply-To: <20220818202235.1591828-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9042678460761368838==" --===============9042678460761368838== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Distribution packages reasonably expect to have a human-readable Markdown version of the README under /usr/share/doc/, but all we have right now is a heavily web-oriented version. Introduce a ugly hack to strip web-oriented parts from the current README and install it. It should probably work the other way around: a human-readable README could be used as a source for the web page. But cgit needs a file that's in the tree, not something that can be built, and https://passt.top/ is based on cgit. It should eventually be doable to work around this in cgit, instead. Reported-by: Benson Muite Signed-off-by: Stefano Brivio --- Makefile | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0de872e..f03d117 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ else BIN :=3D passt pasta qrap endif =20 -all: $(BIN) $(MANPAGES) +all: $(BIN) $(MANPAGES) docs =20 static: CFLAGS +=3D -static -DGLIBC_NO_STATIC_NSS static: clean all @@ -123,12 +123,14 @@ valgrind: all clean: $(RM) $(BIN) *.o seccomp.h pasta.1 \ passt.tar passt.tar.gz *.deb *.rpm \ - passt.pid + passt.pid README.plain.md =20 -install: $(BIN) $(MANPAGES) +install: $(BIN) $(MANPAGES) docs mkdir -p $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/share/man/man1 cp -d $(BIN) $(DESTDIR)$(prefix)/bin cp -d $(MANPAGES) $(DESTDIR)$(prefix)/share/man/man1 + mkdir -p $(DESTDIR)$(prefix)/share/doc/passt + cp -d README.plain.md $(DESTDIR)$(prefix)/share/doc/passt/README.md =20 uninstall: $(RM) $(BIN:%=3D$(DESTDIR)$(prefix)/bin/%) @@ -147,6 +149,28 @@ pkgs: static --description=3D"User-mode networking for VMs and namespaces" \ -k --version=3Dg$(shell git rev-parse --short HEAD) passt.tar.gz =20 +# TODO: This hack makes a "plain" Markdown version of README.md that can be +# reasonably shipped as documentation file, while the current README.md is +# definitely intended for web browser consumption. It should probably work t= he +# other way around: the web version should be obtained by adding HTML and +# JavaScript portions to a plain Markdown, instead. However, cgit needs to u= se +# a file in the git tree. Find a better way around this. +docs: README.md + @( \ + skip=3D0; \ + while read l; do \ + case $$l in \ + "## Demo") exit 0 ;; \ + " README.plain.md + # Checkers currently disabled for clang-tidy: # - llvmlibc-restrict-system-libc-headers # TODO: this is Linux-only for the moment, nice to fix eventually --=20 2.35.1 --===============9042678460761368838==--