forked from worksofliam/IBMiUnit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
89 lines (69 loc) · 3.1 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
TGTLIB=IBMIUNIT
OBJOWN=QPGMR
SYSTEMOPT=-s
DBGVIEW=*SOURCE
TARGET=V7R2M0
TESTFILES:=$(notdir $(shell ls src/test/QRPGLESRC/*.rpgle))
TESTS:= $(patsubst %.rpgle,%.test,$(TESTFILES))
help:
@echo ""
@echo "Build help for IBMiUnit."
@echo ""
@echo "\tgmake all - Build all objects into IBMIUNIT"
@echo "\tgmake tests - Build all tests into IBMIUNIT"
@echo "\tgmake clean - Clear IBMIUNIT library and clean temp files"
@echo ""
@echo "\tgmake all TGTLIB=MYLIB - Build IBMiUNIT into MYLIB library"
@echo "\tgmake all TARGET=V7R2M0 - Specifify target object version."
@echo ""
all: $(TGTLIB).lib IBMIUNIT.srvpgm IBMIUNIT.bnddir RUNTEST.rpglepgm IBMIUIDSP.rpglepgm IBMIUIINT.rpglepgm
@echo "Application built!"
IBMIUNIT.srvpgm: IBMIUNIT.rpglemod ARRAYLIST.rpglemod MESSAGE.rpglemod
MESSAGE.srvpgm: MESSAGE.rpglemod
IBMIUNIT.bnddir: IBMIUNIT.entry MESSAGE.entry
RUNTEST.rpglepgm: RUNTEST.cmd IBMIUNIT.bnddir
## General targets
%.rpglemod: src/main/QRPGLESRC/%.rpgle
system $(SYSTEMOPT) "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1252)"
system $(SYSTEMOPT) "CRTRPGMOD MODULE($(TGTLIB)/$*) SRCSTMF('$<') TGTRLS($(TARGET)) DBGVIEW($(DBGVIEW))"
touch $@
%.srvpgm:
$(eval modules := $(patsubst %,$(TGTLIB)/%,$(basename $(filter %.rpglemod,$(notdir $^)))))
system $(SYSTEM_PARMS) "CRTSRVPGM SRVPGM($(TGTLIB)/$*) MODULE($(modules)) EXPORT(*ALL)"
touch $@
%.pgm:
$(eval modules := $(patsubst %,$(TGTLIB)/%,$(basename $(filter %.rpgle %.sqlrpgle,$(notdir $^)))))
system $(SYSTEMOPT) "CRTPGM PGM($(TGTLIB)/$*) MODULE($(modules)) ENTMOD(*PGM) ACTGRP(*NEW) BNDDIR($(TGTLIB)/IBMIUNIT)"
touch $@
%.rpglepgm: src/main/QRPGLESRC/%.rpgle
system $(SYSTEMOPT) "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1252)"
system $(SYSTEMOPT) "CRTBNDRPG PGM($(TGTLIB)/$*) SRCSTMF('$<') TGTRLS($(TARGET)) DBGVIEW($(DBGVIEW)) BNDDIR($(TGTLIB)/IBMIUNIT) DFTACTGRP(*NO)"
touch $@
%.cmd: src/main/QCMDSRC/%.cmd
-system -q "CRTSRCPF FILE($(TGTLIB)/QCMDSRC) RCDLEN(112)"
system $(SYSTEM_PARMS) "CPYFRMSTMF FROMSTMF('$<') TOMBR('/QSYS.lib/$(TGTLIB).lib/QCMDSRC.file/$*.mbr') MBROPT(*REPLACE)"
system $(SYSTEM_PARMS) "CRTCMD CMD($(TGTLIB)/$*) SRCFILE($(TGTLIB)/QCMDSRC) PGM($(TGTLIB)/$*)"
touch $@
%.bnddir:
-system -q "CRTBNDDIR BNDDIR($(TGTLIB)/$*)"
-system -q "CHGOBJOWN OBJ($(TGTLIB)/$*) OBJTYPE(*BNDDIR) NEWOWN($(OBJOWN)) CUROWNAUT(*SAME)"
-system -q "ADDBNDDIRE BNDDIR($(TGTLIB)/$*) OBJ($(patsubst %.entry,($(TGTLIB)/% *SRVPGM *IMMED),$^))"
@touch $@
%.entry:
# Basically do nothing..
@echo ""
@touch $@
%.lib:
-system $(SYSTEMOPT) "CRTLIB $(TGTLIB)"
system $(SYSTEMOPT) "CHGOBJOWN OBJ(QSYS/$(TGTLIB)) OBJTYPE(*LIB) NEWOWN($(OBJOWN)) CUROWNAUT(*SAME)"
@touch $@
%.test: src/test/QRPGLESRC/%.rpgle
@echo "Building $(TGTLIB)/$*"
system $(SYSTEMOPT) "CHGATR OBJ('$<') ATR(*CCSID) VALUE(1252)"
system $(SYSTEMOPT) "CRTBNDRPG PGM($(TGTLIB)/$*) SRCSTMF('$<') TGTRLS($(TARGET)) DBGVIEW($(DBGVIEW)) BNDDIR($(TGTLIB)/IBMIUNIT) DFTACTGRP(*NO)"
touch $@
tests: $(TESTS)
@echo "Tests built!"
clean:
rm -rf ./*.bnddir ./*.entry ./*.cmd ./*.lib ./*.pgm ./*.srvpgm ./*.rpglemod ./*.test
-system $(SYSTEMOPT) "CLRLIB $(TGTLIB)"