Perform build - JeffBerman/Bob GitHub Wiki
How to build a project
This page documents how to use Better Object Builder to build a project. This can be done either by command line on an IBM i or from within RDi on a PC/Mac.
Building from command line
Since GNU Make runs in the PASE environment, you must start up a PASE terminal to initiate a project build. This can be done from CL
===> CALL QP2TERM
but the experience is far more rich when connected via a true terminal (Cygwin64 Terminal, Bash Terminal (Windows 10), Terminal.app (Mac), etc.):
$ ssh ibmi01
True terminal programs allow you to scroll through command history, auto-complete filenames, and more. The 5250 QP2TERM or Qshell experience is primitive by comparison.
Once logged into a PASE shell, issue the make command, passing as arguments the path to the build library and the path to the project's makefile:
make all OBJPATH:=/QSYS.LIB/BUILDLIB.LIB -f '/Build/project1/Jeff/Makefile'
Let's deconstruct that command.
make all
Invoke the make command and tell it to build the entire project, by using a build goal of all.
OBJPATH:=/QSYS.LIB/BUILDLIB.LIB
Set the path of the target build library to variable OBJPATH, and pass that into Make. This is where objects will be built.
-f '/Build/project1/Jeff/Makefile'
The -f option tells Make the location of the makefile it should use to perform the build. The Bob build system expects the makefile to be located in a project directory, alongside the source code. The path is enclosed in single quotation marks in the event it contains special characters or spaces.
When this command is run over the included sample project, all objects are created and the following output is produced:
$ make all OBJPATH:=/QSYS.LIB/BOBTEST.LIB -f '/Build/Bobtest/Jeff/Makefile'
Using IBMiMake file: /Build/Bob/IBMiMake
IBMiMake log directory: /Build/Bobtest/Jeff/Logs/2017-05-25_14.26.39-Thu
*** Creating PF [TEST01]
*** Creating LF [TEST01A]
*** Creating command [BOBTEST]
*** Creating RPG module [TEST010]
*** Creating program [TEST010] from modules [TEST010] and service programs []
***
*** Source directory: /Build/Bobtest/Jeff
*** Target library: BOBTEST
*** Compile listings: /Build/Bobtest/Jeff/Logs/2017-05-25_14.26.39-Thu
***
*** * * * * * B u i l d S u c c e s s f u l ! * * * * *
Spool file output for the compiled objects is placed in directory Logs in the project directory, and can be examined to troubleshoot errors or gloat over how cleanly your code compiled.
Building from RDi
Once the Client tools have been installed into RDi, projects can be built from a PC without having to sign onto an IBM i. Follow these steps to initiate a build:
- The project's source code should be on your PC and defined to RDi as a project. Build settings for the project should already be configured. The build library defined to the project should exist. If all this hasn't been done, do it now.
- You are about to compile source code on the i, so the first thing to do is put it there. From the Project Explorer, select any item in the project, then select
Run->External Tools->Push to IBM ior selectPush to IBM ifrom theExternal Toolstoolbar icon. The files in your project are copied to the build directory on the i. RDi's Console view will display feedback so you can see what was pushed. - To start a build, select
Run->External Tools->Build all. Bob will begin building your project on the i. As the build proceeds, RDi's Console view displays status information. When the build completes, either successfully or with errors, the spool file output for the compiled objects is copied back to your PC and placed in directoryLogsin the project directory. - If an error occurs, an error message appears in the Console view. If the cause is a failed compile, examine the compile listing in the
Logsdirectory to troubleshoot. If there are no failed compiles, look at the log of the Make process itself, named! Build log.log. It will always be the first file in theLogsdirectory, and may give some clue as to what went wrong. Things to look for include incorrect compile parameters (e.g., TGTRLS = V17R1M0) and invalid makefile syntax.