# Makefile for natively compiled PL/SQL sources.
#
# Copyright (c) 1995, 2000 by Oracle Corporation
# NAME
# pnc_makefile.mk
# DESCRIPTION
# This file is used to compile C files generated
# as a result of native compilation of PL/SQL
# programs.
#
#
# MODIFIED (MM/DD/YY)
# mvemulap 04/09/01 - OPTIMIZE=-xO1
# mvemulap 04/05/01 - always make the target
# mvemulap 03/16/01 - fix merge error
# nmantrav 01/03/01 - Use SUNWspro6.1 cc.
# mvemulap 01/12/01 - remove .c file
# kmuthukk 12/06/00 - revert back to unoptimized as default
# kmuthukk 12/04/00 - include path must have $ORACHOME/plsql/public
# kmuthukk 12/04/00 - set optimize to -O2
# kmuthukk 12/04/00 - use ORACLE_HOME instead of SRCHOME
# mvemulap 10/27/00 - no echo
# kmuthukk 04/12/99 - compile optimized
# mvemulap 03/13/99 - creation
# Additional modifications
#
# Vladimir M. Zakharychev on July 17, 2002
# - made the makefile compatible with Microsoft NMake and VC++ 6.0
# see comments on what to change for your particular environment
# (c) 2002 by N-Networks.
# Copy this file into [ORACLE_HOME]\plsql directory.
# Oracle initialization parameters should be as follows ([VCHOME] should
# be replaced with actual VC++ home directory and [ORACLE_HOME] - with
# Oracle home directory):
#
# plsql_native_make_utility='[VCHOME]\bin\nmake.exe'
# plsql_native_make_file_name='[ORACLE_HOME]\plsql\Makefile'
#
# also set plsql_native_library_dir and plsql_native_library_subdir_count as
# per Oracle documentation. You MUST set at least plsql_native_library_dir
# so that Oracle knows where to store the DLLs.
#
# All these being set, you can turn on native compilation by issuing
# alter session set plsql_compiler_flags='NATIVE'
# and all subsequent compilation requests in session will go through the
# makefile and DLLs will be produced until you terminate session or set
# plsql_compiler_flags to 'INTERPRETED'.
# set to your actual Oracle home
ORACLE_HOME=c:\oracle\ora92
I_SYM=-I
PLSQLHOME=$(ORACLE_HOME)\plsql
ORACLELIB=$(ORACLE_HOME)\lib
# PLSQL includes
PLSQLINCLUDE=$(PLSQLHOME)\include
PLSQLINCLUDEH=$(I_SYM)$(PLSQLINCLUDE)
# PLSQL public includes
PLSQLPUBLIC=$(PLSQLHOME)\public
PLSQLPUBLICH=$(I_SYM)$(PLSQLPUBLIC)
# Visual C++ settings
# VCHOME - set to your actual VC++ home and be sure to use DOS names
# (no long names), use DIR /X to see old 8.3 name assigned for a long name
VCHOME=C:\PROGRA~1\MICROS~4\VC98
VCINCLUDE=$(VCHOME)\ATL\INCLUDE;$(VCHOME)\INCLUDE;$(VCHOME)\MFC\INCLUDE
VCINCLUDEH=$(I_SYM)$(VCINCLUDE)
VCLIB=$(VCHOME)\LIB;$(VCHOME)\MFC\LIB
#
# File extensions
#
SO_EXT=dll
OBJ_EXT=obj
SRC_EXT=c
LOG_EXT=nlg
#
# C compiler flags
#
# optimization settings for VC++, change as necessary
# current settings are: optimize for P6 (G6), for Dll (GD), for size (O1),
# enable global optimizations (Og)
OPTIMIZE=-G6 -GD -O1 -Og
#PIC option for gcc
#PIC=-fpic
INCLUDE=$(PLSQLINCLUDEH) $(PLSQLPUBLICH) $(VCINCLUDEH)
PFLAGS=$(INCLUDE)
NOLOGO=/nologo
CFLAGS=$(OPTIMIZE) $(PFLAGS) $(PIC) $(NOLOGO)
# you need Cygwin utilities installed, mv and rm are not available on Windows
# and their del and move counterparts to not support unix-style paths Oracle
# generates.
RM=rm
MV=mv
#
# Specify C Compiler
#
# CC=/usr/local/bin/gcc
CC=$(VCHOME)\bin\cl
#
# Compile Rule
#
COMPILE_C=$(CC) $*.$(SRC_EXT) -c -Fo$*.$(OBJ_EXT) $(CFLAGS)
#
# Specify Linker and Linker flags
#
LD=$(VCHOME)\bin\link
SHARED_CFLAG=-dll
LDFLAGS=-libpath:$(VCLIB) $(NOLOGO)
SO_COMMAND=$(LD) $(LDFLAGS) $(SHARED_CFLAG) $*.$(OBJ_EXT) -out:$@ $(ORACLELIB)\orapls9.lib
# MS Link will produce extra .lib and .exp files when building
# a DLL - we don't need these
VCEXTRAFILES=$*.exp $*.lib
.SILENT:
#
# To create shared libraries
#
.$(SRC_EXT).$(SO_EXT):
$(COMPILE_C) > $*.$(LOG_EXT) 2>&1
-$(MV) -f $@ $@.1
-$(RM) $@.1
$(SO_COMMAND) > $*.$(LOG_EXT) 2>&1
$(RM) -f $*.$(SRC_EXT) $*.$(OBJ_EXT) $*.$(LOG_EXT) $(VCEXTRAFILES)