@profoundlogic/codermake 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,6 +79,26 @@ EOF
79
79
  cat '$(1)' | $(SSH) "$(QSHELL) -c 'Rfile -Qw \"$(TARGET_LIB)/$(2)($(call remote_shell_escape_dollars,$(call ibmi_name,$(1))))\"'"
80
80
  endef
81
81
 
82
+ ######
83
+ # Utility to upload a source member to an explicitly named library. Used for
84
+ # RPG III /COPY members, whose target library is derived from the prerequisite
85
+ # path (see base.mk) and may differ from the program's own library.
86
+ # $(1) = local file path (source type is derived from file extension)
87
+ # $(2) = source file name (e.g., qcpysrc)
88
+ # $(3) = target IBM i library
89
+ ######
90
+ define CREATE_COPY_MEMBER
91
+ $(SSH) $(QSHELL) <<'EOF'
92
+ if [ ! -e '/qsys.lib/$(3).lib/$(2).file' ]; then
93
+ system "crtsrcpf file($(3)/$(2))"
94
+ fi
95
+ if [ ! -e '/qsys.lib/$(3).lib/$(2).file/$(call ibmi_name,$(1)).mbr' ]; then
96
+ system "addpfm file($(3)/$(2)) mbr($(call ibmi_name_sh,$(1))) srctype($(subst .,,$(suffix $(1))))"
97
+ fi
98
+ EOF
99
+ cat '$(1)' | $(SSH) "$(QSHELL) -c 'Rfile -Qw \"$(3)/$(2)($(call remote_shell_escape_dollars,$(call ibmi_name,$(1))))\"'"
100
+ endef
101
+
82
102
  ######
83
103
  # Utility to build an object via CL commands in a separate file.
84
104
  # $(1) = Target path
@@ -200,7 +220,7 @@ endif
200
220
  define BUILD_RPGLE_PGM
201
221
  $(call SETUP_LOG,$(notdir $@))
202
222
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
203
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtbndrpg pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
223
+ $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtbndrpg pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') tgtccsid(*job) output(*print)$(CODERMAKE_OPTS_crtbndrpg)")
204
224
  $(call RPG_CLEANUP_SOURCES)
205
225
  touch '$@'
206
226
  endef
@@ -209,7 +229,7 @@ endef
209
229
  define BUILD_SQLRPGLE_PGM
210
230
  $(call SETUP_LOG,$(notdir $@))
211
231
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
212
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtsqlrpgi obj($(TARGET_LIB)/$(call ibmi_name_sh,$@)) objtype(*pgm) srcstmf('$(call shell_escape_dollars,$<)') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''.'') tgtccsid(*job) output(*print)') dbgview(*source)")
232
+ $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtsqlrpgi obj($(TARGET_LIB)/$(call ibmi_name_sh,$@)) objtype(*pgm) srcstmf('$(call shell_escape_dollars,$<)') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''.'') tgtccsid(*job) output(*print)$(CODERMAKE_COMPILEOPT_crtsqlrpgi)')$(CODERMAKE_OPTS_crtsqlrpgi)")
213
233
  $(call RPG_CLEANUP_SOURCES)
214
234
  touch '$@'
215
235
  endef
@@ -218,7 +238,7 @@ endef
218
238
  define BUILD_RPGLE_MODULE
219
239
  $(call SETUP_LOG,$(notdir $@))
220
240
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
221
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtrpgmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
241
+ $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtrpgmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') tgtccsid(*job) output(*print)$(CODERMAKE_OPTS_crtrpgmod)")
222
242
  $(call RPG_CLEANUP_SOURCES)
223
243
  touch '$@'
224
244
  endef
@@ -227,7 +247,7 @@ endef
227
247
  define BUILD_SQLRPGLE_MODULE
228
248
  $(call SETUP_LOG,$(notdir $@))
229
249
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
230
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtsqlrpgi obj($(TARGET_LIB)/$(call ibmi_name_sh,$@)) objtype(*module) srcstmf('$(call shell_escape_dollars,$<)') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''.'') tgtccsid(*job) output(*print)') dbgview(*source)")
250
+ $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtsqlrpgi obj($(TARGET_LIB)/$(call ibmi_name_sh,$@)) objtype(*module) srcstmf('$(call shell_escape_dollars,$<)') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''.'') tgtccsid(*job) output(*print)$(CODERMAKE_COMPILEOPT_crtsqlrpgi)')$(CODERMAKE_OPTS_crtsqlrpgi)")
231
251
  $(call RPG_CLEANUP_SOURCES)
232
252
  touch '$@'
233
253
  endef
@@ -235,14 +255,14 @@ endef
235
255
  # Build ILE COBOL program (bound)
236
256
  define BUILD_CBLLE_PGM
237
257
  $(call SETUP_LOG,$(notdir $@))
238
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtbndcbl pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') tgtccsid(*job) output(*print) dbgview(*all)")
258
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtbndcbl pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') tgtccsid(*job) output(*print)$(CODERMAKE_OPTS_crtbndcbl)")
239
259
  touch '$@'
240
260
  endef
241
261
 
242
262
  # Build ILE COBOL module
243
263
  define BUILD_CBLLE_MODULE
244
264
  $(call SETUP_LOG,$(notdir $@))
245
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtcblmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') tgtccsid(*job) output(*print) dbgview(*all)")
265
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtcblmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') tgtccsid(*job) output(*print)$(CODERMAKE_OPTS_crtcblmod)")
246
266
  touch '$@'
247
267
  endef
248
268
 
@@ -255,7 +275,7 @@ $(call REMOTE_BUILD,$(filter-out build/%,$^),\
255
275
  $(DETECT_IBMI_RELEASE); \
256
276
  TGTCCSID_PARM=; \
257
277
  if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi; \
258
- system "crtbndcl pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
278
+ system "crtbndcl pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print)$(CODERMAKE_OPTS_crtbndcl)")
259
279
  touch '$@'
260
280
  endef
261
281
 
@@ -265,7 +285,53 @@ $(call SETUP_LOG,$(notdir $@))
265
285
  $(call CREATE_SOURCE_MEMBER,$<,qclsrc)
266
286
  $(SSH) $(QSHELL) <<'EOF'
267
287
  $(SET_LIBL)
268
- system "crtclpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qclsrc) output(*print)"
288
+ system "crtclpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qclsrc) output(*print)$(CODERMAKE_OPTS_crtclpgm)"
289
+ EOF
290
+ touch '$@'
291
+ endef
292
+
293
+ # Build System/38 compatible OPM CL program (QSYS38/CRTCLPGM).
294
+ # QSYS38/CRTCLPGM has no REPLACE parameter and fails if the program exists, so
295
+ # delete any existing program object first.
296
+ define BUILD_CLP38_PGM
297
+ $(call SETUP_LOG,$(notdir $@))
298
+ $(call CREATE_SOURCE_MEMBER,$<,qclsrc)
299
+ $(SSH) $(QSHELL) <<'EOF'
300
+ $(SET_LIBL)
301
+ if [ -e '$(TARGET_LIB_PATH)/$(call ibmi_name,$@).pgm' ]; then
302
+ system "dltpgm $(TARGET_LIB)/$(call ibmi_name_sh,$@)"
303
+ fi
304
+ system "qsys38/crtclpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qclsrc) srcmbr($(call ibmi_name_sh,$<)) option(*source$(CODERMAKE_OPTVALS_qsys38_crtclpgm))$(CODERMAKE_OPTS_qsys38_crtclpgm)"
305
+ EOF
306
+ touch '$@'
307
+ endef
308
+
309
+ # Build RPG/400 (RPG III) program (CRTRPGPGM). Creates the program source
310
+ # member plus a source member for every /COPY prerequisite before compiling.
311
+ define BUILD_RPG_PGM
312
+ $(call SETUP_LOG,$(notdir $@))
313
+ $(call CREATE_SOURCE_MEMBER,$<,qrpgsrc)
314
+ $(foreach c,$(RPG3_COPY_MEMBERS),$(call CREATE_COPY_MEMBER,$(c),$(call copy_src_file,$(c)),$(call copy_src_lib,$(c)))$(NL))
315
+ $(SSH) $(QSHELL) <<'EOF'
316
+ $(SET_LIBL)
317
+ system "crtrpgpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qrpgsrc) srcmbr($(call ibmi_name_sh,$<)) option(*source$(CODERMAKE_OPTVALS_crtrpgpgm)) replace(*yes)$(CODERMAKE_OPTS_crtrpgpgm)"
318
+ EOF
319
+ touch '$@'
320
+ endef
321
+
322
+ # Build System/38 compatible RPG III program (QSYS38/CRTRPGPGM).
323
+ # QSYS38/CRTRPGPGM has no REPLACE parameter and fails if the program exists, so
324
+ # delete any existing program object first. Also creates /COPY source members.
325
+ define BUILD_RPG38_PGM
326
+ $(call SETUP_LOG,$(notdir $@))
327
+ $(call CREATE_SOURCE_MEMBER,$<,qrpgsrc)
328
+ $(foreach c,$(RPG3_COPY_MEMBERS),$(call CREATE_COPY_MEMBER,$(c),$(call copy_src_file,$(c)),$(call copy_src_lib,$(c)))$(NL))
329
+ $(SSH) $(QSHELL) <<'EOF'
330
+ $(SET_LIBL)
331
+ if [ -e '$(TARGET_LIB_PATH)/$(call ibmi_name,$@).pgm' ]; then
332
+ system "dltpgm $(TARGET_LIB)/$(call ibmi_name_sh,$@)"
333
+ fi
334
+ system "qsys38/crtrpgpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qrpgsrc) srcmbr($(call ibmi_name_sh,$<)) option(*source$(CODERMAKE_OPTVALS_qsys38_crtrpgpgm))$(CODERMAKE_OPTS_qsys38_crtrpgpgm)"
269
335
  EOF
270
336
  touch '$@'
271
337
  endef
@@ -279,7 +345,7 @@ $(call REMOTE_BUILD,$(filter-out build/%,$^),\
279
345
  $(DETECT_IBMI_RELEASE); \
280
346
  TGTCCSID_PARM=; \
281
347
  if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi; \
282
- system "crtclmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
348
+ system "crtclmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print)$(CODERMAKE_OPTS_crtclmod)")
283
349
  touch '$@'
284
350
  endef
285
351
 
@@ -288,7 +354,7 @@ define BUILD_MODULE_TO_PGM
288
354
  $(call SETUP_LOG,$(notdir $@))
289
355
  $(SSH) $(QSHELL) <<'EOF'
290
356
  $(SET_LIBL)
291
- system "crtpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
357
+ system "crtpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)$(CODERMAKE_OPTS_crtpgm)"
292
358
  EOF
293
359
  touch '$@'
294
360
  endef
@@ -296,7 +362,7 @@ endef
296
362
  # Build service program from modules
297
363
  define BUILD_MODULE_TO_SRVPGM
298
364
  $(call SETUP_LOG,$(notdir $@))
299
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtsrvpgm srvpgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) export(*srcfile) srcstmf('$(call shell_escape_dollars,$(filter %.exports %.bnd,$^))') $(BNDSRVPGM_PARM) $(BNDDIR_PARM)")
365
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtsrvpgm srvpgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) export(*srcfile) srcstmf('$(call shell_escape_dollars,$(filter %.exports %.bnd,$^))') $(BNDSRVPGM_PARM) $(BNDDIR_PARM)$(CODERMAKE_OPTS_crtsrvpgm)")
300
366
  touch '$@'
301
367
  endef
302
368
 
@@ -305,7 +371,7 @@ define BUILD_MODULE_TO_SRVPGM_ALL
305
371
  $(call SETUP_LOG,$(notdir $@))
306
372
  $(SSH) $(QSHELL) <<'EOF'
307
373
  $(SET_LIBL)
308
- system "crtsrvpgm srvpgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) export(*all) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
374
+ system "crtsrvpgm srvpgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) export(*all) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)$(CODERMAKE_OPTS_crtsrvpgm)"
309
375
  EOF
310
376
  touch '$@'
311
377
  endef
@@ -316,7 +382,7 @@ $(call SETUP_LOG,$(notdir $@))
316
382
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
317
383
  $(SSH) $(QSHELL) <<'EOF'
318
384
  $(SET_LIBL)
319
- system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
385
+ system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_crtdspf)"
320
386
  EOF
321
387
  touch '$@'
322
388
  endef
@@ -328,7 +394,7 @@ $(call SETUP_LOG,$(notdir $@))
328
394
  $(call CREATE_SOURCE_MEMBER,tmp/$(basename $(@F)).dspf,qddssrc)
329
395
  $(SSH) $(QSHELL) <<'EOF'
330
396
  $(SET_LIBL)
331
- system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) enhdsp(*yes)"
397
+ system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc)$(CODERMAKE_OPTS_crtdspf)"
332
398
  EOF
333
399
  rm -f 'tmp/$(basename $(@F)).dspf'
334
400
  touch '$@'
@@ -340,7 +406,7 @@ $(call SETUP_LOG,$(notdir $@))
340
406
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
341
407
  $(SSH) $(QSHELL) <<'EOF'
342
408
  $(SET_LIBL)
343
- system "crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
409
+ system "crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_crtpf)"
344
410
  EOF
345
411
  touch '$@'
346
412
  endef
@@ -351,7 +417,7 @@ $(call SETUP_LOG,$(notdir $@))
351
417
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
352
418
  $(SSH) $(QSHELL) <<'EOF'
353
419
  $(SET_LIBL)
354
- system "crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
420
+ system "crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_crtlf)"
355
421
  EOF
356
422
  touch '$@'
357
423
  endef
@@ -362,7 +428,7 @@ $(call SETUP_LOG,$(notdir $@))
362
428
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
363
429
  $(SSH) $(QSHELL) <<'EOF'
364
430
  $(SET_LIBL)
365
- system "crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
431
+ system "crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_crtprtf)"
366
432
  EOF
367
433
  touch '$@'
368
434
  endef
@@ -373,7 +439,7 @@ $(call SETUP_LOG,$(notdir $@))
373
439
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
374
440
  $(SSH) $(QSHELL) <<'EOF'
375
441
  $(SET_LIBL)
376
- system "qsys38/crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
442
+ system "qsys38/crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_qsys38_crtdspf)"
377
443
  EOF
378
444
  touch '$@'
379
445
  endef
@@ -384,7 +450,7 @@ $(call SETUP_LOG,$(notdir $@))
384
450
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
385
451
  $(SSH) $(QSHELL) <<'EOF'
386
452
  $(SET_LIBL)
387
- system "qsys38/crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
453
+ system "qsys38/crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_qsys38_crtpf)"
388
454
  EOF
389
455
  touch '$@'
390
456
  endef
@@ -395,7 +461,7 @@ $(call SETUP_LOG,$(notdir $@))
395
461
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
396
462
  $(SSH) $(QSHELL) <<'EOF'
397
463
  $(SET_LIBL)
398
- system "qsys38/crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
464
+ system "qsys38/crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_qsys38_crtlf)"
399
465
  EOF
400
466
  touch '$@'
401
467
  endef
@@ -406,7 +472,7 @@ $(call SETUP_LOG,$(notdir $@))
406
472
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
407
473
  $(SSH) $(QSHELL) <<'EOF'
408
474
  $(SET_LIBL)
409
- system "qsys38/crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
475
+ system "qsys38/crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))$(CODERMAKE_OPTS_qsys38_crtprtf)"
410
476
  EOF
411
477
  touch '$@'
412
478
  endef
@@ -414,28 +480,37 @@ endef
414
480
  # Build SQL table
415
481
  define BUILD_SQLTABLE_TO_FILE
416
482
  $(call SETUP_LOG,$(notdir $@))
417
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
483
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') dftrdbcol($(TARGET_LIB))$(CODERMAKE_OPTS_runsqlstm)")
418
484
  touch '$@'
419
485
  endef
420
486
 
421
487
  # Build SQL index
422
488
  define BUILD_SQLINDEX_TO_FILE
423
489
  $(call SETUP_LOG,$(notdir $@))
424
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
490
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') dftrdbcol($(TARGET_LIB))$(CODERMAKE_OPTS_runsqlstm)")
425
491
  touch '$@'
426
492
  endef
427
493
 
428
494
  # Build SQL view
429
495
  define BUILD_SQLVIEW_TO_FILE
430
496
  $(call SETUP_LOG,$(notdir $@))
431
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
497
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') dftrdbcol($(TARGET_LIB))$(CODERMAKE_OPTS_runsqlstm)")
432
498
  touch '$@'
433
499
  endef
434
500
 
435
501
  # Build SQL procedure
436
502
  define BUILD_SQLPROC_TO_PGM
437
503
  $(call SETUP_LOG,$(notdir $@))
438
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
504
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') dftrdbcol($(TARGET_LIB))$(CODERMAKE_OPTS_runsqlstm)")
505
+ touch '$@'
506
+ endef
507
+
508
+ # Build SQL trigger program.
509
+ # CREATE TRIGGER creates the *PGM; use PROGRAM NAME in the source when the
510
+ # trigger name should map exactly to the build target object.
511
+ define BUILD_SQLTRIGGER_TO_PGM
512
+ $(call SETUP_LOG,$(notdir $@))
513
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') dftrdbcol($(TARGET_LIB))$(CODERMAKE_OPTS_runsqlstm)")
439
514
  touch '$@'
440
515
  endef
441
516
 
@@ -445,7 +520,7 @@ endef
445
520
  # its object name from the routine (name it to match the target where practical).
446
521
  define BUILD_SQLPROC_TO_SRVPGM
447
522
  $(call SETUP_LOG,$(notdir $@))
448
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
523
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') dftrdbcol($(TARGET_LIB))$(CODERMAKE_OPTS_runsqlstm)")
449
524
  touch '$@'
450
525
  endef
451
526
 
@@ -455,7 +530,7 @@ endef
455
530
  # to match the target where practical).
456
531
  define BUILD_SQLUDF_TO_SRVPGM
457
532
  $(call SETUP_LOG,$(notdir $@))
458
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
533
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') dftrdbcol($(TARGET_LIB))$(CODERMAKE_OPTS_runsqlstm)")
459
534
  touch '$@'
460
535
  endef
461
536
 
@@ -478,7 +553,7 @@ define BUILD_MENU
478
553
  $(call SETUP_LOG,$(notdir $@))
479
554
  $(SSH) $(QSHELL) <<'EOF'
480
555
  $(SET_LIBL)
481
- system "crtmnu menu($(TARGET_LIB)/$(call ibmi_name_sh,$@)) type(*dspf) dspf($(call ibmi_name_sh,$(filter %.file,$^))) msgf($(call ibmi_name_sh,$(filter %.msgf,$^))) cmdlin(*none) dspkey(*no)"
556
+ system "crtmnu menu($(TARGET_LIB)/$(call ibmi_name_sh,$@)) type(*dspf) dspf($(call ibmi_name_sh,$(filter %.file,$^))) msgf($(call ibmi_name_sh,$(filter %.msgf,$^)))$(CODERMAKE_OPTS_crtmnu)"
482
557
  EOF
483
558
  touch '$@'
484
559
  endef
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profoundlogic/codermake",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
4
  "description": "Make wrapper framework for IBM i development that simplifies build rules",
5
5
  "main": "dist/bin/index.js",
6
6
  "type": "module",
@@ -154,9 +154,13 @@ ENDPGMEXP
154
154
  | `.clle` | `.pgm` | Program (*PGM) | `CRTBNDCL` |
155
155
  | `.clle` | `.module` | Module (*MODULE) | `CRTCLMOD` |
156
156
  | `.clp` / `.cl` | `.pgm` | Program (*PGM) | `CRTCLPGM` |
157
+ | `.clp38` | `.pgm` | Program (*PGM) | `QSYS38/CRTCLPGM` (System/38, delete-then-create) |
158
+ | `.rpg` | `.pgm` | Program (*PGM) | `CRTRPGPGM ... REPLACE(*YES)` (RPG/400) |
159
+ | `.rpg38` | `.pgm` | Program (*PGM) | `QSYS38/CRTRPGPGM` (System/38 RPG III, delete-then-create) |
157
160
  | `.proc.sql` | `.pgm` | SQL Procedure (*PGM) | `RUNSQLSTM` |
158
161
  | `.proc.sql` | `.srvpgm` | SQL Procedure (*SRVPGM, `PROGRAM TYPE SUB`) | `RUNSQLSTM` |
159
162
  | `.udf.sql` | `.srvpgm` | SQL Function (*SRVPGM, `LANGUAGE SQL`) | `RUNSQLSTM` |
163
+ | `.trg.sql` | `.pgm` | SQL Trigger Program (*PGM) | `RUNSQLSTM` |
160
164
  | `.module` (1+) | `.pgm` | Program (*PGM) | `CRTPGM` |
161
165
  | `.module` + `.exports` or `.bnd` | `.srvpgm` | Service Program (*SRVPGM) | `CRTSRVPGM EXPORT(*SRCFILE)` |
162
166
  | `.module` (no exports) | `.srvpgm` | Service Program (*SRVPGM) | `CRTSRVPGM EXPORT(*ALL)` |
@@ -251,3 +255,38 @@ When the project has a multi-library layout, `CODERMAKE_LIBRARY_MAP` enables per
251
255
  | `CODERMAKE_LIBRARY_LIST` | Optional. Space-separated, ordered IBM i library list. Replaces the user portion of the build job's library list. Only valid alongside `CODERMAKE_LIBRARY_MAP`. |
252
256
 
253
257
  When using multi-library output, refer to objects in another library with the qualifier syntax `<libraryDir>/<bareobj>.<ext>` (see *Cross-directory references* above).
258
+
259
+ ## Compile options
260
+
261
+ To change the parameters passed to IBM i compile commands (e.g. target
262
+ release, debug view), edit `.codermake/config.json` in the project root — **do
263
+ not edit the Makefiles**. The file is optional; when absent, codermake uses its
264
+ built-in parameters.
265
+
266
+ ```json
267
+ {
268
+ "targetRelease": "V7R4M0",
269
+ "compileOptions": {
270
+ "crtbndrpg": { "dbgview": "*all" },
271
+ "crtrpgpgm": { "option": ["*srcdbg"] },
272
+ "runsqlstm": { "commit": "*chg" },
273
+ "crtsqlrpgi": { "dbgview": "*source", "compileopt": { "optimize": "*full" } }
274
+ }
275
+ }
276
+ ```
277
+
278
+ - **`targetRelease`** sets `TGTRLS`, applied to each compile command that
279
+ accepts it — do not add `tgtrls` under `compileOptions`.
280
+ - **`compileOptions`** is keyed by lowercase CL command name (`crtbndrpg`,
281
+ `crtsqlrpgi`, `qsys38/crtclpgm`, ...). Each keyword is added to that command;
282
+ values may be a string or an array (`["*a", "*b"]` → `KEYWORD(*A *B)`).
283
+ - **Reserved** parameters that codermake owns (`pgm`, `srcstmf`,
284
+ `output(*print)`, `tgtccsid`, and similar) cannot be overridden — attempting
285
+ to set one is a hard error.
286
+ - `option` and `compileopt` are **augmentable**: your values merge with the
287
+ parts codermake requires (`OPTION` always keeps `*SOURCE`; `COMPILEOPT` keeps
288
+ its `incdir`/`tgtccsid`/`output`).
289
+
290
+ Preview the effect without building: `codermake --print-makefile` shows the
291
+ resolved parameters, and `codermake -n <target>` prints the expanded compile
292
+ command.
@@ -98,7 +98,7 @@ CPD7344 30 Keyword REF not valid for this type of file.
98
98
 
99
99
  DDS errors typically reference a specific record format and line within the source.
100
100
 
101
- ## SQL DDL listings (.table.sql, .index.sql, .view.sql, .proc.sql, .udf.sql)
101
+ ## SQL DDL listings (.table.sql, .index.sql, .view.sql, .proc.sql, .udf.sql, .trg.sql)
102
102
 
103
103
  SQL DDL statements executed via `RUNSQLSTM` produce SQL messages:
104
104
 
@@ -110,7 +110,7 @@ SQL7905 10 Module *N in *N not found.
110
110
 
111
111
  - Severity 30+ means the statement failed.
112
112
  - Severity 20 warnings (like "already exists") may or may not be a problem depending on context.
113
- - `.proc.sql` builds a `*PGM` (or a `*SRVPGM` with `PROGRAM TYPE SUB`) and `.udf.sql` builds a `*SRVPGM`; IBM i creates the object from the SQL routine, so the object name comes from the routine rather than the build target.
113
+ - `.proc.sql` builds a `*PGM` (or a `*SRVPGM` with `PROGRAM TYPE SUB`), `.udf.sql` builds a `*SRVPGM`, and `.trg.sql` builds a trigger `*PGM`; IBM i creates these objects from the SQL statement, so align the SQL routine/trigger name or trigger `PROGRAM NAME` with the build target.
114
114
 
115
115
  ## Message files and binding directories (.msgf, .bnddir)
116
116
 
@@ -54,6 +54,47 @@ mypgm.pgm: mypgm.clp
54
54
 
55
55
  **CL command:** `CRTCLPGM PGM(LIB/MYPGM) SRCFILE(LIB/QCLSRC)`
56
56
 
57
+ ### System/38 OPM CL program from .clp38
58
+
59
+ System/38 compatible OPM CL. Like `.clp`, it compiles from a source member (`QCLSRC`).
60
+ `QSYS38/CRTCLPGM` has no `REPLACE` parameter, so the recipe deletes any existing
61
+ program object first.
62
+
63
+ ```makefile
64
+ mycl38.pgm: mycl38.clp38
65
+ ```
66
+
67
+ **CL command:** `QSYS38/CRTCLPGM PGM(LIB/MYCL38) SRCFILE(LIB/QCLSRC) SRCMBR(MYCL38) OPTION(*SOURCE)`
68
+
69
+ ### RPG/400 (RPG III) program from .rpg
70
+
71
+ RPG III cannot compile from stream files, so the source is staged as a member in
72
+ `QRPGSRC` first, then compiled with `CRTRPGPGM`. `/COPY` directives always
73
+ reference source members; list each `/COPY` target as a prerequisite so codermake
74
+ creates it as a source member too (in the source file named by the prereq's parent
75
+ directory, in the program's library — or, in multi-library output mode, the library
76
+ mapped from the prereq's leading library-directory segment). RPG III has no
77
+ `/INCLUDE` directive and defaults the source file to `QRPGSRC` when unqualified.
78
+
79
+ ```makefile
80
+ myrpg.pgm: myrpg.rpg
81
+ mycpy.pgm: mycpy.rpg qcpysrc/shared.rpg # /COPY QCPYSRC,SHARED staged as QCPYSRC/SHARED
82
+ ```
83
+
84
+ **CL command:** `CRTRPGPGM PGM(LIB/MYRPG) SRCFILE(LIB/QRPGSRC) SRCMBR(MYRPG) OPTION(*SOURCE) REPLACE(*YES)`
85
+
86
+ ### System/38 RPG III program from .rpg38
87
+
88
+ Like `.rpg`, but compiled with `QSYS38/CRTRPGPGM` and the staged member is tagged
89
+ `RPG38`. `QSYS38/CRTRPGPGM` has no `REPLACE` parameter, so the recipe deletes any
90
+ existing program object first. `/COPY` members are handled the same way as `.rpg`.
91
+
92
+ ```makefile
93
+ myrpg38.pgm: myrpg38.rpg38
94
+ ```
95
+
96
+ **CL command:** `QSYS38/CRTRPGPGM PGM(LIB/MYRPG38) SRCFILE(LIB/QRPGSRC) SRCMBR(MYRPG38) OPTION(*SOURCE)`
97
+
57
98
  ### SQL procedure from .proc.sql
58
99
 
59
100
  Runs a SQL DDL script that creates a stored procedure. With the default `PROGRAM TYPE MAIN`, the resulting object is a program (`*PGM`).
@@ -66,6 +107,18 @@ getcount.pgm: getcount.proc.sql
66
107
 
67
108
  A `.proc.sql` whose routine uses `PROGRAM TYPE SUB`, and a `.udf.sql` SQL function, are backed by `*SRVPGM` objects instead — see [SQL service programs](#sql-service-programs-from-procsql--udfsql) under Service programs.
68
109
 
110
+ ### SQL trigger program from .trg.sql
111
+
112
+ Runs a SQL DDL script that creates a trigger. IBM i creates the generated trigger program object (`*PGM`) when `CREATE TRIGGER` runs.
113
+
114
+ ```makefile
115
+ emptrg.pgm: emptrg.trg.sql employee.file empaudit.file
116
+ ```
117
+
118
+ **CL command:** `RUNSQLSTM SRCSTMF('src/emptrg.trg.sql') COMMIT(*NONE) DFTRDBCOL(LIB)`
119
+
120
+ Use the trigger name or `PROGRAM NAME` in the source so the generated program object matches the `.pgm` build target.
121
+
69
122
  ### Program from modules
70
123
 
71
124
  Links one or more compiled modules into a program. Prerequisites include `.module` targets, and optionally `.srvpgm` and `.bnddir` (normal or order-only) for automatic binding.