Re: Makefiles for Oracle Forms

From: Jared Still <jkstill_at_gmail.com>
Date: Fri, 27 Sep 2013 08:36:13 -0700
Message-ID: <CAORjz=MK0ObH8fKOwH+CmqYoH_nAkU9k=HZsuTVNLC8XhSfqiA_at_mail.gmail.com>



On Wed, Sep 11, 2013 at 5:50 PM, Jared Still <jkstill_at_gmail.com> wrote: > If not, it isn't too difficult to build a simple one to start. >

No replies, had to do it myself. :)

Maybe useful for someone else.

Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist Oracle Blog: http://jkstill.blogspot.com Home Page: http://jaredstill.com

Note: do not use spaces for indentation in makefiles - single tab only


include.mk

CQDEBUG?=FALSE
CQPHASE?=DEV
CQUSERNAME?=summit
CQPASSWORD?=summit

# required for batch forms compile

TERM=vt220
ORACLE_TERM=vt220

# the later included default.env will set ORACLE_HOME
FRMS_ORACLE_HOME=/u01/app/oracle/oraas
CURRPATH=${FRMS_ORACLE_HOME}/bin:${FRMS_ORACLE_HOME}/jdk/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:.

include ${FRMS_ORACLE_HOME}/forms/server/default.env

# the default.env file resets PATH(incorrectly) and ORACLE_HOME
PATH := ${CURRPATH}
# currently...
# compiling:
# DEV and OQ: compiled in the same directory
# PRD: a local copy is made of newer source files in a separate
directory for compiling
#
# distribution:
# PRD only: newer compiled files copied to PRD via RSYNC

# connect string set to NOOP unless proper value for CQPHASE - DEV, OQ or
PRD
ifeq (${CQPHASE},DEV)

        CQDB:=oravm
else ifeq (${CQPHASE},OQ)

        CQDB:=192.168.1.4/js01
        # OQ only
        # copy newer source files to PRD dir for compilation
        CQCP_DEST:=/home/oracle/pythian/celora/prdtest
else ifeq (${CQPHASE},PRD)
        CQDB:=192.168.1.4/js01
        # following are used to distribute binary files
        # rsync being used for PRD compiled distribution only
        # IP is lestrade test server
        CQRSH_SERVER:=192.168.1.116
        CQRSH_USERNAME:=oracle
        CQRSH_PATH:=~/celora/summit
        CQPRD_DIR:=/home/oracle/pythian/celora/prdtest
else
        CQDB:=NOOP

endif

CONNECT:=${CQUSERNAME}/${CQPASSWORD}_at_${CQDB}

info:
ifeq (${CQDEBUG},TRUE)

        _at_echo CQPHASE:    ${CQPHASE}
        _at_echo CQUSERNAME: ${CQUSERNAME}
        _at_echo CQPASSWORD: ${CQPASSWORD}
        _at_echo CONNECT:    ${CONNECT}
        _at_echo LD PATH:    ${LD_LIBRARY_PATH}
        _at_echo FORMS  :    ${FMX}
        _at_echo SQLSRCMST:  ${SQLSRCMST}
        _at_echo SQLLOGMST:  ${SQLLOGMST}
        _at_echo SQLSRCOPT:  $(SQLSRCOPT)
        _at_echo SQLLOGOPT:  $(SQLLOGOPT)
endif

makefile

include include.mk

FRMCMP=${ORACLE_HOME}/bin/frmcmp_batch.sh batch=yes userid=${CONNECT} SQLPLUS=${ORACLE_HOME}/bin/sqlplus ${CONNECT}

FRMSRCS = $(wildcard *.fmb)
FMX = $(patsubst %.fmb,%.fmx,$(FRMSRCS))

MMSRCS = $(wildcard *.mmb)
MMX = $(patsubst %.mmb,%.mmx,$(MMSRCS))

LIBSRCS = $(wildcard *.pll)
PLX = $(patsubst %.pll,%.plx,$(LIBSRCS))

SQLSRCMST=$(wildcard sqlmaster.sql)
SQLLOGMST = $(patsubst %.sql,%.log,$(SQLSRCMST))

SQLSRCOPT=$(wildcard sql-option-1.sql sql-option-2.sql) SQLLOGOPT= $(patsubst %.sql,%.log,$(SQLSRCOPT))

compile: info SQLMST LIBS MENUS FORMS SQLOPT

FORMS: info ${FMX}

MENUS: info ${MMX}

LIBS: info ${PLX}

SQLMST: ${SQLLOGMST} SQLOPT: ${SQLLOGOPT}
# '_at_' suppresses showing the command

%.fmx: %.fmb

        _at_echo Module: $@
        ${FRMCMP} module_type=FORM module=$^

%.mmx: %.mmb
        _at_echo Module: $@
        ${FRMCMP} module_type=MENU module=$^

%.plx: %.pll
        _at_echo Module: $@
        ${FRMCMP} module_type=LIBRARY module=$^

%.log: %.sql
        _at_echo SQL-Master
        ${SQLPLUS} _at_$^


.PHONY: clean tar sqltouch cpOQ2PRD

# '-' causes make to ignore errors for action
clean:

  • rm *.fmx *.plx *.mmx sql*.log

tar:

        tar cvfz makedist.tgz cqmake.sh makefile include.mk sqlmaster.sql sql-option*.sql RCS

sqltouch:

        touch sqlmaster.sql sql-option*.sql

# rsync the entire directory to the PRD directory for compilation
# we have no means at this time to build a dependency list of
# what may be in the SQL files.

cpOQ2PRD:
ifdef CQCP_DEST

        $(info CQCP_DEST: ${CQCP_DEST})
        rsync --times --progress *.pll *.?mb *.olb cqmake.sh makefile
include.mk *.sql ${CQCP_DEST}
else
        $(info CQCP_DEST: ${CQCP_DEST})
        $(error CQCP_DEST is not set - please see include.mk)
endif

# copy the newly compiled files to production
# will fail if not in the correct directory CQPRD_DIR - see include.mk
install: compile

        _at_echo CURDIR: ${CURDIR}
        _at_echo CQPRD_DIR: ${CQPRD_DIR}
ifndef CQPRD_DIR
        $(error CQPRD_DIR is not set - please see include.mk)
endif
ifneq (${CURDIR},${CQPRD_DIR})

        $(error this is not the production compile directory - please see include.mk)
endif

        rsync --times --progress *.plx *.?mx ${CQRSH_USERNAME}_at_ ${CQRSH_SERVER}:${CQRSH_PATH}


make.sh

#!/bin/bash

function usage () {

        script=$(basename $0)

printf "

  $script: make for oracle Forms

  -p Phase - valid values: DEV OQ or PRD   -c Copy new source files to PRD dir for compiling

     valid only with '-p PRD'
  -n Dryrun - just show what will happen   -d make debug

     show some variable values in output - default is false

  -u username for database - default is summit
  -w password for database - default is summit
  -t touch SQL files, sqlmaster.sql and sql-option-*.sql
     include this when you want to ensure SQL scripts are re-run
"
}

# explicitly set or unset variables
# as these may have been set at the command line to use make directly
# we do not want environment variables to interfere with getopts

unset CQDB

unset CQRSH_SERVER
unset CQRSH_USERNAME
unset CQRSH_PATH
unset CQPRD_DIR

unset CONNECT
unset CQPHASE
unset CQDEBUG
unset CQUSERNAME
unset CQPASSWORD
unset CQCP_DEST
cqDryRunFlag=''
CQDEBUG='FALSE'
SQLTOUCH='FALSE'
CQCOPYPRD='FALSE'
PRDINSTALL='FALSE'
MAKEACTION='compile' # default target where needed

while getopts p:u:w:ndtci arg
do

        case $arg in
                n) cqDryRunFlag=' -n ';;
                p) CQPHASE=$OPTARG;;
                                         c) CQCOPYPRD='TRUE';;
                d) CQDEBUG='TRUE';;
                i) PRDINSTALL='TRUE'; MAKEACTION='install';;
                t) SQLTOUCH='TRUE';;
                u) CQUSERNAME=$OPTARG;;
                w) CQPASSWORD=$OPTARG;;
                *) echo "invalid argument specified"; usage;exit 1;
        esac

done

export CQPHASE CQDEBUG CQUSERNAME CQPASSWORD PRDINSTALL CQCOPYPRD

case $CQPHASE in

        DEV|OQ|PRD);;
        *) echo "Invalid argument for -p - $CQPHASE";
                exit 2;;

esac

# just copy files to PRD dir

[ "$CQCOPYPRD" == 'TRUE' ] && {

        if [ "$CQPHASE" != 'PRD' ]; then
                make -f makefile cpOQ2PRD $cqDryRunFlag
                ERRCODE=$?
                exit $ERRCODE
        else
                echo "Cannot copy files from PRD to PRD"
                exit 3
        fi

}

[ "$PRDINSTALL" == 'TRUE' ] && {

        if [ "$CQPHASE" == 'PRD' ]; then
                make -f makefile install $cqDryRunFlag
                ERRCODE=$?
                exit $ERRCODE
        else
                echo "use -p PRD to install binaries"
                exit 4
        fi

}

[ -z "$CQUSERNAME" ] && {

        printf "
       Please enter the username: "

        read CQUSERNAME

}

[ -z "$CQPASSWORD" ] && {

        printf "
      Please enter the password: "

        read CQPASSWORD

}

if [ "$CQDEBUG" == 'TRUE' ]; then

printf "

cqDryRunFlag: $cqDryRunFlag
     CQPHASE: $CQPHASE
     CQDEBUG: $CQDEBUG
  CQUSERNAME: $CQUSERNAME
  CQPASSWORD: $CQPASSWORD
    SQLTOUCH: $SQLTOUCH

"
fi

[ "$SQLTOUCH" == 'TRUE' ] && {
        make -f makefile sqltouch $cqDryRunFlag }

make -f makefile ${MAKEACTION} $cqDryRunFlag

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Sep 27 2013 - 17:36:13 CEST

Original text of this message