SYNOPSIS
makemake [-c] [-d] [-e var=val,…] [-q] [-u] [-x productions] [file|directory]
DESCRIPTION
This tool takes Makefiles generated by autotools and de-obfuscates them so that the result will still perform its build actions in an identical way but is in a form more suitable for modification by human beings.
Warnings with a sourcefile name and number in GNU compiler format will be issued on lines that are portability hazards.
Productions related to internal automake housekeeping (e.g. related to rebuilding configure, config.status, stamp files, and friends) are removed. This include some but not necessarily all undocumented productions with names ending in "-am".
Other than some trivial substitutions to patch out dependencies on autotools scripts, makemake does all its work by deleting unneeded text and selectively expanding make variables. Thus, the resulting de-obfuscated file will run correctly on any make that would have accepted the original.
Without a file or directory argument on the command line makemake is a filter.
With a file argument, the file is taken as input and the de-obfuscated form is written to standard output. This way of invoking the tool can include the file name in warning and error messages.
With a directory argument, makemake recurses into the directory and all its children; in each directory it moves Makefile into Makefile.bak, then filters Makefile.bak into Makefile. The backup file is left in place in case the transformation needs to be reverted.
When you are operating on a directory, Makefile references to config.h and HAVE_CONFIG_H will be suppressed only if config.h is absent. This allows your de-obfuscated file to be tested early, before you have removed <config.h> instances.
If config.h is absent, and a config.mk file (such as is generated by deconfig(1) earlier in the build conversion) is present, each file gets generated into it an inclusion of config.mk immediately after the config variable settings where it can override them.
Also when running on a directory, if a tests.mk file is present (which will normally be the case after deconfig runs) and the input Makefile does not already contain any test declarations, tests.mk is appended to the output Makefile.
Any given release of makemake is idempotent; that is, it does not modify Makefiles it has de-obfuscated. Later releases may add more de-obfuscations.
These options modify makemake’s behavior:
- -c
-
Clean. Assume the conversion has been successful; remove all autotools scripts and intermediate files and Makefile.bak files.
- -d
-
Enable debugging messages and display of processing stages. This is probably of interest only to makemake developers.
- -e
-
For each part of a comma-separated var=val list, expand var to val everywhere var is referenced, then remove the defintion of var.
- -q
-
Suppress progress messages and warnings, but not errors,
- -u
-
Undo. Move all Makefile.bak files back to Makefile. This does nothing if the backups don’t exist.
- -x
-
Declare a Python regular expression selecting additional targets to be removed; the target names are also removed where they occur as dependencies. For example, "-x \'dist.|clean.'" removes a lot of gnarly boilerplate code. An empty-string argument is special; it removes all autotools boilerplate except "all".
This tool is intended to be used with deconfig(1) to reduce a build recipe using autotools to bare Makefiles.
BUGS
The ylwrap wrapper generated by autotools will no longer be available in your build. You will need to fix up yacc and lex incvocations by hand.
Errors and warning related to a make variable with a value that is multi-line (continued by backslashes) always report the line number of the start of the definition, even if the error location is on a later line in the continuation.
REPORTING BUGS
Report bugs to Eric S. Raymond <esr@thyrsus.com>. The project page is at http://catb.org/~esr/autodafe
SEE ALSO
deconfig(1), configure(1).