-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
126 lines (101 loc) · 5.08 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
include makefile_config
# The shell we use
SHELL=/QOpenSys/usr/bin/qsh
# Makefile for migrate project
include makefile_components
%.lib:
-system -q "CRTLIB $*"
@touch $@
%.pgm:
$(eval modules := $(patsubst %,$(WRK_LIB)/%,$(basename $(filter %.rpgle %.sqlrpgle,$(notdir $^)))))
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
liblist -af $(LIBLIST);\
system "CRTPGM PGM($(BIN_LIB)/$*) MODULE($(modules))"
@touch $@
system "DLTOBJ OBJ($(WRK_LIB)/*ALL) OBJTYPE(*MODULE)"
%.inc: include/%.rpgle
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
cp '$<' $(INC_LIB)
@touch $@
%.rpgle: src/%.rpgle
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
#system "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(SRC_LIB).lib/QRPGLESRC.file/$*.mbr') MBROPT(*REPLACE) STMFCCSID(*STMF) DBFCCSID(*FILE) STMFCODPAG(1208)"
liblist -af $(LIBLIST);\
system "CRTRPGMOD MODULE($(WRK_LIB)/$*) SRCSTMF('$<') DBGVIEW($(DBGVIEW)) TGTCCSID($(CCSID))"
@touch $@
%.sqlrpgle: src/%.sqlrpgle
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
#system "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(SRC_LIB).lib/QRPGLESRC.file/$*.mbr') MBROPT(*REPLACE) STMFCCSID(*STMF) DBFCCSID(*FILE) STMFCODPAG(1208)"
liblist -af $(LIBLIST);\
system "CRTSQLRPGI OBJ($(WRK_LIB)/$*) SRCSTMF('$<') COMMIT(*NONE) OBJTYPE(*MODULE) RPGPPOPT(*LVL2) COMPILEOPT('TGTCCSID($(CCSID))') DBGVIEW($(DBGVIEWSQL))"
@touch $@
%.clle: src/%.clle
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
#system "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(SRC_LIB).lib/QCLSRC.file/$*.mbr') MBROPT(*REPLACE) STMFCCSID(*STMF) DBFCCSID(*FILE) STMFCODPAG(1208)"
liblist -af $(LIBLIST);\
#system "CRTBNDCL PGM($(BIN_LIB)/$*) SRCFILE($(SRC_LIB)/QCLSRC) SRCMBR(*PGM)"
system "CRTBNDCL PGM($(BIN_LIB)/$*) SRCSTMF('$<') SRCMBR(*PGM)"
@touch $@
%.cmd: src/%.cmd
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
system "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(SRC_LIB).lib/QCMDSRC.file/$*.mbr') MBROPT(*REPLACE) STMFCCSID(*STMF) DBFCCSID(*FILE) STMFCODPAG(1208)"
system "CRTCMD CMD($(BIN_LIB)/$*) PGM($(BIN_LIB)/$*) SRCFILE($(SRC_LIB)/QCMDSRC)"
# system "CRTCMD CMD($(BIN_LIB)/$*) PGM($(BIN_LIB)/$*) SRCSTMF('$<')"
system "CHGCMD CMD($(BIN_LIB)/$*) PGM(*LIBL/$*)"
@touch $@
%.srvpgm: src/%.bnd
$(eval modules := $(patsubst %,$(WRK_LIB)/%,$(basename $(filter %.rpgle %.sqlrpgle,$(notdir $^)))))
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
#system "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(SRC_LIB).lib/QSRVSRC.file/$*.mbr') MBROPT(*replace) STMFCCSID(*STMF) DBFCCSID(*FILE) STMFCODPAG(1208)"
#system "CRTSRVPGM SRVPGM($(BIN_LIB)/$*) MODULE($(patsubst %,$(WRK_LIB)/%,$(basename $^))) OPTION(*DUPPROC) SRCFILE($(SRC_LIB)/QSRVSRC)"
liblist -af $(LIBLIST);\
system "CRTSRVPGM SRVPGM($(BIN_LIB)/$*) MODULE($(modules)) OPTION(*DUPPROC) SRCSTMF('$<')"
@touch $@
system "DLTOBJ OBJ($(WRK_LIB)/*ALL) OBJTYPE(*MODULE)"
%.dspf: src/%.dspf
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
system "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(SRC_LIB).lib/QDDSSRC.file/$*.mbr') MBROPT(*replace) STMFCCSID(*STMF) DBFCCSID(*FILE) STMFCODPAG(1208)"
liblist -af $(LIBLIST);\
system "CRTDSPF FILE($(BIN_LIB)/$*) SRCFILE($(SRC_LIB)/QDDSSRC) SRCMBR($*) REPLACE(*YES)"
@touch $@
%.pf:
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
system "CPYFRMSTMF FROMSTMF('./src/$*.pf') TOMBR('/QSYS.lib/$(SRC_LIB).lib/QDDSSRC.file/$*.mbr') MBROPT(*replace) STMFCCSID(*STMF) DBFCCSID(*FILE) STMFCODPAG(1208)"
system "CHGPF FILE($(DB_LIB)/$*) SRCFILE($(SRC_LIB)/QDDSSRC)"
system "CHGPDMDFT USER($(CURRENT_USER)) OBJLIB(*SRCLIB) RPLOBJ(*YES) CRTBCH(*YES) RUNBCH(*YES) JOBD($(JOBD_ADMIN))"
SYSTEM "FNDSTRPDM STRING($*) FILE($(SRC_LIB)/QRPGLESRC) MBR(*ALL) OPTION(*CMPL) PRTMBRLIST(*YES)"
@touch $@
%.sql: sql/%.sql
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
liblist -c $(LIBLIST);\
system "RUNSQLSTM SRCSTMF('$<') COMMIT(*NONE) NAMING(*SYS)"
@touch $@
%.bnddir:
system "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1208)"
-system -q "CRTBNDDIR BNDDIR($(BIN_LIB)/$*)"
-system -q "ADDBNDDIRE BNDDIR($(BND_LIB)/$*) OBJ($(patsubst %.entry,(*LIBL/% *SRVPGM *IMMED),$^))"
@touch $@
%.entry:
# Basically do nothing..
@touch $@
clean:
rm -f *.pgm *.rpgle *.sqlrpgle *.cmd *.srvpgm *.dspf *.bnddir *.entry *.inc *.cmp
-system "CLRLIB $(BIN_LIB)"
-system "CLRLIB $(WRK_LIB)"
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 ""