Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove OSSILE dependency and build with make #7

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
build-output/
/*.bnddir
/*.entry
/*.cmd
/*.lib
/*.rpglepgm
/*.srvpgm
/*.rpglemod
/*.test
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
# IBMiUnit
An RPGLE unit testing framework

## Dependencies

[OSSILE](https://github.com/OSSILE/OSSILE)

Download and restore the OSSILE library to your system. That `README.md` has instructions on how to do this.

## Installation

### Clone Git Repository

This is the easiest way to obtain IBMiUnit; everyone has a Git client, right?

Well, this may not *currently* be the easiest way because the source still has a dependency on the [OSSILE](https://github.com/OSSILE/OSSILE) product. This will be removed in a future version of IBMiUnit but for now we assume and require the OSSILE library.

1. Navigate to the directory where you want to place the new `IBMiUnit` folder on the i Series
1. `git clone https://github.com/MarinaSchwenk/IBMiUnit.git`
1. Open QShell in the `IBMiUnit` folder
1. Run the `build` script; there are 6 optional parameters:
- `-l <obj-lib>` (that's a letter "L") install IBMiUnit to the specified library; default is `IBMIUNIT`
- `-s <src-lib>` copy source to the given library; default is to leave the source on the IFS and compile from there
- `-o <obj-owner>` the user profile that will own the new objects; default is `QPGMR`
- `-f` copy the obj-lib back into the repository as a save file; this is only useful to the repository contributors
- `-t` compile the test suite over IBMiUnit
- `-v` verbose output; this may be helpful or necessary when errors are encountered
1. Clone this repository: `git clone git@github.com:MarinaSchwenk/IBMiUnit.git`
2. Change directory into it: `cd IBMiUnit`
3. Use `gmake` (on yum as `make-gnu.ppc64`) to build IBMiUnit.

You can keep up-to-date with IBMiUnit by pulling from the repository and re-building.

Expand Down
89 changes: 89 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,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)"
Loading