(I didn't have any good name idea so "pea" may not be final)
As of now, the main thing pea can do is mimic the built-in EA preprocessor (to an extent, see the "EA Incompatibilities" section).
The main goal of pea right now is to be able to geneate Makefile dependencies from events.
If you feel like it, you can also use pea in a non-EA context. Since pea outputs to stdout by default you can even use it in a pipeline with something else.
Usage:
pea <input> [options]...
Options:
-o <file> - sets output (defaults to stdout)
-E - disables output
-D <name> - adds preprocessor definition
-I <directory> - adds extra directory to search included files in
-T <directory> - adds extra directory to seatch tools in
-M - enables generation of dependency Makefile (implies -E)
-MM - same as -M; doesn't add included files from extra directories (see -I)
-MD - enables generation of dependency Makefile as side-effect of regular preprocessing (doesn't imply -E)
-MMD - same as -MD; doesn't add included files from extra directories (see -I)
-MG - when generating dependency Makefile, adds missing included files to dependency
-MP - when generating dependency Makefile, adds phony targets for each file listed (except the main input)
-MF <file> - when generating dependency Makefile, sets output (defaults to stdout)
-MT <name> - when generating dependency Makefile, sets rule target
In addition to using the above options, you can also directly modify the underlying configuration using the following argument format:
-.<parameter><operation><value>
Where <parameter> is the name of the parameter (see below for a complete list), <operation> either '=' or '+=', and <value> the value you wish to set/add
Examples:
-.pp.tool.enableSystemTools=true
-.pp.include.extraIncludeDirectories+=/usr/include
Default parameter values:
boolean: pp.condition.enable = true
string-list: pp.eaCompat.binaryToolArguments = ["%%", "-byte", "--to-stdout"]
string: pp.eaCompat.binaryToolName = "bin2ea"
boolean: pp.eaCompat.enableBinary = true
boolean: pp.eaCompat.enableDirectiveAliases = true
boolean: pp.eaCompat.force = false
boolean: pp.emulate = false
boolean: pp.include.enable = true
boolean: pp.include.enableRootRelative = false
path-list: pp.include.extraIncludeDirectories = []
boolean: pp.include.ignoreMissingFiles = false
integer: pp.include.maxDepth = 100
path: pp.input = <no path>
boolean: pp.macro.enable = true
string-list: pp.macro.extraDefines = []
boolean: pp.macro.strictMacroFormat = false
boolean: pp.makedep.addPhonyTargetFiles = false
boolean: pp.makedep.enable = false
boolean: pp.makedep.noExtraIncludes = true
boolean: pp.makedep.noMissingFiles = true
boolean: pp.makedep.noToolArguments = true
path: pp.makedep.output = <no path>
boolean: pp.makedep.outputIsTarget = true
path: pp.makedep.target = <no path>
path: pp.output = <no path>
boolean: pp.tool.addToStdout = true
boolean: pp.tool.enable = true
boolean: pp.tool.enableLocalTools = false
boolean: pp.tool.enableSystemTools = false
path-list: pp.tool.extraToolDirectories = []
boolean: pp.tool.ignoreMissingTools = false
(You can also get this same help from invoking pea without arguments, or with -h/--help).
The options for this feature mostly follow the same names as the ones from gcc: -M, -MD, -MM, -MT, -MF, etc (see the option & parameter list from the help).
Here's an example output (pea -MM -MG -MT Out.gba -MP <other stuff>):
Out.gba: Main.event _FE8EssentialFixes.event _FE8ProcNameFix.event Events/Chapter.event Events/_CommonEvents.event IDoNotExist.bin
_FE8EssentialFixes.event:
_FE8ProcNameFix.event:
Events/Chapter.event:
Events/_CommonEvents.event:
IDoNotExist.bin:(-MG here allowed IDoNotExist.bin to be included in the list, even if it doesn't exist)
It works for #include, and also for #incbin and sometimes for the tool include directive family (if any argument correspond to an existing file relative to the current directory, it will be added to the list).
#eastereggisn't handled bypea, sadly.#runextisn't handled bypea(nobody seems to be using it anyway)#inctextand#incteventare aliases for#include_tool, and will be disabled if thepp.eaCompat.enableDirectiveAliasesparameter is cleared.#incbinand#incextrequire havingbin2eain one of the tool directories (or another similar tool, thepp.eaCompat.binaryTool&pp.eaCompat.binaryToolArgumentsparameters allow you to customize the tool call)- No support for EA built-in macros (
Switch,IsDefined, ...).#define,#undef,#if[n]defand macro expansions are still a thing don't worry.
(None of which really matters if you just use EA after this anyway, but if you're preprocessing and then feeding the output into EA, it might be useful stuff)
- With "
#define Macro(a, b) abracadabra"; "Macro(0, 1)" will expand to01r0c0d01r0in regular EA.peaallows for stricter Macro argument expansion through setting thepp.macro.strictMacroFormatoption (macro parameters will only match the format if it isn't surrounded by any letter or digit). - EA tools usually are all packed into a specific "tool" folder.
peaallows you to not only specify more of those folders (using the-T <folder>option or thepp.tool.extraToolDirectoriesparameter), but also:- call tools from the current directory (aka the directory the current file is in) (requires
pp.tool.enableLocalToolsto be set) - call tools from the system (reads the
PATHenv variable) (requirespp.tool.enableSystemToolsto be set)
- call tools from the current directory (aka the directory the current file is in) (requires
- EA also forces the
--to-stdoutoption for tool calls.peadoes it too by default, but it can be disabled through clearing thepp.tool.addToStdoutparameter.
pea uses boost (more specifically Boost.Filesystem and Boost.Process)... so good luck having that set up. I'll be working on porting to C++17 filesystem (for replacing Boost.Filesystem) and some smaller process library (for replacing Boost.Process), because working with boost was kind of a painful experience.
Otherwise just run CMake as for any other CMake project:
mkdir build
cd build
cmake ..
make