@profoundlogic/codermake 1.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.
- package/LICENSE.txt +322 -0
- package/README.md +201 -0
- package/dist/bin/index.js +2 -0
- package/dist/bin/rdf-to-dds.js +2 -0
- package/dist/lib/discovery.js +1 -0
- package/dist/lib/executor.js +1 -0
- package/dist/lib/generate-rdf-dds.js +1 -0
- package/dist/lib/license.js +1 -0
- package/dist/lib/makefile-generator.js +1 -0
- package/dist/lib/platform.js +1 -0
- package/dist/lib/preprocessor.js +1 -0
- package/dist/lib/rdf-to-post-data.js +1 -0
- package/dist/lib/writer.js +1 -0
- package/dist/makefiles/Makefile +35 -0
- package/dist/makefiles/base.mk +24 -0
- package/dist/makefiles/ibmi.mk +188 -0
- package/dist/makefiles/unix.mk +288 -0
- package/package.json +43 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
######
|
|
2
|
+
# IBM i build rules and recipe utilities
|
|
3
|
+
# For local builds on IBM i PASE
|
|
4
|
+
######
|
|
5
|
+
|
|
6
|
+
######
|
|
7
|
+
# Bail out if required environment variables are not set properly.
|
|
8
|
+
######
|
|
9
|
+
ifeq (,$(BUILD_LIBRARY))
|
|
10
|
+
$(error Required variable BUILD_LIBRARY is not set.)
|
|
11
|
+
endif
|
|
12
|
+
ifneq (1,$(words [$(BUILD_LIBRARY)]))
|
|
13
|
+
$(error BUILD_LIBRARY variable is not set correctly. Set to a valid library name and try again)
|
|
14
|
+
endif
|
|
15
|
+
|
|
16
|
+
######
|
|
17
|
+
# Output library.
|
|
18
|
+
######
|
|
19
|
+
LIBRARY := $(BUILD_LIBRARY)
|
|
20
|
+
LIBRARY_PATH := /qsys.lib/$(LIBRARY).lib
|
|
21
|
+
|
|
22
|
+
######
|
|
23
|
+
# Shell configuration.
|
|
24
|
+
######
|
|
25
|
+
export QIBM_MULTI_THREADED := Y
|
|
26
|
+
SHELL := /usr/bin/qsh
|
|
27
|
+
MKDIR := /QOpenSys/usr/bin/mkdir
|
|
28
|
+
|
|
29
|
+
######
|
|
30
|
+
# Utility to create a source member from IFS source.
|
|
31
|
+
# $(1) = IFS file path (source type is derived from file extension)
|
|
32
|
+
# $(2) = source file name (e.g., qddssrc, qrpglesrc)
|
|
33
|
+
######
|
|
34
|
+
define CREATE_SOURCE_MEMBER
|
|
35
|
+
test -e $(LIBRARY_PATH)/$(2).file || system "crtsrcpf file($(LIBRARY)/$(2))"
|
|
36
|
+
test -e $(LIBRARY_PATH)/$(2).file/$(basename $(notdir $(1))).mbr || system "addpfm file($(LIBRARY)/$(2)) mbr($(basename $(notdir $(1)))) srctype($(subst .,,$(suffix $(1))))"
|
|
37
|
+
cat '$(1)' | Rfile -Qw '$(LIBRARY)/$(2)($(basename $(notdir $(1))))'
|
|
38
|
+
endef
|
|
39
|
+
|
|
40
|
+
######
|
|
41
|
+
# Utility to build an object via CL commands in a separate file.
|
|
42
|
+
# $(1) = Object path
|
|
43
|
+
# $(2) = Command file path
|
|
44
|
+
######
|
|
45
|
+
define BUILD_FROM_CL_FILE
|
|
46
|
+
rm -rf '$(1)'
|
|
47
|
+
export LIBRARY=$(LIBRARY)
|
|
48
|
+
export NAME=$(basename $(notdir $(1)))
|
|
49
|
+
(
|
|
50
|
+
$(SET_LIBL)
|
|
51
|
+
echo "$(file < $(2))" | while IFS= read -r line; do
|
|
52
|
+
system "$$line"
|
|
53
|
+
done
|
|
54
|
+
) || (rm -rf '$(1)'; exit 1)
|
|
55
|
+
endef
|
|
56
|
+
|
|
57
|
+
######
|
|
58
|
+
# Utility to output "Creating X..." message and redirect recipe output to log file.
|
|
59
|
+
######
|
|
60
|
+
define SETUP_LOG
|
|
61
|
+
@echo "Creating $(1)"
|
|
62
|
+
touch -C 1208 'tmp/logs/$(1).log'
|
|
63
|
+
exec > 'tmp/logs/$(1).log' 2>&1
|
|
64
|
+
endef
|
|
65
|
+
|
|
66
|
+
######
|
|
67
|
+
# Prerun actions.
|
|
68
|
+
######
|
|
69
|
+
$(info ===)
|
|
70
|
+
$(info Target library: $(LIBRARY))
|
|
71
|
+
$(info ===)
|
|
72
|
+
|
|
73
|
+
######
|
|
74
|
+
# Library creation target
|
|
75
|
+
######
|
|
76
|
+
$(LIBRARY_PATH):
|
|
77
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
78
|
+
system "crtlib $(LIBRARY) *test aut(*use) crtaut(*use)"
|
|
79
|
+
|
|
80
|
+
######
|
|
81
|
+
# Recipe utilities (callable functions for preprocessor-generated rules)
|
|
82
|
+
######
|
|
83
|
+
|
|
84
|
+
# Build RPGLE program (bound)
|
|
85
|
+
define BUILD_RPGLE_PGM
|
|
86
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
87
|
+
$(SET_LIBL)
|
|
88
|
+
system "crtbndrpg pgm($(LIBRARY)/$(basename $(@F))) srcstmf('$<') incdir('src') tgtccsid(*job) output(*print) dbgview(*all)"
|
|
89
|
+
endef
|
|
90
|
+
|
|
91
|
+
# Build SQL RPGLE program
|
|
92
|
+
define BUILD_SQLRPGLE_PGM
|
|
93
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
94
|
+
$(SET_LIBL)
|
|
95
|
+
system "crtsqlrpgi obj($(LIBRARY)/$(basename $(@F))) objtype(*pgm) srcstmf('$<') cvtccsid(*job) output(*print) rpgppopt(*lvl1) compileopt('incdir(''src'') tgtccsid(*job) output(*print)') dbgview(*source)"
|
|
96
|
+
endef
|
|
97
|
+
|
|
98
|
+
# Build RPGLE module
|
|
99
|
+
define BUILD_RPGLE_MODULE
|
|
100
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
101
|
+
$(SET_LIBL)
|
|
102
|
+
system "crtrpgmod module($(LIBRARY)/$(basename $(@F))) srcstmf('$<') incdir('src') tgtccsid(*job) output(*print) dbgview(*all)"
|
|
103
|
+
endef
|
|
104
|
+
|
|
105
|
+
# Build SQL RPGLE module
|
|
106
|
+
define BUILD_SQLRPGLE_MODULE
|
|
107
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
108
|
+
$(SET_LIBL)
|
|
109
|
+
system "crtsqlrpgi obj($(LIBRARY)/$(basename $(@F))) objtype(*module) srcstmf('$<') cvtccsid(*job) output(*print) rpgppopt(*lvl1) compileopt('incdir(''src'') tgtccsid(*job) output(*print)') dbgview(*source)"
|
|
110
|
+
endef
|
|
111
|
+
|
|
112
|
+
# Build program from modules
|
|
113
|
+
define BUILD_MODULE_TO_PGM
|
|
114
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
115
|
+
$(SET_LIBL)
|
|
116
|
+
system "crtpgm pgm($(LIBRARY)/$(basename $(@F))) module($(foreach m,$(filter %.module,$^),$(basename $(notdir $(m)))))"
|
|
117
|
+
endef
|
|
118
|
+
|
|
119
|
+
# Build service program from modules
|
|
120
|
+
define BUILD_MODULE_TO_SRVPGM
|
|
121
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
122
|
+
$(SET_LIBL)
|
|
123
|
+
system "crtsrvpgm srvpgm($(LIBRARY)/$(basename $(@F))) module($(foreach m,$(filter %.module,$^),$(basename $(notdir $(m))))) export(*srcfile) srcstmf('$(filter %.exports,$^)')"
|
|
124
|
+
endef
|
|
125
|
+
|
|
126
|
+
# Build display file
|
|
127
|
+
define BUILD_DSPF_TO_FILE
|
|
128
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
129
|
+
$(call CREATE_SOURCE_MEMBER,$<,qddssrc)
|
|
130
|
+
$(SET_LIBL)
|
|
131
|
+
system "crtdspf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc)"
|
|
132
|
+
endef
|
|
133
|
+
|
|
134
|
+
# Build display file from RDF (Rich Display File) JSON
|
|
135
|
+
define BUILD_RDF_TO_FILE
|
|
136
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
137
|
+
node '$(CODERMAKE_PACKAGE_DIR)/bin/rdf-to-dds.js' '$<' 'tmp/$(basename $(@F)).dspf'
|
|
138
|
+
$(call CREATE_SOURCE_MEMBER,tmp/$(basename $(@F)).dspf,qddssrc)
|
|
139
|
+
$(SET_LIBL)
|
|
140
|
+
system "crtdspf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc) enhdsp(*yes)"
|
|
141
|
+
rm -f 'tmp/$(basename $(@F)).dspf'
|
|
142
|
+
endef
|
|
143
|
+
|
|
144
|
+
# Build physical file
|
|
145
|
+
define BUILD_PF_TO_FILE
|
|
146
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
147
|
+
$(call CREATE_SOURCE_MEMBER,$<,qddssrc)
|
|
148
|
+
$(SET_LIBL)
|
|
149
|
+
system "crtpf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc) aut(*change)"
|
|
150
|
+
endef
|
|
151
|
+
|
|
152
|
+
# Build logical file
|
|
153
|
+
define BUILD_LF_TO_FILE
|
|
154
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
155
|
+
$(call CREATE_SOURCE_MEMBER,$<,qddssrc)
|
|
156
|
+
$(SET_LIBL)
|
|
157
|
+
system "crtlf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc)"
|
|
158
|
+
endef
|
|
159
|
+
|
|
160
|
+
# Build message file from CL commands
|
|
161
|
+
define BUILD_MSGF
|
|
162
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
163
|
+
$(call BUILD_FROM_CL_FILE,$@,$<)
|
|
164
|
+
endef
|
|
165
|
+
|
|
166
|
+
# Build binding directory from CL commands
|
|
167
|
+
define BUILD_BNDDIR
|
|
168
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
169
|
+
$(call BUILD_FROM_CL_FILE,$@,$<)
|
|
170
|
+
endef
|
|
171
|
+
|
|
172
|
+
# Build menu from display file and message file
|
|
173
|
+
define BUILD_MENU
|
|
174
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
175
|
+
$(SET_LIBL)
|
|
176
|
+
system "crtmnu menu($(LIBRARY)/$(basename $(@F))) type(*dspf) dspf($(basename $(notdir $(filter %.file,$^)))) msgf($(basename $(notdir $(filter %.msgf,$^)))) cmdlin(*none) dspkey(*no)"
|
|
177
|
+
endef
|
|
178
|
+
|
|
179
|
+
######
|
|
180
|
+
# Platform-specific clean
|
|
181
|
+
######
|
|
182
|
+
.PHONY: platform-clean
|
|
183
|
+
platform-clean:
|
|
184
|
+
@if [ -n "$(TARGETS)" ] && [ -d $(LIBRARY_PATH) ]; then
|
|
185
|
+
for target in $(TARGETS); do
|
|
186
|
+
rm -rf "$$target"
|
|
187
|
+
done
|
|
188
|
+
fi
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
######
|
|
2
|
+
# Unix-like build rules and recipe utilities
|
|
3
|
+
# For remote builds from Linux, macOS, FreeBSD, etc. to IBM i via SSH
|
|
4
|
+
######
|
|
5
|
+
|
|
6
|
+
######
|
|
7
|
+
# Bail out if required environment variables are not set properly.
|
|
8
|
+
######
|
|
9
|
+
ifeq (,$(IBMI_BUILD_LIBRARY))
|
|
10
|
+
$(error Required variable IBMI_BUILD_LIBRARY is not set.)
|
|
11
|
+
endif
|
|
12
|
+
ifneq (1,$(words [$(IBMI_BUILD_LIBRARY)]))
|
|
13
|
+
$(error IBMI_BUILD_LIBRARY variable is not set correctly. Set to a valid library name and try again.)
|
|
14
|
+
endif
|
|
15
|
+
ifeq (,$(IBMI_HOST))
|
|
16
|
+
$(warning Warning: Required variable IBMI_HOST is not set.)
|
|
17
|
+
endif
|
|
18
|
+
ifeq (,$(IBMI_USER))
|
|
19
|
+
$(warning Warning: Required variable IBMI_USER is not set.)
|
|
20
|
+
endif
|
|
21
|
+
|
|
22
|
+
######
|
|
23
|
+
# Output library.
|
|
24
|
+
######
|
|
25
|
+
LIBRARY := $(IBMI_BUILD_LIBRARY)
|
|
26
|
+
LIBRARY_PATH := /qsys.lib/$(LIBRARY).lib
|
|
27
|
+
|
|
28
|
+
######
|
|
29
|
+
# Shell configuration.
|
|
30
|
+
######
|
|
31
|
+
SHELL := /bin/bash
|
|
32
|
+
QSHELL := /usr/bin/qsh -e
|
|
33
|
+
MKDIR := mkdir
|
|
34
|
+
|
|
35
|
+
######
|
|
36
|
+
# SSH configuration for IBM i connectivity.
|
|
37
|
+
######
|
|
38
|
+
SSH := ssh -C \
|
|
39
|
+
-o PasswordAuthentication=no \
|
|
40
|
+
-o StrictHostKeyChecking=no \
|
|
41
|
+
-o UserKnownHostsFile=tmp/known_hosts \
|
|
42
|
+
-o ControlMaster=auto \
|
|
43
|
+
-o ControlPath=$(CODERMAKE_RULES_DIR)/ssh-%C \
|
|
44
|
+
-o ControlPersist=10m \
|
|
45
|
+
-o ServerAliveInterval=60 \
|
|
46
|
+
-o ServerAliveCountMax=3
|
|
47
|
+
ifdef IBMI_KEY
|
|
48
|
+
SSH := $(SSH) -i $(IBMI_KEY)
|
|
49
|
+
endif
|
|
50
|
+
SSH := $(SSH) $(IBMI_USER)@$(IBMI_HOST)
|
|
51
|
+
|
|
52
|
+
######
|
|
53
|
+
# Utility to upload a source member to IBM i from a local file.
|
|
54
|
+
# $(1) = local file path (source type is derived from file extension)
|
|
55
|
+
# $(2) = source file name (e.g., qddssrc, qrpglesrc)
|
|
56
|
+
######
|
|
57
|
+
define CREATE_SOURCE_MEMBER
|
|
58
|
+
$(SSH) $(QSHELL) <<'EOF'
|
|
59
|
+
if [ ! -e '$(LIBRARY_PATH)/$(2).file' ]; then
|
|
60
|
+
system "crtsrcpf file($(LIBRARY)/$(2))"
|
|
61
|
+
fi
|
|
62
|
+
if [ ! -e '$(LIBRARY_PATH)/$(2).file/$(basename $(notdir $(1))).mbr' ]; then
|
|
63
|
+
system "addpfm file($(LIBRARY)/$(2)) mbr($(basename $(notdir $(1)))) srctype($(subst .,,$(suffix $(1))))"
|
|
64
|
+
fi
|
|
65
|
+
EOF
|
|
66
|
+
cat '$(1)' | $(SSH) "$(QSHELL) -c 'Rfile -Qw \"$(LIBRARY)/$(2)($(basename $(notdir $(1))))\"'"
|
|
67
|
+
endef
|
|
68
|
+
|
|
69
|
+
######
|
|
70
|
+
# Utility to build an object via CL commands in a separate file.
|
|
71
|
+
# $(1) = Target path
|
|
72
|
+
# $(2) = Command file path
|
|
73
|
+
######
|
|
74
|
+
define BUILD_FROM_CL_FILE
|
|
75
|
+
$(call REMOTE_BUILD,$(2), \
|
|
76
|
+
rm -rf '$(LIBRARY_PATH)/$(notdir $(1))' && \
|
|
77
|
+
export LIBRARY=$(LIBRARY) && \
|
|
78
|
+
export NAME=$(basename $(notdir $(1))) && \
|
|
79
|
+
( \
|
|
80
|
+
echo "$(file < $<)" | while IFS= read -r line; do \
|
|
81
|
+
system "$$line"; \
|
|
82
|
+
done \
|
|
83
|
+
) || (rm -rf '$(LIBRARY_PATH)/$(notdir $(1))'; exit 1) \
|
|
84
|
+
)
|
|
85
|
+
endef
|
|
86
|
+
|
|
87
|
+
######
|
|
88
|
+
# Utility to output "Creating X..." message and redirect recipe output to log file.
|
|
89
|
+
######
|
|
90
|
+
define SETUP_LOG
|
|
91
|
+
@echo "Creating $(1)"
|
|
92
|
+
exec > 'tmp/logs/$(1).log' 2>&1
|
|
93
|
+
endef
|
|
94
|
+
|
|
95
|
+
######
|
|
96
|
+
# Reusable utility for remote builds via SSH.
|
|
97
|
+
# Handles the complete pattern of:
|
|
98
|
+
# 1. Creating an uncompressed tar archive of source files locally (preserving paths)
|
|
99
|
+
# 2. Creating a temporary directory on IBM i and uploading the tar
|
|
100
|
+
# 3. Extracting the tar (recreating directory structure), then executing build command with library list set
|
|
101
|
+
# 4. Cleaning up temp directories (local and remote) and propagating exit codes
|
|
102
|
+
#
|
|
103
|
+
# $(1) = space-separated list of local files to upload
|
|
104
|
+
# $(2) = build command to execute (typically a 'system' command)
|
|
105
|
+
#
|
|
106
|
+
# Files are archived with their full paths, so 'src/myfile.rpgle' will extract to
|
|
107
|
+
# '$$REMOTE_DIR/src/myfile.rpgle' on the remote system.
|
|
108
|
+
#
|
|
109
|
+
# Build command runs with current directory set to the remote temp directory.
|
|
110
|
+
######
|
|
111
|
+
define REMOTE_BUILD
|
|
112
|
+
TAR_FILE=tmp/codermake_$$(uuidgen).tar
|
|
113
|
+
tar -cf "$$TAR_FILE" $(1)
|
|
114
|
+
REMOTE_DIR=/tmp/codermake_$$(uuidgen)
|
|
115
|
+
$(SSH) "$(QSHELL) -c 'mkdir $$REMOTE_DIR'"
|
|
116
|
+
EXIT_CODE=0
|
|
117
|
+
(
|
|
118
|
+
cat "$$TAR_FILE" | $(SSH) "cat > '$$REMOTE_DIR/sources.tar'" && \
|
|
119
|
+
$(SSH) "REMOTE_DIR=$$REMOTE_DIR $(QSHELL)" <<'EOF'
|
|
120
|
+
cd $$REMOTE_DIR
|
|
121
|
+
tar -xf sources.tar
|
|
122
|
+
cd $$REMOTE_DIR
|
|
123
|
+
$(SET_LIBL)
|
|
124
|
+
$(2)
|
|
125
|
+
EOF
|
|
126
|
+
) || EXIT_CODE=$$?
|
|
127
|
+
rm -f "$$TAR_FILE"
|
|
128
|
+
$(SSH) "REMOTE_DIR=$$REMOTE_DIR $(QSHELL) -c 'rm -rf $$REMOTE_DIR'"
|
|
129
|
+
if [ $$EXIT_CODE -ne 0 ]; then
|
|
130
|
+
exit $$EXIT_CODE
|
|
131
|
+
fi
|
|
132
|
+
endef
|
|
133
|
+
|
|
134
|
+
######
|
|
135
|
+
# Prerun actions.
|
|
136
|
+
######
|
|
137
|
+
$(info ===)
|
|
138
|
+
$(info Target IBM i: $(IBMI_HOST))
|
|
139
|
+
$(info Target library: $(LIBRARY))
|
|
140
|
+
$(info Build user: $(IBMI_USER))
|
|
141
|
+
$(info ===)
|
|
142
|
+
$(shell mkdir -p build)
|
|
143
|
+
|
|
144
|
+
######
|
|
145
|
+
# Library creation target
|
|
146
|
+
######
|
|
147
|
+
build/$(LIBRARY).lib:
|
|
148
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
149
|
+
$(SSH) "test -e $(LIBRARY_PATH) || system \"crtlib $(LIBRARY) *test aut(*use) crtaut(*use)\""
|
|
150
|
+
touch '$@'
|
|
151
|
+
|
|
152
|
+
######
|
|
153
|
+
# Recipe utilities (callable functions for preprocessor-generated rules)
|
|
154
|
+
######
|
|
155
|
+
|
|
156
|
+
# Build RPGLE program (bound)
|
|
157
|
+
define BUILD_RPGLE_PGM
|
|
158
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
159
|
+
$(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtbndrpg pgm($(LIBRARY)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
|
|
160
|
+
touch '$@'
|
|
161
|
+
endef
|
|
162
|
+
|
|
163
|
+
# Build SQL RPGLE program
|
|
164
|
+
define BUILD_SQLRPGLE_PGM
|
|
165
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
166
|
+
$(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtsqlrpgi obj($(LIBRARY)/$(basename $(@F))) objtype(*pgm) srcstmf('$<') cvtccsid(*job) output(*print) rpgppopt(*lvl1) compileopt('incdir(''.'') tgtccsid(*job) output(*print)') dbgview(*source)")
|
|
167
|
+
touch '$@'
|
|
168
|
+
endef
|
|
169
|
+
|
|
170
|
+
# Build RPGLE module
|
|
171
|
+
define BUILD_RPGLE_MODULE
|
|
172
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
173
|
+
$(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtrpgmod module($(LIBRARY)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
|
|
174
|
+
touch '$@'
|
|
175
|
+
endef
|
|
176
|
+
|
|
177
|
+
# Build SQL RPGLE module
|
|
178
|
+
define BUILD_SQLRPGLE_MODULE
|
|
179
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
180
|
+
$(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtsqlrpgi obj($(LIBRARY)/$(basename $(@F))) objtype(*module) srcstmf('$<') cvtccsid(*job) output(*print) rpgppopt(*lvl1) compileopt('incdir(''.'') tgtccsid(*job) output(*print)') dbgview(*source)")
|
|
181
|
+
touch '$@'
|
|
182
|
+
endef
|
|
183
|
+
|
|
184
|
+
# Build program from modules
|
|
185
|
+
define BUILD_MODULE_TO_PGM
|
|
186
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
187
|
+
$(SSH) $(QSHELL) <<'EOF'
|
|
188
|
+
$(SET_LIBL)
|
|
189
|
+
system "crtpgm pgm($(LIBRARY)/$(basename $(@F))) module($(foreach m,$(filter %.module,$^),$(basename $(notdir $(m)))))"
|
|
190
|
+
EOF
|
|
191
|
+
touch '$@'
|
|
192
|
+
endef
|
|
193
|
+
|
|
194
|
+
# Build service program from modules
|
|
195
|
+
define BUILD_MODULE_TO_SRVPGM
|
|
196
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
197
|
+
$(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtsrvpgm srvpgm($(LIBRARY)/$(basename $(@F))) module($(foreach m,$(filter %.module,$^),$(basename $(notdir $(m))))) export(*srcfile) srcstmf('$(filter %.exports,$^)')")
|
|
198
|
+
touch '$@'
|
|
199
|
+
endef
|
|
200
|
+
|
|
201
|
+
# Build display file
|
|
202
|
+
define BUILD_DSPF_TO_FILE
|
|
203
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
204
|
+
$(call CREATE_SOURCE_MEMBER,$<,qddssrc)
|
|
205
|
+
$(SSH) $(QSHELL) <<'EOF'
|
|
206
|
+
$(SET_LIBL)
|
|
207
|
+
system "crtdspf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc)"
|
|
208
|
+
EOF
|
|
209
|
+
touch '$@'
|
|
210
|
+
endef
|
|
211
|
+
|
|
212
|
+
# Build display file from RDF (Rich Display File) JSON
|
|
213
|
+
define BUILD_RDF_TO_FILE
|
|
214
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
215
|
+
node '$(CODERMAKE_PACKAGE_DIR)/bin/rdf-to-dds.js' '$<' 'tmp/$(basename $(@F)).dspf'
|
|
216
|
+
$(call CREATE_SOURCE_MEMBER,tmp/$(basename $(@F)).dspf,qddssrc)
|
|
217
|
+
$(SSH) $(QSHELL) <<'EOF'
|
|
218
|
+
$(SET_LIBL)
|
|
219
|
+
system "crtdspf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc) enhdsp(*yes)"
|
|
220
|
+
EOF
|
|
221
|
+
rm -f 'tmp/$(basename $(@F)).dspf'
|
|
222
|
+
touch '$@'
|
|
223
|
+
endef
|
|
224
|
+
|
|
225
|
+
# Build physical file
|
|
226
|
+
define BUILD_PF_TO_FILE
|
|
227
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
228
|
+
$(call CREATE_SOURCE_MEMBER,$<,qddssrc)
|
|
229
|
+
$(SSH) $(QSHELL) <<'EOF'
|
|
230
|
+
$(SET_LIBL)
|
|
231
|
+
system "crtpf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc)"
|
|
232
|
+
EOF
|
|
233
|
+
touch '$@'
|
|
234
|
+
endef
|
|
235
|
+
|
|
236
|
+
# Build logical file
|
|
237
|
+
define BUILD_LF_TO_FILE
|
|
238
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
239
|
+
$(call CREATE_SOURCE_MEMBER,$<,qddssrc)
|
|
240
|
+
$(SSH) $(QSHELL) <<'EOF'
|
|
241
|
+
$(SET_LIBL)
|
|
242
|
+
system "crtlf file($(LIBRARY)/$(basename $(@F))) srcfile($(LIBRARY)/qddssrc)"
|
|
243
|
+
EOF
|
|
244
|
+
touch '$@'
|
|
245
|
+
endef
|
|
246
|
+
|
|
247
|
+
# Build message file from CL commands
|
|
248
|
+
define BUILD_MSGF
|
|
249
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
250
|
+
$(call BUILD_FROM_CL_FILE,$@,$<)
|
|
251
|
+
touch '$@'
|
|
252
|
+
endef
|
|
253
|
+
|
|
254
|
+
# Build binding directory from CL commands
|
|
255
|
+
define BUILD_BNDDIR
|
|
256
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
257
|
+
$(call BUILD_FROM_CL_FILE,$@,$<)
|
|
258
|
+
touch '$@'
|
|
259
|
+
endef
|
|
260
|
+
|
|
261
|
+
# Build menu from display file and message file
|
|
262
|
+
define BUILD_MENU
|
|
263
|
+
$(call SETUP_LOG,$(notdir $@))
|
|
264
|
+
$(SSH) $(QSHELL) <<'EOF'
|
|
265
|
+
$(SET_LIBL)
|
|
266
|
+
system "crtmnu menu($(LIBRARY)/$(basename $(@F))) type(*dspf) dspf($(basename $(notdir $(filter %.file,$^)))) msgf($(basename $(notdir $(filter %.msgf,$^)))) cmdlin(*none) dspkey(*no)"
|
|
267
|
+
EOF
|
|
268
|
+
touch '$@'
|
|
269
|
+
endef
|
|
270
|
+
|
|
271
|
+
######
|
|
272
|
+
# Platform-specific clean
|
|
273
|
+
######
|
|
274
|
+
.PHONY: platform-clean
|
|
275
|
+
platform-clean:
|
|
276
|
+
@rm -rf build/*
|
|
277
|
+
rm -rf tmp/logs
|
|
278
|
+
rm -rf tmp/codermake_*.tar
|
|
279
|
+
@CLEAN_TARGETS="$(notdir $(TARGETS))"
|
|
280
|
+
if [ -n "$$CLEAN_TARGETS" ]; then
|
|
281
|
+
$(SSH) $(QSHELL) <<EOF
|
|
282
|
+
if [ -d $(LIBRARY_PATH) ]; then
|
|
283
|
+
for target in $$CLEAN_TARGETS; do
|
|
284
|
+
rm -rf "$(LIBRARY_PATH)/\$$target"
|
|
285
|
+
done
|
|
286
|
+
fi
|
|
287
|
+
EOF
|
|
288
|
+
fi
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@profoundlogic/codermake",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Make wrapper framework for IBM i development that simplifies build rules",
|
|
5
|
+
"main": "dist/bin/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"codermake": "dist/bin/index.js"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22.0.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "npm run test:unit && npm run test:integration",
|
|
15
|
+
"test:unit": "node --test test/unit/**/*.test.js",
|
|
16
|
+
"test:integration": "CODERMAKE_E2E_TEST=true node --test --test-concurrency=1 test/integration/**/*.test.js",
|
|
17
|
+
"build": "node scripts/build.js",
|
|
18
|
+
"clean": "rm -rf dist/",
|
|
19
|
+
"test:dist": "npm run build && npm run test:dist:unit && npm run test:dist:integration",
|
|
20
|
+
"test:dist:unit": "node --test dist/test/unit/**/*.test.js",
|
|
21
|
+
"test:dist:integration": "CODERMAKE_E2E_TEST=true node --test --test-concurrency=1 dist/test/integration/**/*.test.js",
|
|
22
|
+
"lint": "eslint . --ignore-pattern dist/",
|
|
23
|
+
"start": "./bin/index.js",
|
|
24
|
+
"prepublishOnly": "npm run lint && npm test && npm run build && npm run test:dist"
|
|
25
|
+
},
|
|
26
|
+
"author": "Profound Logic Software",
|
|
27
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"dotenv": "^16.4.7",
|
|
30
|
+
"eslint": "^9.39.1",
|
|
31
|
+
"javascript-obfuscator": "^5.1.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/bin/",
|
|
38
|
+
"dist/lib/",
|
|
39
|
+
"dist/makefiles/",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE.txt"
|
|
42
|
+
]
|
|
43
|
+
}
|