From: Andre Noll Date: Tue, 14 May 2024 23:49:22 +0000 (+0200) Subject: build: Move description text to separate file. X-Git-Tag: v1.0.0~6 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=280a3a4df1578a2377b1b213c4e7d2193db5e279;p=micoforia.git build: Move description text to separate file. The three description texts are passed to m4 via -D var=val command line options, and they are output by the README target. The C preprocessor does not need them, though. This patch renames the README file to README.m4, moves the part of the Makefile which defines the README variable to README.m4 and adjusts the README rule to run m4 on README.m4 to expand the descriptions. As as result, the three -D descriptionX options to m4 are now the only place where the corresponding make variables are used. Since the values consist of multiple lines, the verbose make output looks rather messy, so create defs.m4 and include this file before the real input file is read. Switch to sane m4 quoting characters while at it. --- diff --git a/Makefile b/Makefile index 582a352..c214619 100644 --- a/Makefile +++ b/Makefile @@ -39,11 +39,23 @@ deps := $(addprefix $(B)/, $(addsuffix .d, $(units))) objs := $(addprefix $(B)/, $(addsuffix .o, $(units))) ifeq ($(findstring clean, $(MAKECMDGOALS)),) -ifeq ($(findstring README, $(MAKECMDGOALS)),) -include $(deps) -include $(B)/config.mak endif -endif + +M4 += \ + -D "AUTHOR=$(AUTHOR)" \ + -D "COPYRIGHT_YEAR=$(COPYRIGHT_YEAR)" \ + -D "PACKAGE=$(PACKAGE)" \ + -D "SLOGAN=$(SLOGAN)" \ + -D "EMAIL=$(EMAIL)" \ + -D "URL=$(URL)" \ + -D "CLONE_URL=$(CLONE_URL)" \ + -D "GITWEB_URL=$(GITWEB_URL)" \ + -D "HOME_URL=$(HOME_URL)" \ + -D "LICENSE=$(LICENSE)" \ + -D "LICENSE_URL=$(LICENSE_URL)" \ + defs.m4 XCPPFLAGS := XCPPFLAGS += -I$(B) @@ -118,47 +130,9 @@ $(B)/config.mak $(B)/config.h: $(B)/config.status config.mak.in $(B)/config.h.in ./config.status -q test -f config.h && touch config.h -define DESCRIPTION1 := - $(PACKAGE) is a lightweight container implementation for Linux. - It consists of a single program which reads a single configuration - file that describes all containers. $(PACKAGE) was written with - performance and simplicity in mind, and is designed for trusted - in-house web application hosting. -endef - -define DESCRIPTION2 := - Like other container frameworks, $(PACKAGE) employs Linux namespaces - for isolation and cgroup controllers to limit the resource utilization - of the containers. Networking is implemented through bridging and - virtual ethernet device pairs. There is built-in support for the cpu, - memory, I/O and device controllers. Further customization is possible - via startup hooks. For example, the startup hook could activate - additional cgroup controllers, make the container enter a different - namespace, and mount additional file systems. -endef - -define DESCRIPTION3 := - The micoforia program supports a couple of subcommands. Besides - the start subcommand which starts one or more containers, there are - subcommands for listing, killing or rebooting containers. -endef - -# dependency on config.mak is because the command below depends on $(M4) $(B)/index.html $(B)/micoforia.suite: $(B)/%: %.m4 Makefile $(B)/config.mak $(call SAY, M4 $<) - $(M4) -D "AUTHOR=$(AUTHOR)" -D "COPYRIGHT_YEAR=$(COPYRIGHT_YEAR)" \ - -D "PACKAGE=$(PACKAGE)" \ - -D "SLOGAN=$(SLOGAN)" \ - -D "EMAIL=$(EMAIL)" \ - -D "URL=$(URL)" \ - -D "CLONE_URL=$(CLONE_URL)" \ - -D "GITWEB_URL=$(GITWEB_URL)" \ - -D "HOME_URL=$(HOME_URL)" \ - -D "LICENSE=$(LICENSE)" \ - -D "LICENSE_URL=$(LICENSE_URL)" \ - -D "DESCRIPTION1=$(DESCRIPTION1)" \ - -D "DESCRIPTION2=$(DESCRIPTION2)" \ - -D "DESCRIPTION3=$(DESCRIPTION3)" $< > $@ + $(M4) $< > $@ $(B)/%.lsg.c: $(B)/%.suite $(call SAY, LSGC $<) $(LOPSUBGEN) --gen-c --output-dir $(B) < $< @@ -198,52 +172,8 @@ distclean: clean maintainer-clean: git clean -dfqx > /dev/null 2>&1 -define README := -$(PACKAGE) - $(SLOGAN) - -$(DESCRIPTION1) - -$(DESCRIPTION2) - -$(DESCRIPTION3) - -Resources -~~~~~~~~~ -| web page: $(URL) -| git clone URL: $(CLONE_URL) -| gitweb: $(GITWEB_URL) -| author's home page: $(HOME_URL) -| Send feedback to: $(AUTHOR) <$(EMAIL)> - -License -~~~~~~~ -Open source, licensed under the $(LICENSE). - -Documentation -~~~~~~~~~~~~~ -See micoforia.suite.m4. Or build the man page with \"make\" and run -\"man -l micoforia.8\". - -Dependencies -~~~~~~~~~~~~ -This package requires m4, autoconf, gnu make, gcc or clang, and -lopsub. The configure script checks if all dependencies are installed -and prints a meaningful error message if one of them is missing. - -Building -~~~~~~~~ -Run \"make\" to build the package with the default settings. Run -\"./configure -h\" to list configuration options. - -Installation -~~~~~~~~~~~~ -Run \"sudo make install\" to install to /usr/local. To install to -/somewhere/else, run \"./configure --prefix /somewhere/else && make\" -first. -endef - -README: - @printf '%s\n' "$(README)" +README: README.m4 Makefile $(B)/config.mak + @$(M4) $< .PRECIOUS: $(B)/%.lsg.c $(B)/%.lsg.h $(B)/%.8 .PHONY: all clean install distclean maintainer-clean README diff --git a/README b/README deleted file mode 100644 index 52a1fd7..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -Run "make README". diff --git a/README.m4 b/README.m4 new file mode 100644 index 0000000..5932038 --- /dev/null +++ b/README.m4 @@ -0,0 +1,42 @@ +dnl Run "make README" to see the below with variables expanded +PACKAGE() - SLOGAN() + +DESCRIPTION1() + +DESCRIPTION2() + +DESCRIPTION3() + +Resources +~~~~~~~~~ +| web page: URL() +| git clone CLONE_URL() +| gitweb: GITWEB_URL() +| author's home page: HOME_URL() +| Send feedback to: AUTHOR() + +License +~~~~~~~ +Open source, licensed under the LICENSE(). + +Documentation +~~~~~~~~~~~~~ +See micoforia.suite.m4. Or build the man page with \"make\" and run +\"man -l micoforia.8\". + +Dependencies +~~~~~~~~~~~~ +This package requires m4, autoconf, gnu make, gcc or clang, and +lopsub. The configure script checks if all dependencies are installed +and prints a meaningful error message if one of them is missing. + +Building +~~~~~~~~ +Run \"make\" to build the package with the default settings. Run +\"./configure -h\" to list configuration options. + +Installation +~~~~~~~~~~~~ +Run \"sudo make install\" to install to /usr/local. To install to +/somewhere/else, run \"./configure --prefix /somewhere/else && make\" +first. diff --git a/defs.m4 b/defs.m4 new file mode 100644 index 0000000..bccadfa --- /dev/null +++ b/defs.m4 @@ -0,0 +1,25 @@ +divert(-1) +changequote(`«', `»') +define(«DESCRIPTION1», «dnl +PACKAGE() is a lightweight container implementation for Linux. +It consists of a single program which reads a single configuration +file that describes all containers. PACKAGE() was written with +performance and simplicity in mind, and is designed for trusted +in-house web application hosting.») + +define(«DESCRIPTION2», «dnl +Like other container frameworks, PACKAGE() employs Linux namespaces +for isolation and cgroup controllers to limit the resource utilization +of the containers. Networking is implemented through bridging and +virtual ethernet device pairs. There is built-in support for the cpu, +memory, I/O and device controllers. Further customization is possible +via startup hooks. For example, the startup hook could activate +additional cgroup controllers, make the container enter a different +namespace, and mount additional file systems.») + +define(«DESCRIPTION3», «dnl +The PACKAGE() program supports a couple of subcommands. Besides +the start subcommand which starts one or more containers, there are +subcommands for listing, killing or rebooting containers.») + +divert(0)dnl diff --git a/index.html.m4 b/index.html.m4 index a0d8ecc..92ab424 100644 --- a/index.html.m4 +++ b/index.html.m4 @@ -39,7 +39,7 @@ dnl SPDX-License-Identifier: GPL-2.0-only

Resources