@profoundlogic/codermake
v1.4.3
Published
Make wrapper framework for IBM i development that simplifies build rules
Readme
codermake
A make wrapper framework for IBM i development that simplifies build rules and abstracts platform-specific complexity.
Features
- Simplified Rules: Write clean, maintainable build rules in
Rules.mkfiles - Platform Agnostic: Same rules work on IBM i and Unix-like systems (Linux, macOS, FreeBSD, etc.)
- Automatic Discovery: Automatically finds and processes Rules.mk files in your project
- Recipe Inference: Automatically determines build recipes based on file extensions
- Remote Builds: Build from Unix-like systems to IBM i via SSH
Installation
npm install -g @profoundlogic/codermakeQuick Start
1. Set up environment variables
On IBM i (local build):
export BUILD_LIBRARY=DEVLIBOn Unix-like systems (remote build via SSH):
export IBMI_BUILD_LIBRARY=DEVLIB
export IBMI_HOST=ibmi.example.com
export IBMI_USER=devuser
export IBMI_KEY=/path/to/ssh/key # Optional2. Create a Rules.mk file
Create src/Rules.mk:
# Simple program with display file
hellor.pgm: hellor.rpgle hellod.file
# Display file
hellod.file: hellod.dspf3. Build
codermakeRules.mk Syntax
Basic Rule Format
target: prerequisitesSupported File Types
Output Objects:
.pgm- Program.module- Module.srvpgm- Service Program.file- File (display, physical, logical).menu- Menu.msgf- Message File.bnddir- Binding Directory
Source Files:
.rpgle- ILE RPG source.sqlrpgle- SQL RPG source.clle- ILE CL source.cl- OPM CL source.clp- OPM CL source (alternate).dspf- Display file DDS.pf- Physical file DDS.lf- Logical file DDS.prtf- Printer file DDS.table.sql- SQL table definition.index.sql- SQL index definition.proc.sql- SQL procedure definition.json- Rich Display File (RDF) JSON (when first prerequisite of.filetarget).msgf- Message file CL commands (when first prerequisite of.msgftarget).bnddir- Binding directory CL commands (when first prerequisite of.bnddirtarget).exportsor.bnd- Service program export list
Note: .msgf and .bnddir files serve dual purposes:
- As source: When appearing as the first normal prerequisite of a matching target type (e.g.,
app.msgf: app.msgf) - As object: In all other contexts (e.g., as prerequisites of other target types or non-first prerequisites)
Examples
Simple Program:
mypgm.pgm: source.rpgleService Program:
mymod.module: source.rpgle
mysrvpgm.srvpgm: mymod.module myexports.exportsProgram from Modules (with automatic binding):
calc.module: calc.rpgle
calc.pgm: calc.module utils.srvpgm # BNDSRVPGM(utils) added automatically
calcd.pgm: calcd.module | app.bnddir # BNDDIR(app) added automatically.srvpgm and .bnddir prerequisites work as either normal or order-only; the automatic BNDSRVPGM()/BNDDIR() parameters are generated either way. This only applies to module-based programs (CRTPGM/CRTSRVPGM), not source-based programs (e.g., CRTBNDRPG).
Program with Dependencies:
hellor.pgm: hellor.rpgle hellod.file custr.srvpgmNote: This is a source-based program (CRTBNDRPG), so custr.srvpgm is a build-ordering dependency only — no BNDSRVPGM() parameter is generated. Binding is typically handled via a BNDDIR control specification in the RPG source.
Rich Display File from JSON:
mydisplay.file: mydisplay.jsonCL Programs:
# ILE CL
hellocl.pgm: hellocl.clle
# OPM CL
simpgm.pgm: simpgm.clp
# CL Module
mathmod.module: mathmod.clle
mathpgm.pgm: mathmod.modulePrinter File:
helloprt.file: helloprt.prtfSQL Objects:
employee.file: employee.table.sql
empname.file: empname.index.sql employee.file
getcount.pgm: getcount.proc.sql employee.fileOrder-Only Prerequisites:
mypgm.pgm: source.rpgle | mybnddir.bnddirOrder-only prerequisites must exist before building the target but do not trigger a rebuild when they change. Note: for source-based programs like the above (CRTBNDRPG), no automatic BNDDIR() parameter is generated — the binding directory is typically specified via a BNDDIR control specification in the RPG source instead.
Command-Line Options
codermake [options] [targets...]Options
--help- Show help message--version- Show version--debug- Enable debug output--print-rules- Print preprocessed rules and exit--print-makefile- Generate standalone Makefile for debugging--license-show- Show license status--license-set=<key>- Install a license key
All other options are passed through to GNU Make. See make --help for additional options.
Examples
Build all targets:
codermakeBuild specific target:
codermake hellor.pgmParallel build:
codermake -j4Dry run:
codermake -nClean:
codermake cleanDebug preprocessing:
codermake --print-rulesProject Structure
project/
├── src1/
│ ├── Rules.mk # Build rules for src1/
│ ├── hellor.rpgle
│ └── hellod.dspf
├── src2/
│ ├── Rules.mk # Build rules for src2/
│ └── custr.rpgle
|── tmp/ # Build outputs (gitignored)
| └── logs/ # Compiler output logs
└── build/ # Dummy IBM i objects (Unix-type systems only, gitignored)How It Works
- Platform Detection: Detects IBM i vs Unix-like system
- Rules Discovery: Finds all
Rules.mkfiles in immediate subdirectories - Preprocessing: Transforms simplified rules into full GNU Make syntax
- Recipe Inference: Automatically determines build recipes from file extensions
- Execution: Invokes GNU make with generated rules
RPG /COPY and /INCLUDE Preprocessing
codermake automatically handles legacy RPG /COPY and /INCLUDE directives written in source member style. Source member references are converted to IFS stream file paths during compilation, allowing the same source to work in both source member and stream file environments.
See design/RPG_COPY_PREPROCESSING.md for details.
Requirements
- Node.js: >= 22.0.0
- GNU Make: >= 4.0
- SSH: For remote builds from Unix-like to IBM i
Author
Profound Logic Software
