-
Notifications
You must be signed in to change notification settings - Fork 18
/
makefile
executable file
·54 lines (44 loc) · 1.92 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
DBGVIEW=*NONE
BIN_LIB=MIGRATE
# Makefile for migrate project
all: $(BIN_LIB).lib migsrcpf.pgm migsrcpf.cmd
migsrcpf.pgm: migsrcpf.rpgle member.rpgle utils.sqlrpgle library.rpgle
%.lib:
-system -q "CRTLIB $*"
@touch $@
%.pgm:
$(eval modules := $(patsubst %,$(BIN_LIB)/%,$(basename $(filter %.rpgle %.sqlrpgle,$(notdir $^)))))
system "CRTPGM PGM($(BIN_LIB)/$*) MODULE($(modules))"
@touch $@
%.rpgle: src/%.rpgle
system -s "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1252)"
system "CRTRPGMOD MODULE($(BIN_LIB)/$*) SRCSTMF('$<') DBGVIEW($(DBGVIEW))"
@touch $@
%.sqlrpgle: src/%.sqlrpgle
system -s "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1252)"
system "CRTSQLRPGI OBJ($(BIN_LIB)/$*) SRCSTMF('$<') COMMIT(*NONE) OBJTYPE(*MODULE) DBGVIEW($(DBGVIEW))"
@touch $@
%.cmd: src/%.cmd
-system -qi "CRTSRCPF FILE($(BIN_LIB)/QCMDSRC) RCDLEN(112)"
system "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(BIN_LIB).lib/QCMDSRC.file/$*.mbr') MBROPT(*REPLACE)"
system "CRTCMD CMD($(BIN_LIB)/$*) PGM($(BIN_LIB)/$*) SRCFILE($(BIN_LIB)/QCMDSRC)"
@touch $@
clean:
rm -f *.lib *.pgm *.rpgle *.sqlrpgle *.cmd
release:
@echo " -- Creating release. --"
@echo " -- Creating save file. --"
system "CRTSAVF FILE($(BIN_LIB)/RELEASE)"
system "SAVLIB LIB($(BIN_LIB)) DEV(*SAVF) SAVF($(BIN_LIB)/RELEASE) OMITOBJ((RELEASE *FILE))"
-rm -r release
-mkdir release
system "CPYTOSTMF FROMMBR('/QSYS.lib/$(BIN_LIB).lib/RELEASE.FILE') TOSTMF('./release/release.savf') STMFOPT(*REPLACE) STMFCCSID(1252) CVTDTA(*NONE)"
@echo " -- Cleaning up... --"
system "DLTOBJ OBJ($(BIN_LIB)/RELEASE) OBJTYPE(*FILE)"
@echo " -- Release created! --"
@echo ""
@echo "To install the release, run:"
@echo " > CRTLIB $(BIN_LIB)"
@echo " > CPYFRMSTMF FROMSTMF('./release/release.savf') TOMBR('/QSYS.lib/$(BIN_LIB).lib/RELEASE.FILE') MBROPT(*REPLACE) CVTDTA(*NONE)"
@echo " > RSTLIB SAVLIB($(BIN_LIB)) DEV(*SAVF) SAVF($(BIN_LIB)/RELEASE)"
@echo ""