Skip to content

Commit

Permalink
Merge pull request #2 from edmundreinhardt/ibmimake
Browse files Browse the repository at this point in the history
change to use evfevent as file extension
  • Loading branch information
edmundreinhardt authored Feb 23, 2021
2 parents 724161f + 00a6cb9 commit 2860819
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions IBMiMake
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ $(shell mkdir -p $(LOGPATH))
$(info IBMiMake log directory: $(LOGPATH))
DEPDIR := $(SRCPATH)/.deps
$(shell mkdir -p $(DEPDIR) >/dev/null)
EVTDIR := $(SRCPATH)/.evfevent
$(shell mkdir -p $(EVTDIR) >/dev/null)
CRTFRMSTMFLIB := $(TOOLSLIB)
ICONV := /QOpenSys/usr/bin/iconv
ICONV_EBCDIC := IBM-037
Expand All @@ -251,7 +253,7 @@ define POSTCCOMPILE =
$(ICONV) -f $(ICONV_EBCDIC) -t $(ICONV_ASCII) $(DEPDIR)/$*.Td | tr -d '\r' > $(DEPDIR)/$*.T2d
$(cleanCDeps) <$(DEPDIR)/$*.T2d | sort -u >$(DEPDIR)/$*.d
touch -cr $(OBJPATH)/$@ $(DEPDIR)/$*.d
rm $(DEPDIR)/$*.Td $(DEPDIR)/$*.T2d
rm $(DEPDIR)/$*.T2d
$(removeEmptyDep)
endef

Expand All @@ -266,15 +268,18 @@ cleanRPGDeps = awk '$$1 == "FILEID" && $$6 !~ /^QTEMP/ && toupper($$6) !~ /QSYS/
# if any externally-described files are declared. If so, isolate the actual source file name from its path,
# convert everything to upper case, format in makefile dependency format, and output all these dependencies
# to a file that will be included by Make.
define EVFEVENT_DOWNLOAD =
system "CPYTOSTMF FROMMBR('$(OBJPATH)/EVFEVENT.FILE/$*.MBR') TOSTMF('$(EVTDIR)/$*.evfevent') STMFCCSID(*STDASCII) ENDLINFMT(*LF) CVTDTA(*AUTO) STMFOPT(*REPLACE)" >/dev/null
endef
define POSTRPGCOMPILE =
system "CPYTOSTMF FROMMBR('$(OBJPATH)/EVFEVENT.FILE/$*.MBR') TOSTMF('$(DEPDIR)/$*.Td') STMFCCSID(*STDASCII) ENDLINFMT(*LF) CVTDTA(*AUTO) STMFOPT(*REPLACE)" >/dev/null
{ for f in $$($(cleanRPGDeps) <$(DEPDIR)/$*.Td | sort -u); do \
$(EVFEVENT_DOWNLOAD)
{ for f in $$($(cleanRPGDeps) <$(EVTDIR)/$*.evfevent | sort -u); do \
echo "$${f}"; \
sed -n -r -e '/^.{6}[^*].{14}[^Ff]/ s/^.{5}[Ff]([^ ]{,10}).*(DISK|WORKSTN|PRINTER).*/ \1\.FILE/I p' -e '/^.{6}[^*]/ s/^.{5}[Dd].*EXTNAME\(([^ \)]*).*/ \1\.FILE/I p' "$${f}" | sort -u; \
done; \
} | sed -e 's/^\/.*\///' -e 's/^/$@: /' | tr '[:lower:]' '[:upper:]' >$(DEPDIR)/$*.d
touch -cr $(OBJPATH)/$@ $(DEPDIR)/$*.d
#rm $(DEPDIR)/$*.Td
#rm $(EVTDIR)/$*.evfevent
$(removeEmptyDep)
endef

Expand Down Expand Up @@ -536,7 +541,7 @@ programTGTRLS = $(strip \
@echo "*** Creating RPG module [$*]"
@$(set_STMF_CCSID)
$(eval crtcmd := crtrpgmod module($(OBJLIB)/$*) srcstmf('$<') $(CRTRPGMODFLAGS))
@system -v "$(TOOLSLIB)/EXECWLIBS LIB($(LIBL)) CMD($(crtcmd))" > $(LOGPATH)/$(notdir $<).log
@system -v "$(TOOLSLIB)/EXECWLIBS LIB($(LIBL)) CMD($(crtcmd))" > $(LOGPATH)/$(notdir $<).log || $(EVFEVENT_DOWNLOAD)
@$(POSTRPGCOMPILE)

# Temp: Convert UTF-8 to temporary Windows Latin-1, because SQLC pre-compiler doesn't understand UTF-8
Expand All @@ -553,10 +558,9 @@ programTGTRLS = $(strip \
@echo "*** Creating SQLRPGLE module [$*]"
@$(set_STMF_CCSID)
$(eval crtcmd := crtsqlrpgi obj($(OBJLIB)/$*) srcstmf('$<') $(CRTSQLRPGIFLAGS))
@system -v "$(TOOLSLIB)/EXECWLIBS LIB($(LIBL)) CMD($(crtcmd))" >$(LOGPATH)/$(notdir $<).log 2>&1
@system -v "$(TOOLSLIB)/EXECWLIBS LIB($(LIBL)) CMD($(crtcmd))" >$(LOGPATH)/$(notdir $<).log 2>&1 || $(EVFEVENT_DOWNLOAD)
@$(POSTRPGCOMPILE)


%.PGM: private ACTGRP = $(programACTGRP)
%.PGM: private AUT = $(programAUT)
%.PGM: private DBGVIEW = $(programDBGVIEW)
Expand Down

0 comments on commit 2860819

Please sign in to comment.