Skip to main content

Generate IBM i Build Rules

The Generate IBM i Build Rules tool analyzes IBM i objects—*PGM, *SRVPGM, *FILE (PF, LF, DSPF, PRTF), and *BNDDIR—and produces Rules.mk files, plus any required binding directory (.bnddir) source files, for codermake. Use it to bootstrap a repository's build configuration from existing objects, or to regenerate rules after adding new programs.

No source code is downloaded—only build rules. If you need the sources too, use Import IBM i Sources separately.

When the repository defines IBM i applications, generate the rules for all of them in one run, each analyzed with its own library list: choose All applications when you select objects. See Build Rules for All Applications.

Prerequisites​

  • An administrator has enabled IBM i Source Import on one of the environment's repositories (see Environments). The target repository must also have a Git provider configured so existing Rules.mk files can be fetched for merging and source files can be validated.
  • Your role includes the IBM i Import permission (included in the Environment Admin role).
  • The IBM i system has its SSH daemon running. The tool connects directly over SSH from the CoderFlow server to run object analysis.
  • Valid IBM i host, user profile, and password credentials. Credentials are held in server memory for the session only.
  • The user profile has authority to install the objx tool the first time you connect. On first use the tool creates a library (default PLOBJX) via CRTLIB, uploads a save file to that library over SFTP, and restores the tool's programs with RSTOBJ. Subsequent sessions reuse the existing library. The profile therefore needs CRTLIB (or a pre-created library named in the advanced objx Tool Library field with *CHANGE authority) and RSTOBJ authority. If your profile can't create libraries, ask an administrator to create an empty library for the tool and grant you *CHANGE authority on it.
  • The user profile has authority to discover and analyze the objects you want to build rules for—*USE on the libraries being browsed and *OBJOPR on the objects, plus read authority on the source members the analyzer resolves. Objects the profile can't read are reported as errors in the review step and skipped.

Launching the Tool​

From the main task launcher, open the actions menu and choose Generate IBM i Build Rules.... Visibility is gated by the same conditions as Import Sources.

Workflow​

Four steps: Connect, Select, Analyze, Review.

1. Connect​

Enter host, user, and password. The Advanced section exposes the objx Tool Library (default PLOBJX). If you previously saved a custom library list or a source search library list for this host, it's applied automatically on connect. A loaded profile that covers all applications, or names one application, says so under Profile, and the applications' lists are used instead.

2. Select Objects​

Libraries in your IBM i library list appear as expandable rows. Expanding a library fetches its objects page-by-page with filters for name pattern and object type (*ALL, *PGM, *SRVPGM, *FILE, *BNDDIR). IBM-supplied Q* libraries are omitted.

Selection is additive across filter passes—check-all adds every object matching the current filter to the selection, so you can build it up over multiple passes (A* → check, B* → check, result is A∪B). Changing a filter never clears selections.

The card header provides:

  • Library List — customize the user portion of the library list for this session, highest priority first. You can paste several libraries at once, separated by new lines, spaces or commas, then reorder, rename or remove them. An empty list means the library list from your job description (JOBD). When you choose Apply list, the list is validated against the IBM i before it takes effect; if the IBM i refuses it, the dialog stays open with the error. The list is saved on the server per host. It's unavailable while the repository's applications give the lists.
  • Options — analysis and rule generation options (see below), plus the shared Source Type Mappings editor.
  • Branch — when the repo allows branch selection, this chooses which branch existing Rules.mk files are merged from and which branch the resulting task runs on. With applications, it is also the branch the applications are read at.
  • Application — shown, with Stage, when the branch defines applications, when the loaded profile uses them, or when the repository couldn't be read. All applications analyzes every application with its own list (see Build Rules for All Applications); an application's name analyzes the objects you select with that application's list (see One application, for exceptions); None: use the Library List uses your own list.
  • Stage — which of each application's lists analysis uses, usually production. It starts at production when the repository defines it.

The global count N objects selected sums across libraries. With All applications, the All applications panel replaces the library tree, and the count shows the applications and libraries the run covers.

To reuse a selection, choose Save Profile in Review, then select that profile on Connect in a later session. Profiles are saved per environment.

Build rule selection filtered to STOCKUPD while retaining four selected objects across BOOK and STOCK filters

Options

  • Require sources for files (on by default) — when off, sourceless *FILE objects are dropped instead of blocking rule generation: a sourceless file you selected is skipped, and a sourceless file dependency is removed from the dependent object so the dependent still builds.
  • Allow missing file dependencies (off by default) — downgrades missing file-dependency errors to warnings.
  • Search for object sources (off by default) — lets objx search the system for source members rather than only using locations stored on the object. The source search settings under it decide when the search runs and where it looks (see Source search settings below).
  • Generate rules for cross-library dependencies (on by default) — controls how object dependencies that cross library boundaries are handled. When on, every cross-library dep is fully resolved: rules for the dep go into its own library's Rules.mk, and the parent rule references it via a library-qualified order-only prereq (e.g. util/usrv.srvpgm). When off, cross-library object deps are dropped unless the dep itself is part of your selection — a directly-selected cross-library object still gets its rules and prereqs generated. Source prerequisites are always included regardless of this option.
  • Retain cross-library bound modules (on by default) — applies when cross-library dependency rules are off. Keeps modules bound into a service program or multi-module ILE program, with their rules written into the finished object's library.
  • Replace existing Rules.mk content (off by default) — when off, newly generated rules are merged into any existing Rules.mk files: rules for matching targets are replaced and unrelated existing rules are preserved. When on, each affected Rules.mk is overwritten with only the newly generated rules.

Source search settings

Three settings under Search for object sources control the search for an object's own source. They need Search for object sources on: while it's off they're disabled and have no effect.

  • Always search (off by default) — searches for every recorded source member, even one that exists, by the same source file and member name. The search's result is the object's only source, and the recorded member is never used as a fallback. Without Always search, a recorded member that exists is used as is, and the search runs only when it's missing.
  • Own library (Off by default) — how the search treats the library of the object being analyzed:
    • Off — the object's library gets no special treatment. The search uses the source search library list, or the user portion of the job library list when that list is empty.
    • First — the object's library is searched first, even when the source search library list doesn't include it. Then the search uses the source search library list, or the user portion of the job library list when that list is empty.
    • Only — only the object's library is searched. The source search library list has no effect and can't be edited, and the job library list isn't searched either. If the object's library doesn't have the source, the object has no source.
  • Source search library list (empty by default) — the libraries the search looks in, in order, after the object's library when Own library is First. An empty list means the user portion of the job library list. Edit opens the same library list dialog as Library List. When you apply the list, its libraries are checked on the connected system, and a library that isn't found keeps the dialog open with an error.

With Search for object sources on, the settings apply to every search for an object's own source:

  • a recorded source member that's missing, or every recorded member with Always search;
  • a physical or logical file that records no source;
  • the source of an SQL procedure, function or trigger.

They also apply to the files, service programs and modules reached as dependencies, as if you had selected them. For a module bound into a program or service program, the object's library is the library of that program or service program.

The settings don't affect how objects are located. Copy members and includes, and the files, modules, service programs and binding directories an object depends on, are always found on the main library list (Library List).

With Always search on, an object whose source the search doesn't find has no source, even when its recorded member exists. With Own library set to Off and an empty source search library list, that includes an object whose recorded member is in a library outside the user portion of the job library list: the search doesn't look in that library.

For example, if programs in HARBOR were last compiled from development copies in HARBORDEV, their recorded members are in HARBORDEV. With Always search on and Own library set to First, the search looks in HARBOR first, so the generated rules use the source in HARBOR wherever HARBOR has it.

Always search and Own library are saved with the other options. The source search library list is saved on the server per host, like Library List. A profile saves all three, including its own source search library list, and IBM i Import automations that run the profile use them. If a library in the list no longer exists when an analysis that uses the list runs, the analysis fails and every object reports Source search library "LIB" not found. for that library.

Build rule options with Search for object sources on, Always search checked, Own library set to First and HARBORSRC as the source search library list

3. Analyze​

Progress streams live with per-object status (OK, warning, error). The tool runs objx in batches to collect object metadata, emits Rules.mk for each affected library, and validates that every source referenced by a generated rule actually exists on the target repository and branch (via the Git provider).

Rule generation errors are non-blocking: affected targets are skipped and the remaining rules are still generated.

With All applications, the log names each application as it starts, with its libraries and library list, and then its result. See Analyze and review.

4. Review & Generate​

A summary shows objects analyzed, rules emitted, failed, and skipped counts, and the list of libraries covered. After an all-applications analysis, an Applications section lists each application's result (see Analyze and review). Errors, warnings, and skipped objects are listed in collapsible sections. The download icon exports a .tar.gz archive of the analysis artifacts for inspection.

Errors are grouped by root cause. One broken dependency puts an error on every object that depends on it, so a widely bound service program can account for hundreds of rows that are all the same failure. Blocked for dependency error lists one row per broken dependency — named with its error code and the number of objects it blocks — which expands to the library-qualified affected objects. Object errors lists errors on the object itself, unchanged. A search box filters both, matching root causes and the objects they block, so you can still find a specific object by name.

Build rule review with one generated rule and three programs grouped under the BOOKUTIL dependency error

Click Generate Rules to create a task. The generated Rules.mk files (and any .bnddir files) are injected into the repository inside the task container under {library}/ directories; analysis artifacts are also placed at /tmp/ibmi-import/ for the agent and for later inspection. An AI agent writes a summary and commit message. From there, use the standard approval flow to commit and push. An all-applications analysis creates one task with every application's rules.

Build Rules for All Applications​

When the repository defines IBM i applications, one build-rules profile covers all of them. You run it once. Behind the scenes, CoderFlow runs one analysis for each application, with that application's library list at the profile's stage and over the library directories it lists, and puts every application's rules in one task to review and approve.

Choosing All applications​

On Select Objects, choose All applications under Application, and the stage under Stage, usually production. The All applications panel replaces the library tree, with one row per application the branch defines:

ColumnShows
ApplicationThe application's name
Libraries analyzedThe libraries of the directories it lists. A directory whose name isn't the lower-case name of an IBM i library is shown as not analyzed, because rules are written into that directory
Library listIts library list at the stage
OverridesWhat its overrides change, or None
RulesWhether its rules were generated with its definition now (see Stale rules)
ActionsOverrides and Regenerate

A status line names the branch and the commit the applications were read at. There are no objects to select: the applications say what is analyzed, so the count shows the applications and libraries the run covers, and the button reads Analyze All Applications. Library List is unavailable, because each application brings its own list. If the branch doesn't define applications, or doesn't define the stage, the panel says why; choose another stage, or None: use the Library List.

Select Objects with Application set to All applications at stage production, and the All applications panel listing ORDERS with stale rules and BILLING with a source search override

How each application is analyzed​

  • One analysis per application, one after another, in the order .codermake/config.json lists them, on the same connection.
  • Over the library directories it lists, every object in each.
  • With its own library list at the stage.
  • Within its own libraries. A dependency gets a rule only when its library is one of the application's own, so its rules never reach another application's directories, whatever Generate rules for cross-library dependencies says. Dependencies elsewhere are still resolved through the application's list, and their sources are still prerequisites.
  • With the profile's options and source search settings, except where the application's overrides change them.

Libraries that no application lists are never analyzed: vendor, source-only and include libraries on a list are resolved through and get no rules. An application that lists no library directory to analyze is skipped.

Each application is a separate analysis because one analysis over every application's libraries isn't the same: it would admit references from one application into another's libraries, changing which references become object prerequisites, and resolve them with a list those objects don't compile with.

The applications are read once, at the branch, when you analyze. If the file is missing or invalid, doesn't define the stage, or can't be read, or the repository's files at that commit can't be listed completely, the run stops with an error and nothing is analyzed.

Overrides​

Choose Overrides in an application's row to change how that application alone is analyzed. The dialog is titled with the application's name, for example Overrides for BILLING. Every setting starts at Profile setting, which uses the profile's option:

  • Own library — Off, First or Only, as described in Source search settings above.
  • Source search library list — The application's library list searches the application's own list at the stage. These libraries searches the Libraries you enter, in order, separated by spaces, commas or new lines.
  • Search for object sources — On or Off, as the option of the same name.
  • Always search — On or Off, as the option of the same name.
  • Require file source — On or Off, as Require sources for files in Options.
  • Allow missing file dependencies — On or Off, as the option of the same name.
  • Keep bound modules — On or Off, as Retain cross-library bound modules in Options.

As in the profile's own options, Own library, Source search library list and Always search have an effect only while the source search is on for the application: when Search for object sources is on in the profile's Options, or set to On in the application's overrides.

Apply keeps the overrides for the session, Clear overrides removes them, and Cancel leaves them as they were. Save Profile saves them with the profile. The Overrides column sums them up, for example Own library: First; source search list: BILSRC; Search for object sources: on.

For example, if BILLING's programs were compiled from sources in BILSRC, a library that isn't on its list, and the profile leaves Search for object sources off, give BILLING Search for object sources set to On, Own library set to First, and These libraries with BILSRC. BILLING's sources are then searched for in its own library first and then in BILSRC, while ORDERS keeps the profile's settings, with no search.

Overrides for BILLING dialog with Own library set to First, Source search library list set to These libraries with BILSRC, Search for object sources set to On, and the other settings at Profile setting

These can't be overridden for one application:

  • Generate rules for cross-library dependencies — each application admits only its own libraries.
  • Replace existing Rules.mk content — it applies to the whole run.
  • objx Tool Library — one run analyzes every application on one connection.

An application's library list comes only from .codermake/config.json, and Source Type Mappings apply to every application. An override for an application the branch doesn't define isn't used, and the run warns about it.

Analyze and review​

Analyze All Applications runs each application in turn. In Review & Generate Rules, the Applications section lists each application's result, before the summary's errors and warnings for the whole run:

  • Generated — with its build rules, the objects analyzed, failed objects and warnings.
  • No objects — its libraries hold no objects to analyze.
  • Failed — with the reason.
  • Nothing to analyze — it lists no library directory that can be analyzed.

One application's failure keeps the others' rules. An application that fails gets no rules in the result, and the section says that every other application's rules are complete. Generate Rules still creates the task with them. Once the problem is fixed, choose Regenerate for the failed application.

One review and one commit. Generate Rules creates one task, named for example Generate IBM i build rules for all applications at stage production, with every application's Rules.mk files. Its instructions list each application's result, the report by application is in /tmp/ibmi-import/applications.md inside the task, and the analysis archive includes it. Approving the task commits every application's rules together.

Review step with the Applications section reporting ORDERS generated and BILLING failed, and a note that the rules of every other application are complete

Saving the profile​

Save Profile saves All applications, the stage, the options, the source search library list and every application's overrides, and no selections. Each time the profile runs, the applications are read from the repository at the profile's branch, so a new application, or a changed list or library directory, applies the next time.

Saving warns when the branch doesn't define applications with that stage, and still saves, so you can save the profile and add .codermake/config.json to the repository back to back. Analysis, and the IBM i Import automations that run the profile, fail until the branch defines them.

A profile covers all applications, names one application, or keeps its own library list and selections. The server refuses a profile that mixes them, whether it is saved from this page, through Ask or through the API.

Stale rules​

When an application's rules land on the branch, CoderFlow records the library directories and the library list they were generated with, and the commit the applications were read at. The Rules column compares that record with the application's definition now:

  • Current — generated with its current library list and libraries.
  • Current (assumed) — an IBM i Import automation took over the application's libraries from build-rules profiles it ran before, and its rules are assumed to match its definition at that point. A later change to the application is flagged as stale.
  • Stale — its definition changed since its rules were generated. The reason shows below the status.
  • Waiting for merge — its regeneration was approved to another branch and hasn't reached this one yet (see below).
  • Not recorded — no all-applications run has recorded which definition its rules came from, for example rules generated with a profile per application. Regenerate it once to record it.
  • Removed — the branch no longer defines the application.

An application is stale when, since its rules were generated:

  • its library list at the stage changed;
  • the library directories it lists changed;
  • its rules were generated at another stage;
  • another application's rules were generated into one of its libraries, for example while the directory belonged to that application;
  • its own rules in one of its libraries were updated with another list or other settings.

A commit that doesn't change the application's definition never makes its rules stale. The panel names the stale applications above the table, and each stale row says why, for example:

Application 'ORDERS' has stale build rules: its library list has changed since commit 9b2e4d6f1a3c. Regenerate its rules to analyze it with its current definition.

Regenerate in an application's row analyzes that application only, with the profile's settings and its overrides. The review, the task and the commit work as for all applications; the task is named for example Generate IBM i build rules for applications ORDERS at stage production. Analyze All Applications regenerates every application.

Stale rules are never regenerated silently. An IBM i Import automation that runs the profile regenerates changed objects only, and reports stale applications in its outcome (see All-applications profiles).

Only rules on the branch count. A regeneration counts once its task is approved and pushed to the branch. Until then, the row says a regeneration is waiting in that task and counts once approved. A rejected task's regeneration is dropped.

Waiting for merge. When the task is approved to another branch, for example the branch of a pull request, the application shows Waiting for merge instead of its status, as long as that regeneration would fix it. It stays waiting until the files the approval pushed read the same on this branch, whichever way they were merged, squash included, or until a later regeneration of the application lands:

Application 'ORDERS' was regenerated in task 1795290000000-a1b2c3d4e, approved to branch 'rules-update': waiting for the approved changes to reach 'main'.

A pull request closed without merging leaves the application waiting; regenerate it again.

One application, for exceptions​

Choose an application's name under Application, instead of All applications, to analyze only the objects you select with that application's list at the stage. Keep it for exceptions: another system, a subset of an application's libraries, or individual objects.

  • The application's list becomes the session's library list, read from .codermake/config.json on the selected branch. The library tree shows its libraries, a status line shows the list and the commit it was read at, and Library List is unavailable. Changing the branch reads the applications again; if the branch doesn't define the application or the stage, the status line says why.
  • Analyze waits until the IBM i has the list. When you analyze, the server reads the list again at the branch and stops with an error, analyzing nothing, if the branch no longer defines it. The analysis log shows the list it used.
  • A saved profile names the application and stage, and can't keep its own list too. Each time it runs, the list is read at the profile's branch. Its Source search library list stays its own; when it's empty, the search uses the application's list. Saving warns when the branch doesn't define the application or the stage, and still saves.

Each selected library whose directory the application doesn't list gets a warning, against QSYS/<library> *LIB. When another application lists the directory, its objects compile with that application's list, not the one their rules were resolved with: generate them with All applications, or move the directory to this application in .codermake/config.json. When no application lists it, the warning says its objects can't be built until an application lists the directory.

Select Objects with Application ORDERS and Stage production next to Branch main, and a status line showing the ORDERS production library list

Rules generation reads .codermake/config.json and never writes it.

Notes on the Resulting Task​

Build rules tasks behave like Import Sources tasks:

  • Not resubmittable — the injected files are specific to this analysis session.
  • Sync to IBM i surfaces (Approve dialog section and task page button) are hidden. The output is Git-side build configuration, not edits to push back to IBM i.
  • Otherwise, review, approve, and push through the normal task UI.