From 08f2c936123d27deeeb1cb81ff943aaf44beb131 Mon Sep 17 00:00:00 2001 From: b Date: Mon, 8 May 2023 20:55:24 +0000 Subject: [PATCH] self-generation --- configure.pl => configure.1.pl | 17 ++++++----------- makefile | 17 ++++++++++++++--- makefile.1.mak | 17 ++++++++++++++--- settings-direct.txt | 8 ++++++++ 4 files changed, 42 insertions(+), 17 deletions(-) rename configure.pl => configure.1.pl (97%) create mode 100644 settings-direct.txt diff --git a/configure.pl b/configure.1.pl similarity index 97% rename from configure.pl rename to configure.1.pl index d575160..34972c1 100755 --- a/configure.pl +++ b/configure.1.pl @@ -1,9 +1,9 @@ -#!/usr/bin/perl +###RUN_PERL: #!/usr/bin/perl # configure.pl # The new BOTM configuration tool -# Copyright (C) 2022 Balthasar Szczepański +# Copyright (C) 2022, 2023 Balthasar Szczepański # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -70,12 +70,7 @@ # # perl configure.pl --option1 ... name=value ... configfile1 configfile2 ... --input inputfile1 inputfile2 ... --output outputfile1 outputfile2 # -# Or './configure.pl' instead of 'perl configure.pl' but then we're making -# the assumption that Perl is installed at '/usr/bin/perl'. -# Of course we can make configure.pl conrigurable by configure.pl and then -# make it reconfigure itself to adapt to where Perl is but I decided to not -# go there. Instead I can handle this on the level of the makefile (which -# is configurable by configure.pl) +# Or './configure.pl' instead of 'perl configure.pl'. # # There are 3 types of commandline parameters: # * in form 'name=value' where 'name' is a valid setting name (described @@ -95,7 +90,7 @@ # * anything else will be treated as a path to a file: input, output, # or configuration. By default configuration files are expected. # -# The script reads configuration from all configuration iles given in the +# The script reads configuration from all configuration files given in the # command line parameters. The effect is similar to reading a single # concatenated file. # @@ -120,7 +115,7 @@ # In each line it looks for replacement patterns, replaces them if found, # and prints the line to the output. # -# Whenever I write 'whitespace' I mean it can space '' or TAB '\t'. +# Whenever I write 'whitespace' I mean it can be space ' ' or TAB '\t'. # # It is possible to include files like this: # include path_to_include @@ -146,7 +141,7 @@ # # In the second format (name = value) some processing is performed: # - Any amount (including 0) of whitespace is allowed before and -# after the '+'. +# after the '='. # - Comments starting from '#' are removed. # - whitespace at beginning and end of each line are removed # - escaped characters (by '\') are processed. diff --git a/makefile b/makefile index 33fbd94..1ab71ea 100644 --- a/makefile +++ b/makefile @@ -19,17 +19,25 @@ MKDIR = /usr/bin/mkdir BIN_DIR = /botm/bin/test-config +ifndef PERL +PERL = perl +endif -CONFIGURE = $(PERL) ./configure.pl +CONFIGURE = $(PERL) ./configure.1.pl all: exec -makefile: makefile.1.mak configure.pl $(CONFIGFILE) +makefile: makefile.1.mak configure.1.pl $(CONFIGFILE) $(CONFIGURE) $(CONFIGFILE) < makefile.1.mak > makefile +configure.pl: configure.1.pl + $(CONFIGURE) $(CONFIGFILE) < configure.1.pl > configure.pl + exec: configure.pl $(CHMOD) +x configure.pl +ifdef BIN_DIR + bin_dir: $(MKDIR) -p $(BIN_DIR) @@ -42,9 +50,12 @@ rm_bin: install: cp_bin uninstall: rm_bin - + +endif + clean: $(CONFIGURE) $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile + $(RM) configure.pl PHONY: all exec bin_dir cp_bin rm_bin install uninstall clean diff --git a/makefile.1.mak b/makefile.1.mak index 6adcfc4..3f8ac08 100644 --- a/makefile.1.mak +++ b/makefile.1.mak @@ -19,17 +19,25 @@ DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt ###make_bin_dir: BIN_DIR = /botm/bin/configure +ifndef PERL +PERL = perl +endif -CONFIGURE = $(PERL) ./configure.pl +CONFIGURE = $(PERL) ./configure.1.pl all: exec -makefile: makefile.1.mak configure.pl $(CONFIGFILE) +makefile: makefile.1.mak configure.1.pl $(CONFIGFILE) $(CONFIGURE) $(CONFIGFILE) < makefile.1.mak > makefile +configure.pl: configure.1.pl + $(CONFIGURE) $(CONFIGFILE) < configure.1.pl > configure.pl + exec: configure.pl $(CHMOD) +x configure.pl +ifdef BIN_DIR + bin_dir: $(MKDIR) -p $(BIN_DIR) @@ -42,9 +50,12 @@ rm_bin: install: cp_bin uninstall: rm_bin - + +endif + clean: $(CONFIGURE) $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile + $(RM) configure.pl PHONY: all exec bin_dir cp_bin rm_bin install uninstall clean diff --git a/settings-direct.txt b/settings-direct.txt new file mode 100644 index 0000000..09b5d8a --- /dev/null +++ b/settings-direct.txt @@ -0,0 +1,8 @@ +target: direct +bin_dir: + +perl: /usr/bin/perl +chmod: /usr/bin/chmod +cp: /usr/bin/cp +rm: /usr/bin/rm +mkdir: /usr/bin/mkdir -- 2.30.2