-#!/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
#
# 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
# * 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.
#
# 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
#
# 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.
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)
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
###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)
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