NAME motoconf — Simple build configuration tool SYNOPSIS motoconf -h | --help motoconf -c INPUT motoconf INPUT [project-options] [NAME=VALUE...] configure [project-options] [NAME=VALUE...] DESCRIPTION motoconf is a simple build configuration tool influenced by autoconf(1). motoconf creates output files from user-supplied templates, substituting all occurrences of user-declared placeholders with their corresponding values. The input script-provided defaults can be selectively overriden on the command line. This interface deliberately mimics autoconf(1) -generated configure scripts. The input script deliberately deviates from autoconf(1) being a POSIX sh(1) script using motoconf-provided functions. It should open with a call to mtc_register, and close with mtc_populate Makefile or equivalent. Motoconf Options -c INPUT Create a file named configure in current working directory. -h Display usage string. --help Display manual page. Project Options These options, if provided, must come after the INPUT argument. --prefix=DIR, --exec-prefix=DIR, --bindir=DIR, --sbindir=DIR, --libexecdir=DIR, --datarootdir=DIR, --datadir=DIR, --sysconfdir=DIR, --sharedstatedir=DIR, --localstatedir=DIR, --includedir=DIR, --docdir=DIR, --infodir=DIR, --htmldir=DIR, --dvidir=DIR, --pdfdir=DIR, --psdir=DIR, --libdir=DIR, --localedir=DIR, --mandir=DIR These options specify values of placeholders which define various installation paths for the configured package. The placeholder names are constructed by stripping the leading dashes and replacing any inner dashes with underscores. For example, --exec-prefix=/snafu sets the exec_prefix placeholder to /snafu. As in Autoconf, most of these directories are defined, by default, in terms of $prefix, $exec_prefix, and their subdirectories. As opposed to Autoconf , the default values are expanded eagerly, eg. when prefix='/snafu' then includedir='/snafu/include' rather than '${prefix}/include'. Default value of $prefix is /usr/local. --sysconfdir defaults to $prefix/etc; when $prefix is /usr, the default is /etc. --localstatedir defaults to $prefix/var; when $prefix is /usr, the default is /var. --docdir defaults to $datarootdir/doc. Placeholders Placeholders are @-delimited words (shell parameter names) occurring in output file templates. Builtin placeholders are PATH, srcdir, plus those defined by --prefix and related options. @PATH@ is substituted with the value of $PATH, @srcdir@ is substituted with the result of $(dirname "$mtc_input") where $mtc_input is the path to INPUT, @prefix@ is substituted with the value given with --prefix, @bindir@ is substituted with the value given with --bindir, and so on. Custom placeholder names are registered in the input script with mtc_register. Input script containing mtc_register -- string NAME VALUE instructs motoconf to replace, when copying output file templates into their destinations, all occurrences of @NAME@ with VALUE. Functions mtc_register -- KIND NAME VALUE [VALUE...] [-- KIND NAME VALUE [VALUE...]]... Takes a list of tuples, each introduced by two dashes (hyphens) and specifying rules for handling the value, the placeholder to replace in templates, and the value replacing it. KIND program NAME will be associated with the first VALUE which names an executable file. If VALUE contains no slash, it is looked up in $PATH. If none of the VALUEs match, motoconf aborts. string NAME will be associated with a string of given VALUEs separated by spaces. NAME Placeholder name. VALUE Any string. mtc_first_in_path FILE... Takes a list of filenames, and returns the first that could be found in $PATH. mtc_create_script DEST [SOURCE] Clobbers DEST with the result of placeholder substitutions applied to the contents of SOURCE or the standard input if omitted, and makes DEST executable. SOURCE is understood to be relative to input script's parent directory, unless it is - in which case the standard input is used, or the pathname as given starts with ./, in which case it is relative to $PWD. mtc_populate DEST [SOURCE] Clobbers DEST with the result of placeholder substitutions applied to the contents of SOURCE or $srcdir/DEST.in if omitted. SOURCE is understood to be relative to input script's parent directory, unless it is - in whch case the standard input is used, or the pathname as given starts with ./, in which case it is relative to $PWD. EXIT STATUS The motoconf utility exits 0 on success, and >0 if an error occurs. EXAMPLES The entire input script (moto.conf): mtc_register \ -- program CC gcc clang \ -- string CFLAGS "-std=c99 -fPIC -Wall -Wextra -Wfatal-errors" \ -- string CPPFLAGS "-D_POSIX_C_SOURCE=200809L" \ -- program LD "$CC" \ -- string LDFLAGS "" \ -- string LIBS "" \ -- program CRAMCMD cram cram3 cram2 \ -- program RST2HTMLCMD rst2html rst2html.py \ -- string RST2HTML --strict mtc_create_script mk-obj <<-'EOF' #!/bin/sh target="$1"; shift exec @CC@ @CPPFLAGS@ @CFLAGS@ -c -o"$target" "$@" EOF mtc_create_script mk-exe <<-'EOF' #!/bin/sh target="$1"; shift exec @LD@ @LDFLAGS@ -L"$PWD" -o"$target" "$@" @LIBS@ EOF mtc_create_script mk-so <<-'EOF' #!/bin/sh target="$1"; shift exec @LD@ --shared -Wl,--soname="$target" @LDFLAGS@ -o"$target" "$@" @LIBS@ EOF mtc_create_script mk-html <<-'EOF' #!/bin/sh exec @RST2HTMLCMD@ @RST2HTML@ "$@" EOF mtc_create_script mk-runtests <<-'EOF' #!/bin/sh exec env -i CRAM="$CRAM" PATH="@PATH@:@srcdir@/tests:$PWD" @CRAMCMD@ @srcdir@/tests EOF mtc_populate GNUmakefile GNUmakefile.in, used by the mtc_populate call at the end of moto.conf would include the following rules: VPATH = @srcdir@ check: ./mk-runtests %.html: %.rest ./mk-html $< $@ %.o: %.c ./mk-obj $@ $^ $(name): $(objects_exe) $(canonical) ./mk-exe $@ $(objects_exe) -l$(name) $(soname): $(objects_lib) ./mk-so $@ $(objects_lib) $(canonical): $(soname) ln -sf $< $@ The above inputs would be used in % motoconf moto.conf to generate GNUmakefile as well as the auxiliary tools (mk-runtests, mk-html, mk-obj, mk-exe, mk-so). SEE ALSO autoconf(1), make(1), sh(1). AUTHORS Roman Neuhauser <[email protected]> https://github.com/roman-neuhauser/motoconf/ BUGS No doubt plentiful. Please report them at https://github.com/roman-neuhauser/motoconf/issues
-
Notifications
You must be signed in to change notification settings - Fork 0
Simple build configuration tool
License
roman-neuhauser/motoconf
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Simple build configuration tool
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published