@halcyontech/rmake v0.0.18
rmake
rmake is a tool used to generate a makefile for RPGLE projects.
General usage
rmake will scan the sources in the current working directory (CWD) and generate a makefile based on the results.
rmake && gmake BIN_LIB=libnameProject structure
rmake does not care about project structure, but does enforce these rules for source code names:
- the object name is the basename of the source file
- if your source includes
.pgm, then it will become a program.mypgm.pgm.rpglebecomes aMYPGM.PGMobject
- if your source does not include
.pgm, then it will become a module, cmd, dtaara, etc.mysrvpgm.rpglebecomesMYSRVPGM.MODULEand thenMYSRVPGM.PGM
- rmake only supports single module programs and service programs
- rmake does not yet support SQL long name references.
Changing compile options
The iproj.json can contain a compiles property to customise how each extension type gets compiled. To generate the defaults, you can use rmake --init to create or update the iproj.json file. When you define an extension in the compiles property, the properties of it will override the rmake defaults.
Here is the schema for the compiles option:
interface iProjFile {
compiles: {[extension: string]: CompileData};
}
interface CompileData {
/** indicates what type of object will be built from this source */
becomes: ObjectType;
/** will copy the source to a temp member first */
member?: boolean,
/** `commands` do not respect the library list and is run before 'command' */
commands?: string[]
/** `command` does respect the library list */
command?: string;
/** Used if the commands are built up from source. Usually means `command` and `commands` is blank */
commandSource?: boolean;
/** if the non-source object now requires source. Use make generic name like `qbndsrc/%.bnd` */
targetSource?: string;
};Example: service program binder source
By default, rmake uses EXPORT(*ALL) on CRTSRVPGM. This can be overridden in the iproj.json file:
This definition means that if I am creating a service program named TOOLS.SRVPGM, qbndsrc/TOOLS.bnd needs to exist.
{
"compiles": {
"srvpgm": {
"targetSource": "qbndsrc/%.bnd",
"command": "CRTSRVPGM SRVPGM($(BIN_LIB)/$*) MODULE(*SRVPGM) SRCSTMF('$<') BNDDIR($(BNDDIR))"
}
}
}Example: build object from commands
Objects like data areas do not have source. In the compiles property, there is a flag that can be used to tell rmake to get the commands from the source.
"dtaara": {
"becomes": "DTAARA",
"commandSource": true
}So if a file exists named version.dtaara, then the CL commands inside it will be used to create that .DTAARA object.
CRTDTAARA DTAARA(*CURLIB/VERSION) TYPE(*CHAR) LEN(20)
CHGDTAARA DTAARA(*CURLIB/VERSION) VALUE('1.0')When commandSource is enabled, CL commands may error but that will not stop the build as these errors are ignored.