#************************************************************************
# Common part of makefile for Programs/Libs in C++ with wxWindows 1.61
# see also [.src.x]makefile.vms
#
# by Stefan Hammes
# 10.04.95
# 09.06.95
#************************************************************************

# Directory of wxWindows (cave: it must be specified in THIS form!)
.ifdef WXDIR
# we have no 'ifndef' :-)
.else
ERROR, define WXDIR, e.g.: 'mms/macro=(WXDIR=[hammes.wxw161)'
.endif

#************************************************************************
# Machine Configuration section (different compileroptions for
# different machines can be specified).
#************************************************************************

.ifdef ALPHA
# for ALPHA compilation
MACHOPTS =
MACHDEFS = ALPHA
.else
.ifdef VAX
# for VAX compilation
MACHOPTS =
MACHDEFS = VAX
.else
ERROR, define VAX or ALPHA, e.g.: 'mms/macro=(ALPHA=1)'
.endif
.endif

#************************************************************************
# IMPORTANT: if you want to link in subsidiary libraries,
# required for some optional parts of wxWindows, you must
# set EXTRATARGETS and EXTRAOBJS to match the settings in wx_setup.h.
# Having done this, you won't have to worry about linking them
# into each application.
#
# Here's the full list.
#   prologio: Required if using the wxWindows resource facility
#               USE_WX_RESOURCES should be 1
#   xmgauge:  Gauge class (required for Motif only)
#               USE_GAUGE should be 1
#   xpm:      XPM pixmap support
#               USE_XPM_IN_X should be 1
#   image:    GIF, BMP image reading
#               USE_IMAGE_LOADING_IN_X should be 1
#   wxstring: String class
#               USE_WXSTRING should be 1
#
# Unfortunately, VMS 'lib' doesn't like combining objects and libraries,
# so we must identify all the objects from the subordinate libraries. Yuck!
#
# For VMS we need a comma-separated list for 'lib' without spaces.
#
# IMPORTANT: add to EXTRAINCS the directories, which should be searched
# for include files of subsidiary libraries.
# (cave: definitions and includes must begin with ',')
#************************************************************************

PROLOGSRC=$(WXDIR).utils.prologio.src]
PROLOGOBJS=$(PROLOGSRC)read.obj $(PROLOGSRC)prorpc.obj $(PROLOGSRC)y_tab.obj
PROLOGOBJLIST=$(PROLOGSRC)read.obj,$(PROLOGSRC)prorpc.obj,$(PROLOGSRC)y_tab.obj
PROLOGINCS=$(PROLOGSRC)

IMAGESRC=$(WXDIR).utils.image.src]
IMAGEOBJS=$(IMAGESRC)wx_24to8.obj $(IMAGESRC)wx_gam.obj \
 $(IMAGESRC)wx_gifwr.obj (IMAGESRC)wx_img.obj \
 $(IMAGESRC)wx_pcx.obj $(IMAGESRC)wx_xbm.obj $(IMAGESRC)wx_bmp.obj \
 $(IMAGESRC)wx_gif.obj \
 $(IMAGESRC)wx_image.obj $(IMAGESRC)wx_pbm.obj $(IMAGESRC)wx_pm.obj
IMAGEOBJLIST=$(IMAGESRC)wx_24to8.obj,$(IMAGESRC)wx_gam.obj,\
$(IMAGESRC)wx_gifwr.obj,(IMAGESRC)wx_img.obj,\
$(IMAGESRC)wx_pcx.obj,$(IMAGESRC)wx_xbm.obj,$(IMAGESRC)wx_bmp.obj,\
$(IMAGESRC)wx_gif.obj,$(IMAGESRC)wx_image.obj,$(IMAGESRC)wx_pbm.obj,\
$(IMAGESRC)wx_pm.obj
IMAGEINCS=$(IMAGESRC)

GAUGESRC=$(WXDIR).contrib.xmgauge]
GAUGEOBJS=$(GAUGESRC)gauge.obj
GAUGEOBJLIST=$(GAUGESRC)gauge.obj
GAUGEINCS=$(GAUGESRC)

XPMSRC=$(WXDIR).contrib.wxxpm]
XPMOBJS=$(XPMSRC)crbuffri.obj $(XPMSRC)crbuffrp.obj $(XPMSRC)crdatfri.obj \
  $(XPMSRC)crdatfrp.obj\
  $(XPMSRC)create.obj $(XPMSRC)crifrbuf.obj $(XPMSRC)crifrdat.obj \
  $(XPMSRC)crpfrbuf.obj $(XPMSRC)crpfrdat.obj\
  $(XPMSRC)data.obj $(XPMSRC)hashtab.obj $(XPMSRC)misc.obj \
  $(XPMSRC)parse.obj $(XPMSRC)rdftodat.obj\
  $(XPMSRC)rdftoi.obj $(XPMSRC)rdftop.obj $(XPMSRC)rgb.obj \
  $(XPMSRC)scan.obj $(XPMSRC)simx.obj\
  $(XPMSRC)wrffrdat.obj $(XPMSRC)wrffri.obj $(XPMSRC)wrffrp.obj
XPMOBJLIST=$(XPMSRC)crbuffri.obj,$(XPMSRC)crbuffrp.obj,$(XPMSRC)crdatfri.obj,\
$(XPMSRC)crdatfrp.obj,\
$(XPMSRC)create.obj,$(XPMSRC)crifrbuf.obj,$(XPMSRC)crifrdat.obj,\
$(XPMSRC)crpfrbuf.obj,$(XPMSRC)crpfrdat.obj,\
$(XPMSRC)data.obj,$(XPMSRC)hashtab.obj,$(XPMSRC)misc.obj,\
$(XPMSRC)parse.obj,$(XPMSRC)rdftodat.obj,\
$(XPMSRC)rdftoi.obj,$(XPMSRC)rdftop.obj,$(XPMSRC)rgb.obj,\
$(XPMSRC)scan.obj,$(XPMSRC)simx.obj,\
$(XPMSRC)wrffrdat.obj,$(XPMSRC)wrffri.obj,$(XPMSRC)wrffrp.obj
XPMINCS=$(XPMSOURCE)

WXSTRINGSRC=$(WXDIR).contrib.wxstring]
#+++steve162: changed: wxstring -> wxstrgnu
WXSTRINGOBJS=$(WXSTRINGSRC)wxstrgnu.obj $(WXSTRINGSRC)wxregex.obj
WXSTRINGOBJLIST=$(WXSTRINGSRC)wxstrgnu.obj,$(WXSTRINGSRC)wxregex.obj
#---steve162
WXSTRINGINCS=$(WXSTRINGSRC)

# Full list of subordinate library possibilities
# EXTRATARGETS=prologio xpm image xmgauge wxstring
# EXTRAOBJS= $(PROLOGOBJS) $(XPMOBJS) $(IMAGEOBJS) $(GAUGEOBJS) $(WXSTRINGOBJS)
# EXTRAOBJLIST=$(PROLOGOBJS),$(XPMOBJS),$(IMAGEOBJS),$(GAUGEOBJS),$(WXSTRINGOBJS)
# EXTRAINCS=,$(PROLOGINCS),$(XPMINCS),$(IMAGEINCS),$(GAUGEINCS),$(WXSTRINGINCS)

# *** CHANGE THESE TO YOUR REQUIREMENTS ***
EXTRATARGETS=wxstring
EXTRAOBJS=$(WXSTRINGOBJS)
EXTRAOBJLIST=$(WXSTRINGOBJLIST)
EXTRAINCS=,$(WXSTRINGINCS)

#************************************************************************
# System Configuration section
#************************************************************************

# Common operating system specific options for C++ and wxWindows
SYSOPTS = /nolist /nooptimize /debug
SYSDEFS = ,VMS,__STDC__=1,XTFUNCPROTO,"wx_motif"
SYSINCS = $(WXDIR).include.base],$(WXDIR).include.x]
CXX = cxx
LINK = link
MAKE=make

# wxWindows library
WXLIB = $(WXDIR).lib]wx.olb

# Source and object modules of the application
SRC = cpp
OBJ = obj
SRCSUFF = cpp
OBJSUFF = obj

# Now Construct the flags for the compiler and the linker
OPTS = $(MACHOPTS) $(SYSOPTS) $(APPOPTS)
DEFS = /define=($(MACHDEFS)$(SYSDEFS)$(APPDEFS))
INCS = /include=($(SYSINCS)$(EXTRAINCS)$(APPINCS))

CFLAGS = $(OPTS) $(DEFS) $(INCS)
LINKFLAGS = /trace /nomap /nodebug
OPTSFILE = $(WXDIR).src]motif.opt

#************************************************************************
# Rule section
#************************************************************************

# Process C++ files (with .cpp and .cxx)
.SUFFIXES : .$(SRC)
.$(SRC).$(OBJ) :
	$(CXX) $(CFLAGS) /object=$*.$(OBJ) $*.$(SRC)
    - purge $*.$(OBJ)

.SUFFIXES : .cxx
.cxx.$(OBJ) :
	$(CXX) $(CFLAGS) /object=$*.$(OBJ) $*.cxx
    - purge $*.$(OBJ)

