@profoundlogic/codermake 2.0.5 → 2.0.7

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.
@@ -20,6 +20,23 @@ MAKEFLAGS += --output-sync=target
20
20
  ######
21
21
  output_lib_of = $(patsubst %.lib,%,$(notdir $(patsubst %/,%,$(dir $(1)))))
22
22
 
23
+ ######
24
+ # Helpers for names containing literal dollar signs.
25
+ #
26
+ # Rules.mk must use GNU Make's standard escaping (`$$`) for file and object
27
+ # names containing `$`. Once Make expands automatic variables such as `$@` and
28
+ # `$<`, those values contain a literal `$`. Any value inserted into unquoted or
29
+ # double-quoted shell code must escape that dollar as `\$` so the shell does not
30
+ # treat it as an environment variable reference. Values inserted into
31
+ # single-quoted shell strings should use the raw form. Remote clean uses an
32
+ # unquoted local here-doc that is evaluated again by QShell, so it needs one
33
+ # additional backslash layer.
34
+ ######
35
+ ibmi_name = $(basename $(notdir $(1)))
36
+ shell_escape_dollars = $(subst $$,\$$,$(1))
37
+ remote_shell_escape_dollars = $(subst $$,\\\$$,$(1))
38
+ ibmi_name_sh = $(call shell_escape_dollars,$(call ibmi_name,$(1)))
39
+
23
40
  ######
24
41
  # Utility to set the IBM i library list. Three modes selected at parse time:
25
42
  #
@@ -84,7 +101,7 @@ endef
84
101
  # '.' if no preprocessing needed, or a generated temp dir path if any file was preprocessed
85
102
  ######
86
103
  define RPG_PREPROCESS_SOURCES
87
- RPG_SRC_ROOT=$$('$(CODERMAKE_NODE)' '$(CODERMAKE_PACKAGE_DIR)/bin/preprocess-rpg-copy.js' $(1) --temp-prefix tmp/rpg-pp)
104
+ RPG_SRC_ROOT=$$('$(CODERMAKE_NODE)' '$(CODERMAKE_PACKAGE_DIR)/bin/preprocess-rpg-copy.js' $(call shell_escape_dollars,$(1)) --temp-prefix tmp/rpg-pp)
88
105
  endef
89
106
 
90
107
  ######
@@ -105,8 +122,8 @@ endef
105
122
  # consumer programs. CODERMAKE_LIBRARY_LIST is the appropriate way to control
106
123
  # resolution when conflicts exist across mapped libraries.
107
124
  ######
108
- BNDSRVPGM_PARM = $(if $(filter %.srvpgm,$^ $|),bndsrvpgm($(foreach s,$(filter %.srvpgm,$^ $|),$(basename $(notdir $(s))))),)
109
- BNDDIR_PARM = $(if $(filter %.bnddir,$^ $|),bnddir($(foreach d,$(filter %.bnddir,$^ $|),$(basename $(notdir $(d))))),)
125
+ BNDSRVPGM_PARM = $(if $(filter %.srvpgm,$^ $|),bndsrvpgm($(foreach s,$(filter %.srvpgm,$^ $|),$(call ibmi_name_sh,$(s)))),)
126
+ BNDDIR_PARM = $(if $(filter %.bnddir,$^ $|),bnddir($(foreach d,$(filter %.bnddir,$^ $|),$(call ibmi_name_sh,$(d)))),)
110
127
 
111
128
  ######
112
129
  # MODULE() parameter for CRTPGM / CRTSRVPGM.
@@ -118,7 +135,7 @@ BNDDIR_PARM = $(if $(filter %.bnddir,$^ $|),bnddir($(foreach d,$(filter %.bnddir
118
135
  # In single-library mode we keep today's unqualified form.
119
136
  ######
120
137
  ifdef CODERMAKE_LIBRARY_MAP
121
- MODULE_PARM = module($(foreach m,$(filter %.module,$^),($(call output_lib_of,$m)/$(basename $(notdir $m)))))
138
+ MODULE_PARM = module($(foreach m,$(filter %.module,$^),($(call output_lib_of,$(m))/$(call ibmi_name_sh,$(m)))))
122
139
  else
123
- MODULE_PARM = module($(foreach m,$(filter %.module,$^),$(basename $(notdir $m))))
140
+ MODULE_PARM = module($(foreach m,$(filter %.module,$^),$(call ibmi_name_sh,$(m))))
124
141
  endif
@@ -42,9 +42,9 @@ MKDIR := /QOpenSys/usr/bin/mkdir
42
42
  # $(2) = source file name (e.g., qddssrc, qrpglesrc)
43
43
  ######
44
44
  define CREATE_SOURCE_MEMBER
45
- test -e $(TARGET_LIB_PATH)/$(2).file || system "crtsrcpf file($(TARGET_LIB)/$(2))"
46
- test -e $(TARGET_LIB_PATH)/$(2).file/$(basename $(notdir $(1))).mbr || system "addpfm file($(TARGET_LIB)/$(2)) mbr($(basename $(notdir $(1)))) srctype($(subst .,,$(suffix $(1))))"
47
- cat '$(1)' | Rfile -Qw '$(TARGET_LIB)/$(2)($(basename $(notdir $(1))))'
45
+ test -e '$(TARGET_LIB_PATH)/$(2).file' || system "crtsrcpf file($(TARGET_LIB)/$(2))"
46
+ test -e '$(TARGET_LIB_PATH)/$(2).file/$(call ibmi_name,$(1)).mbr' || system "addpfm file($(TARGET_LIB)/$(2)) mbr($(call ibmi_name_sh,$(1))) srctype($(subst .,,$(suffix $(1))))"
47
+ cat '$(1)' | Rfile -Qw '$(TARGET_LIB)/$(2)($(call ibmi_name,$(1)))'
48
48
  endef
49
49
 
50
50
  ######
@@ -55,7 +55,7 @@ endef
55
55
  define BUILD_FROM_CL_FILE
56
56
  rm -rf '$(1)'
57
57
  export LIBRARY=$(TARGET_LIB)
58
- export NAME=$(basename $(notdir $(1)))
58
+ export NAME='$(call ibmi_name,$(1))'
59
59
  (
60
60
  $(SET_LIBL)
61
61
  echo "$(file < $(2))" | while IFS= read -r line; do
@@ -71,7 +71,7 @@ endef
71
71
  ######
72
72
  LOG_DIR = tmp/logs$(if $(TARGET_LIBRARY),/$(TARGET_LIBRARY))
73
73
  define SETUP_LOG
74
- @echo "Creating $(1)"
74
+ @echo "Creating $(call shell_escape_dollars,$(1))"
75
75
  $(MKDIR) -p '$(LOG_DIR)'
76
76
  /usr/bin/touch -C 1208 '$(LOG_DIR)/$(1).log'
77
77
  exec > '$(LOG_DIR)/$(1).log' 2>&1
@@ -117,7 +117,7 @@ define BUILD_RPGLE_PGM
117
117
  $(call SETUP_LOG,$(notdir $@))
118
118
  $(call RPG_PREPROCESS_SOURCES,$< $(filter-out $(TARGET_LIB_PATH)/%,$^))
119
119
  $(SET_LIBL)
120
- system "crtbndrpg pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$$RPG_SRC_ROOT/$<') incdir('$$RPG_SRC_ROOT') tgtccsid(*job) output(*print) dbgview(*all)"
120
+ system "crtbndrpg pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$$RPG_SRC_ROOT/$(call shell_escape_dollars,$<)') incdir('$$RPG_SRC_ROOT') tgtccsid(*job) output(*print) dbgview(*all)"
121
121
  $(call RPG_CLEANUP_SOURCES)
122
122
  endef
123
123
 
@@ -126,7 +126,7 @@ define BUILD_SQLRPGLE_PGM
126
126
  $(call SETUP_LOG,$(notdir $@))
127
127
  $(call RPG_PREPROCESS_SOURCES,$< $(filter-out $(TARGET_LIB_PATH)/%,$^))
128
128
  $(SET_LIBL)
129
- system "crtsqlrpgi obj($(TARGET_LIB)/$(basename $(@F))) objtype(*pgm) srcstmf('$$RPG_SRC_ROOT/$<') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''$$RPG_SRC_ROOT'') tgtccsid(*job) output(*print)') dbgview(*source)"
129
+ system "crtsqlrpgi obj($(TARGET_LIB)/$(call ibmi_name_sh,$@)) objtype(*pgm) srcstmf('$$RPG_SRC_ROOT/$(call shell_escape_dollars,$<)') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''$$RPG_SRC_ROOT'') tgtccsid(*job) output(*print)') dbgview(*source)"
130
130
  $(call RPG_CLEANUP_SOURCES)
131
131
  endef
132
132
 
@@ -135,7 +135,7 @@ define BUILD_RPGLE_MODULE
135
135
  $(call SETUP_LOG,$(notdir $@))
136
136
  $(call RPG_PREPROCESS_SOURCES,$< $(filter-out $(TARGET_LIB_PATH)/%,$^))
137
137
  $(SET_LIBL)
138
- system "crtrpgmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$$RPG_SRC_ROOT/$<') incdir('$$RPG_SRC_ROOT') tgtccsid(*job) output(*print) dbgview(*all)"
138
+ system "crtrpgmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$$RPG_SRC_ROOT/$(call shell_escape_dollars,$<)') incdir('$$RPG_SRC_ROOT') tgtccsid(*job) output(*print) dbgview(*all)"
139
139
  $(call RPG_CLEANUP_SOURCES)
140
140
  endef
141
141
 
@@ -144,7 +144,7 @@ define BUILD_SQLRPGLE_MODULE
144
144
  $(call SETUP_LOG,$(notdir $@))
145
145
  $(call RPG_PREPROCESS_SOURCES,$< $(filter-out $(TARGET_LIB_PATH)/%,$^))
146
146
  $(SET_LIBL)
147
- system "crtsqlrpgi obj($(TARGET_LIB)/$(basename $(@F))) objtype(*module) srcstmf('$$RPG_SRC_ROOT/$<') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''$$RPG_SRC_ROOT'') tgtccsid(*job) output(*print)') dbgview(*source)"
147
+ system "crtsqlrpgi obj($(TARGET_LIB)/$(call ibmi_name_sh,$@)) objtype(*module) srcstmf('$$RPG_SRC_ROOT/$(call shell_escape_dollars,$<)') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''$$RPG_SRC_ROOT'') tgtccsid(*job) output(*print)') dbgview(*source)"
148
148
  $(call RPG_CLEANUP_SOURCES)
149
149
  endef
150
150
 
@@ -152,14 +152,14 @@ endef
152
152
  define BUILD_CBLLE_PGM
153
153
  $(call SETUP_LOG,$(notdir $@))
154
154
  $(SET_LIBL)
155
- system "crtbndcbl pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') tgtccsid(*job) output(*print) dbgview(*all)"
155
+ system "crtbndcbl pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') tgtccsid(*job) output(*print) dbgview(*all)"
156
156
  endef
157
157
 
158
158
  # Build ILE COBOL module
159
159
  define BUILD_CBLLE_MODULE
160
160
  $(call SETUP_LOG,$(notdir $@))
161
161
  $(SET_LIBL)
162
- system "crtcblmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') tgtccsid(*job) output(*print) dbgview(*all)"
162
+ system "crtcblmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') tgtccsid(*job) output(*print) dbgview(*all)"
163
163
  endef
164
164
 
165
165
  # Build ILE CL program (bound)
@@ -170,7 +170,7 @@ $(SET_LIBL)
170
170
  $(DETECT_IBMI_RELEASE)
171
171
  TGTCCSID_PARM=
172
172
  if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi
173
- system "crtbndcl pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)"
173
+ system "crtbndcl pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)"
174
174
  endef
175
175
 
176
176
  # Build OPM CL program
@@ -178,7 +178,7 @@ define BUILD_CLP_PGM
178
178
  $(call SETUP_LOG,$(notdir $@))
179
179
  $(call CREATE_SOURCE_MEMBER,$<,qclsrc)
180
180
  $(SET_LIBL)
181
- system "crtclpgm pgm($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qclsrc) output(*print)"
181
+ system "crtclpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qclsrc) output(*print)"
182
182
  endef
183
183
 
184
184
  # Build ILE CL module
@@ -189,28 +189,28 @@ $(SET_LIBL)
189
189
  $(DETECT_IBMI_RELEASE)
190
190
  TGTCCSID_PARM=
191
191
  if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi
192
- system "crtclmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)"
192
+ system "crtclmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)"
193
193
  endef
194
194
 
195
195
  # Build program from modules
196
196
  define BUILD_MODULE_TO_PGM
197
197
  $(call SETUP_LOG,$(notdir $@))
198
198
  $(SET_LIBL)
199
- system "crtpgm pgm($(TARGET_LIB)/$(basename $(@F))) $(MODULE_PARM) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
199
+ system "crtpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
200
200
  endef
201
201
 
202
202
  # Build service program from modules
203
203
  define BUILD_MODULE_TO_SRVPGM
204
204
  $(call SETUP_LOG,$(notdir $@))
205
205
  $(SET_LIBL)
206
- system "crtsrvpgm srvpgm($(TARGET_LIB)/$(basename $(@F))) $(MODULE_PARM) export(*srcfile) srcstmf('$(filter %.exports %.bnd,$^)') $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
206
+ 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)"
207
207
  endef
208
208
 
209
209
  # Build service program from modules (export all procedures)
210
210
  define BUILD_MODULE_TO_SRVPGM_ALL
211
211
  $(call SETUP_LOG,$(notdir $@))
212
212
  $(SET_LIBL)
213
- system "crtsrvpgm srvpgm($(TARGET_LIB)/$(basename $(@F))) $(MODULE_PARM) export(*all) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
213
+ system "crtsrvpgm srvpgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) export(*all) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
214
214
  endef
215
215
 
216
216
  # Build display file
@@ -218,7 +218,7 @@ define BUILD_DSPF_TO_FILE
218
218
  $(call SETUP_LOG,$(notdir $@))
219
219
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
220
220
  $(SET_LIBL)
221
- system "crtdspf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc)"
221
+ system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
222
222
  endef
223
223
 
224
224
  # Build display file from RDF (Rich Display File) JSON
@@ -227,7 +227,7 @@ $(call SETUP_LOG,$(notdir $@))
227
227
  '$(CODERMAKE_NODE)' '$(CODERMAKE_PACKAGE_DIR)/bin/rdf-to-dds.js' '$<' 'tmp/$(basename $(@F)).dspf'
228
228
  $(call CREATE_SOURCE_MEMBER,tmp/$(basename $(@F)).dspf,qddssrc)
229
229
  $(SET_LIBL)
230
- system "crtdspf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc) enhdsp(*yes)"
230
+ system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) enhdsp(*yes)"
231
231
  rm -f 'tmp/$(basename $(@F)).dspf'
232
232
  endef
233
233
 
@@ -236,7 +236,7 @@ define BUILD_PF_TO_FILE
236
236
  $(call SETUP_LOG,$(notdir $@))
237
237
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
238
238
  $(SET_LIBL)
239
- system "crtpf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc) aut(*change)"
239
+ system "crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<)) aut(*change)"
240
240
  endef
241
241
 
242
242
  # Build logical file
@@ -244,7 +244,7 @@ define BUILD_LF_TO_FILE
244
244
  $(call SETUP_LOG,$(notdir $@))
245
245
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
246
246
  $(SET_LIBL)
247
- system "crtlf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc)"
247
+ system "crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
248
248
  endef
249
249
 
250
250
  # Build printer file
@@ -252,35 +252,35 @@ define BUILD_PRTF_TO_FILE
252
252
  $(call SETUP_LOG,$(notdir $@))
253
253
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
254
254
  $(SET_LIBL)
255
- system "crtprtf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc)"
255
+ system "crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
256
256
  endef
257
257
 
258
258
  # Build SQL table
259
259
  define BUILD_SQLTABLE_TO_FILE
260
260
  $(call SETUP_LOG,$(notdir $@))
261
261
  $(SET_LIBL)
262
- system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))"
262
+ system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))"
263
263
  endef
264
264
 
265
265
  # Build SQL index
266
266
  define BUILD_SQLINDEX_TO_FILE
267
267
  $(call SETUP_LOG,$(notdir $@))
268
268
  $(SET_LIBL)
269
- system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))"
269
+ system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))"
270
270
  endef
271
271
 
272
272
  # Build SQL view
273
273
  define BUILD_SQLVIEW_TO_FILE
274
274
  $(call SETUP_LOG,$(notdir $@))
275
275
  $(SET_LIBL)
276
- system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))"
276
+ system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))"
277
277
  endef
278
278
 
279
279
  # Build SQL procedure
280
280
  define BUILD_SQLPROC_TO_PGM
281
281
  $(call SETUP_LOG,$(notdir $@))
282
282
  $(SET_LIBL)
283
- system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))"
283
+ system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))"
284
284
  endef
285
285
 
286
286
  # Build message file from CL commands
@@ -299,7 +299,7 @@ endef
299
299
  define BUILD_MENU
300
300
  $(call SETUP_LOG,$(notdir $@))
301
301
  $(SET_LIBL)
302
- system "crtmnu menu($(TARGET_LIB)/$(basename $(@F))) type(*dspf) dspf($(basename $(notdir $(filter %.file,$^)))) msgf($(basename $(notdir $(filter %.msgf,$^)))) cmdlin(*none) dspkey(*no)"
302
+ 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)"
303
303
  endef
304
304
 
305
305
  ######
@@ -310,9 +310,9 @@ endef
310
310
  .PHONY: platform-clean
311
311
  platform-clean:
312
312
  @rm -rf tmp/rpg-pp-*
313
- if [ -n "$(TARGETS)" ]; then
313
+ if [ -n "$(call shell_escape_dollars,$(TARGETS))" ]; then
314
314
  for pass in 1 2; do
315
- for target in $(TARGETS); do
315
+ for target in $(call shell_escape_dollars,$(TARGETS)); do
316
316
  lib_part=$${target#/qsys.lib/}
317
317
  lib=$${lib_part%%/*}
318
318
  lib=$${lib%.lib}
@@ -72,11 +72,11 @@ $(SSH) $(QSHELL) <<'EOF'
72
72
  if [ ! -e '$(TARGET_LIB_PATH)/$(2).file' ]; then
73
73
  system "crtsrcpf file($(TARGET_LIB)/$(2))"
74
74
  fi
75
- if [ ! -e '$(TARGET_LIB_PATH)/$(2).file/$(basename $(notdir $(1))).mbr' ]; then
76
- system "addpfm file($(TARGET_LIB)/$(2)) mbr($(basename $(notdir $(1)))) srctype($(subst .,,$(suffix $(1))))"
75
+ if [ ! -e '$(TARGET_LIB_PATH)/$(2).file/$(call ibmi_name,$(1)).mbr' ]; then
76
+ system "addpfm file($(TARGET_LIB)/$(2)) mbr($(call ibmi_name_sh,$(1))) srctype($(subst .,,$(suffix $(1))))"
77
77
  fi
78
78
  EOF
79
- cat '$(1)' | $(SSH) "$(QSHELL) -c 'Rfile -Qw \"$(TARGET_LIB)/$(2)($(basename $(notdir $(1))))\"'"
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
82
  ######
@@ -88,7 +88,7 @@ define BUILD_FROM_CL_FILE
88
88
  $(call REMOTE_BUILD,$(2), \
89
89
  rm -rf '$(TARGET_LIB_PATH)/$(notdir $(1))' && \
90
90
  export LIBRARY=$(TARGET_LIB) && \
91
- export NAME=$(basename $(notdir $(1))) && \
91
+ export NAME='$(call ibmi_name,$(1))' && \
92
92
  ( \
93
93
  echo "$(file < $<)" | while IFS= read -r line; do \
94
94
  system "$$line"; \
@@ -103,7 +103,7 @@ endef
103
103
  ######
104
104
  LOG_DIR = tmp/logs$(if $(TARGET_LIBRARY),/$(TARGET_LIBRARY))
105
105
  define SETUP_LOG
106
- @echo "Creating $(1)"
106
+ @echo "Creating $(call shell_escape_dollars,$(1))"
107
107
  $(MKDIR) -p '$(LOG_DIR)'
108
108
  exec > '$(LOG_DIR)/$(1).log' 2>&1
109
109
  endef
@@ -127,7 +127,7 @@ endef
127
127
  ######
128
128
  define REMOTE_BUILD_FROM
129
129
  TAR_FILE=tmp/codermake_$$(uuidgen).tar
130
- tar -C "$(1)" -cf "$$TAR_FILE" $(2)
130
+ tar -C "$(1)" -cf "$$TAR_FILE" $(call shell_escape_dollars,$(2))
131
131
  REMOTE_DIR=/tmp/codermake_$$(uuidgen)
132
132
  $(SSH) "$(QSHELL) -c 'mkdir $$REMOTE_DIR'"
133
133
  EXIT_CODE=0
@@ -200,7 +200,7 @@ endif
200
200
  define BUILD_RPGLE_PGM
201
201
  $(call SETUP_LOG,$(notdir $@))
202
202
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
203
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtbndrpg pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
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)")
204
204
  $(call RPG_CLEANUP_SOURCES)
205
205
  touch '$@'
206
206
  endef
@@ -209,7 +209,7 @@ endef
209
209
  define BUILD_SQLRPGLE_PGM
210
210
  $(call SETUP_LOG,$(notdir $@))
211
211
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
212
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtsqlrpgi obj($(TARGET_LIB)/$(basename $(@F))) objtype(*pgm) srcstmf('$<') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''.'') tgtccsid(*job) output(*print)') dbgview(*source)")
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)")
213
213
  $(call RPG_CLEANUP_SOURCES)
214
214
  touch '$@'
215
215
  endef
@@ -218,7 +218,7 @@ endef
218
218
  define BUILD_RPGLE_MODULE
219
219
  $(call SETUP_LOG,$(notdir $@))
220
220
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
221
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtrpgmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
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)")
222
222
  $(call RPG_CLEANUP_SOURCES)
223
223
  touch '$@'
224
224
  endef
@@ -227,7 +227,7 @@ endef
227
227
  define BUILD_SQLRPGLE_MODULE
228
228
  $(call SETUP_LOG,$(notdir $@))
229
229
  $(call RPG_PREPROCESS_SOURCES,$(filter-out build/%,$^))
230
- $(call REMOTE_BUILD_FROM,$$RPG_SRC_ROOT,$(filter-out build/%,$^),system "crtsqlrpgi obj($(TARGET_LIB)/$(basename $(@F))) objtype(*module) srcstmf('$<') cvtccsid(*job) output(*print) rpgppopt(*lvl2) compileopt('incdir(''.'') tgtccsid(*job) output(*print)') dbgview(*source)")
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)")
231
231
  $(call RPG_CLEANUP_SOURCES)
232
232
  touch '$@'
233
233
  endef
@@ -235,14 +235,14 @@ endef
235
235
  # Build ILE COBOL program (bound)
236
236
  define BUILD_CBLLE_PGM
237
237
  $(call SETUP_LOG,$(notdir $@))
238
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtbndcbl pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') tgtccsid(*job) output(*print) dbgview(*all)")
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)")
239
239
  touch '$@'
240
240
  endef
241
241
 
242
242
  # Build ILE COBOL module
243
243
  define BUILD_CBLLE_MODULE
244
244
  $(call SETUP_LOG,$(notdir $@))
245
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtcblmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') tgtccsid(*job) output(*print) dbgview(*all)")
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)")
246
246
  touch '$@'
247
247
  endef
248
248
 
@@ -255,7 +255,7 @@ $(call REMOTE_BUILD,$(filter-out build/%,$^),\
255
255
  $(DETECT_IBMI_RELEASE); \
256
256
  TGTCCSID_PARM=; \
257
257
  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)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
258
+ system "crtbndcl pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
259
259
  touch '$@'
260
260
  endef
261
261
 
@@ -265,7 +265,7 @@ $(call SETUP_LOG,$(notdir $@))
265
265
  $(call CREATE_SOURCE_MEMBER,$<,qclsrc)
266
266
  $(SSH) $(QSHELL) <<'EOF'
267
267
  $(SET_LIBL)
268
- system "crtclpgm pgm($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qclsrc) output(*print)"
268
+ system "crtclpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qclsrc) output(*print)"
269
269
  EOF
270
270
  touch '$@'
271
271
  endef
@@ -279,7 +279,7 @@ $(call REMOTE_BUILD,$(filter-out build/%,$^),\
279
279
  $(DETECT_IBMI_RELEASE); \
280
280
  TGTCCSID_PARM=; \
281
281
  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)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
282
+ system "crtclmod module($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcstmf('$(call shell_escape_dollars,$<)') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
283
283
  touch '$@'
284
284
  endef
285
285
 
@@ -288,7 +288,7 @@ define BUILD_MODULE_TO_PGM
288
288
  $(call SETUP_LOG,$(notdir $@))
289
289
  $(SSH) $(QSHELL) <<'EOF'
290
290
  $(SET_LIBL)
291
- system "crtpgm pgm($(TARGET_LIB)/$(basename $(@F))) $(MODULE_PARM) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
291
+ system "crtpgm pgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
292
292
  EOF
293
293
  touch '$@'
294
294
  endef
@@ -296,7 +296,7 @@ endef
296
296
  # Build service program from modules
297
297
  define BUILD_MODULE_TO_SRVPGM
298
298
  $(call SETUP_LOG,$(notdir $@))
299
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtsrvpgm srvpgm($(TARGET_LIB)/$(basename $(@F))) $(MODULE_PARM) export(*srcfile) srcstmf('$(filter %.exports %.bnd,$^)') $(BNDSRVPGM_PARM) $(BNDDIR_PARM)")
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)")
300
300
  touch '$@'
301
301
  endef
302
302
 
@@ -305,7 +305,7 @@ define BUILD_MODULE_TO_SRVPGM_ALL
305
305
  $(call SETUP_LOG,$(notdir $@))
306
306
  $(SSH) $(QSHELL) <<'EOF'
307
307
  $(SET_LIBL)
308
- system "crtsrvpgm srvpgm($(TARGET_LIB)/$(basename $(@F))) $(MODULE_PARM) export(*all) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
308
+ system "crtsrvpgm srvpgm($(TARGET_LIB)/$(call ibmi_name_sh,$@)) $(MODULE_PARM) export(*all) $(BNDSRVPGM_PARM) $(BNDDIR_PARM)"
309
309
  EOF
310
310
  touch '$@'
311
311
  endef
@@ -316,7 +316,7 @@ $(call SETUP_LOG,$(notdir $@))
316
316
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
317
317
  $(SSH) $(QSHELL) <<'EOF'
318
318
  $(SET_LIBL)
319
- system "crtdspf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc)"
319
+ system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
320
320
  EOF
321
321
  touch '$@'
322
322
  endef
@@ -328,7 +328,7 @@ $(call SETUP_LOG,$(notdir $@))
328
328
  $(call CREATE_SOURCE_MEMBER,tmp/$(basename $(@F)).dspf,qddssrc)
329
329
  $(SSH) $(QSHELL) <<'EOF'
330
330
  $(SET_LIBL)
331
- system "crtdspf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc) enhdsp(*yes)"
331
+ system "crtdspf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) enhdsp(*yes)"
332
332
  EOF
333
333
  rm -f 'tmp/$(basename $(@F)).dspf'
334
334
  touch '$@'
@@ -340,7 +340,7 @@ $(call SETUP_LOG,$(notdir $@))
340
340
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
341
341
  $(SSH) $(QSHELL) <<'EOF'
342
342
  $(SET_LIBL)
343
- system "crtpf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc)"
343
+ system "crtpf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
344
344
  EOF
345
345
  touch '$@'
346
346
  endef
@@ -351,7 +351,7 @@ $(call SETUP_LOG,$(notdir $@))
351
351
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
352
352
  $(SSH) $(QSHELL) <<'EOF'
353
353
  $(SET_LIBL)
354
- system "crtlf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc)"
354
+ system "crtlf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
355
355
  EOF
356
356
  touch '$@'
357
357
  endef
@@ -362,7 +362,7 @@ $(call SETUP_LOG,$(notdir $@))
362
362
  $(call CREATE_SOURCE_MEMBER,$<,qddssrc)
363
363
  $(SSH) $(QSHELL) <<'EOF'
364
364
  $(SET_LIBL)
365
- system "crtprtf file($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qddssrc)"
365
+ system "crtprtf file($(TARGET_LIB)/$(call ibmi_name_sh,$@)) srcfile($(TARGET_LIB)/qddssrc) srcmbr($(call ibmi_name_sh,$<))"
366
366
  EOF
367
367
  touch '$@'
368
368
  endef
@@ -370,28 +370,28 @@ endef
370
370
  # Build SQL table
371
371
  define BUILD_SQLTABLE_TO_FILE
372
372
  $(call SETUP_LOG,$(notdir $@))
373
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))")
373
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
374
374
  touch '$@'
375
375
  endef
376
376
 
377
377
  # Build SQL index
378
378
  define BUILD_SQLINDEX_TO_FILE
379
379
  $(call SETUP_LOG,$(notdir $@))
380
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))")
380
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
381
381
  touch '$@'
382
382
  endef
383
383
 
384
384
  # Build SQL view
385
385
  define BUILD_SQLVIEW_TO_FILE
386
386
  $(call SETUP_LOG,$(notdir $@))
387
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))")
387
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
388
388
  touch '$@'
389
389
  endef
390
390
 
391
391
  # Build SQL procedure
392
392
  define BUILD_SQLPROC_TO_PGM
393
393
  $(call SETUP_LOG,$(notdir $@))
394
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$<') commit(*none) dftrdbcol($(TARGET_LIB))")
394
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),system "runsqlstm srcstmf('$(call shell_escape_dollars,$<)') commit(*none) dftrdbcol($(TARGET_LIB))")
395
395
  touch '$@'
396
396
  endef
397
397
 
@@ -414,7 +414,7 @@ define BUILD_MENU
414
414
  $(call SETUP_LOG,$(notdir $@))
415
415
  $(SSH) $(QSHELL) <<'EOF'
416
416
  $(SET_LIBL)
417
- system "crtmnu menu($(TARGET_LIB)/$(basename $(@F))) type(*dspf) dspf($(basename $(notdir $(filter %.file,$^)))) msgf($(basename $(notdir $(filter %.msgf,$^)))) cmdlin(*none) dspkey(*no)"
417
+ 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)"
418
418
  EOF
419
419
  touch '$@'
420
420
  endef
@@ -431,13 +431,13 @@ platform-clean:
431
431
  rm -rf tmp/logs
432
432
  rm -rf tmp/codermake_*.tar
433
433
  rm -rf tmp/rpg-pp-*
434
- @if [ -n "$(TARGETS)" ]; then
434
+ @if [ -n "$(call shell_escape_dollars,$(TARGETS))" ]; then
435
435
  $(SSH) $(QSHELL) <<EOF
436
436
  # Two passes over all targets so dependent objects (e.g. SQL views/indexes
437
437
  # over a table) get deleted in the first pass, freeing the underlying object
438
438
  # for deletion in the second pass.
439
439
  for pass in 1 2; do
440
- for target in $(TARGETS); do
440
+ for target in $(call remote_shell_escape_dollars,$(TARGETS)); do
441
441
  # Strip "build/" prefix to get the relative portion.
442
442
  rel="\$${target#build/}"
443
443
  if [ "\$$rel" = "\$$target" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profoundlogic/codermake",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
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",