blog
blog copied to clipboard
Building a makefile dependency generator for RPGLE (part 2)
Ok, for the last few months I've been playing with different tools to help generate makefiles for very large ILE RPG applications that make use of lots of LF, PF, PRTF, etc and it is a lot of work. I think the next possible way to help generate these makefiles is to build my own generator.
The generator would work post-source-migration. As in, you would have already moved all the sources to the IFS. The way I am thinking this would work is by actually scanning the source code for references. I want something that is open-source and easy to use.
Here's how each type of source code would get their references
LF/PF
-
DSPDBR
to find logical/physical relations
RPGLE
-
F spec (both fixed format and free format)
- to determine whether it is LF or PF, you would have to use the name of the declaration to find the file and determine it by the file's extension.
-
CALL opcode.
- Look for any program that doesn't start with Q
-
Embedded SQL
- While this one is hard because it's SQL syntax, we can hopefully just look for the
FROM
clause and take the file after it (the file also may be a stored procedure). - We also need to look for stored procedures (
CALL
).
- While this one is hard because it's SQL syntax, we can hopefully just look for the
-
ExtPgm
which points to an external program -
BndDir
in the source so a binding directory is created in the makefile -
ExtProc
which points to an external procedure, which of course we don't know what that procedure is. -
ExtName
can point to an external table -
NoMain
would indicate it's a module (.rpglemod
) -
Optionally add
/copy
and/include
as deps, incase you want to track changes in dep sources. -
As a backup, after we've got a list of LF/PF references, we can just scan each RPGLE source for the names of the LF/PF files, which may indicate a reference.
CLLE
-
DclF
which defines a file - We may optionally want to look for any
OBJ
parameter, as it may indicate other references - There are also commands to think about. We could check if the command the CL is trying to run exists in the source directory. Then if it does add it as a dep.
DDS (LF/PF/PRTF)
- The
REF
keyword.