package Dy

use Cm v8r4
use Fr v8r05  
use Xform v0r9999p2 
use root  v5r14p0
#use root  v5r13

tag OSF1_lib OSF1 VEGA
tag Linux-i686_lib Linux VEGA
tag Linux-i686-rh9_lib Linux VEGA
tag Linux-i686-SL4_lib Linux VEGA
tag Linux-x86_64-SL4_lib Linux VEGA
tag CYGWIN_NT-5.1_lib CYGWIN VEGA

setup_script set_alias

##### The includes
include_dirs $(DYROOT)/src $(DYROOT)/src/mysiesta $(DYROOT)/src/xform \
             $(DYROOT)/src/userfct $(ROOTROOT)/root/include 

##### Not used for now
#macro+ extra_lib_flags "-L$(CMROOT)/$(Cm_tag) -lCm -L$(FRROOT)/$(Fr_tag) -lFrame -L$(ROOTLIBPATH) -lCore -lCint -lHist -lGraf -lGraf3d -lMatrix -lGpad -lPostscript -lGui -lTree -L$(XFORMROOT)/$(Xform_tag) -lforms -L/usr/X11R6/lib -lXpm -lGL -ljpeg  -lopengl32 -lX11 -lm"

private
macro constituents "dyincpath VViewerSelectorDict UserFctDict VDyPlotDict VDyPlot2Dict URZoomSeveralDict Wrapper_checkDict Dy dataDisplay" \
  VEGA "dyincpath VViewerSelectorDict UserFctDict VDyPlotDict VDyPlot2Dict URZoomSeveralDict Wrapper_checkDict DataDisplay"


##### A special compilation macro for the vega version
macro lib_DataDisplay_cppflags "-DUSE_VEGA -DNOCM" \
  OSF1 "-DUSE_VEGA -DNOCM -DOSF1"
macro lib_DataDisplay_cflags " " \
  OSF1  "-pthread -DUSE_VEGA -DNOCM -DOSF1" \
  Linux	"-DUSE_VEGA -DNOCM" \
  CYGWIN  "-DUSE_VEGA -DNOCM"

macro DataDisplaylinkopts " "\
  OSF1  "-lmach -lrt -pthread -shared -Wl,-expect_unresolved,*,-soname,"

macro c_silent ""
macro lib_silent ""
macro link_silent ""


##### The compilation options
# For finding M_PI, we must not be in ANSI mode on Linux
# To remove the "-ansi -pedantic" option

macro_remove cflags "" \
  alpha   "-ansi -pedantic" \
  RIO806X "-ansi -pedantic" \
  Linux   "-ansi -pedantic" \
  CYGWIN  "-ansi -pedantic"

macro cflags "" \
  OSF1 " -DOSF1 " \
#  Linux " -O2 -fPIC " \
  Linux " -g -fPIC " \
  CYGWIN " -O2 "

macro cppflags "" \
  OSF1 " -DOSF1 " \
#  Linux " -O2 -fPIC " \
  Linux " -g -fPIC " \
  CYGWIN " -O2 "


##### The link libraries
#In case ROOT v5r18 is used, lRIO and lTree are mandatory.

macro_prepend RPATH "" OSF1  "$(DYROOT)/$(Dy_tag):"

macro+ Dy_linkopts "-L$(DYROOT)/$(Dy_tag) -lDy -L$(ROOTLIBPATH) -lCore -lCint -lHist -lGraf -lGraf3d -lMatrix -lGpad -lPostscript -lGui -lTree " \
 CYGWIN  "-Wl,--no-whole-archive -L$(ROOTLIBPATH) -lCore -lCint -lHist -lGraf -lGraf3d -lMatrix -lGpad -lPostscript -lGui -lTree \
-Wl,--no-whole-archive -L$(XFORMROOT)/$(Xform_tag) -lforms \
-Wl,--no-whole-archive -L/usr/X11R6/lib -lXpm -lGL -ljpeg -lopengl32 -lX11 -lm "

# For finding the shared libraries
macro+ Dy_linkopts "" \
  OSF1  "-Wl,-rpath,$(RPATH) " \
  Linux "-Wl,-rpath,$(DYROOT)/$(Dy_tag) "


##### The compilation options (we trick them a bit because of C++ style comments)
macro_append cflags    "" \
  OSF1 " -O3 -DOSF1 -arch ev5 -nostdnew "

#####make CYGWIN library
make_fragment cygwin -header=cygwin_header
document cygwin make_cygwin -group=cygwin


##### The default rootcint flag and the specific flag for URZoomSeveralDict
macro rootcint_flags " -p -D__cplusplus " \
  OSF1  " -p -D__cplusplus -DOSF1" \
#  Linux " -p -D__cplusplus -fPIC"
  Linux " -p -g -D__cplusplus -fPIC"

macro URZoomSeveralDict_rootcint_flags "-D__CINT__ " \
  OSF1 "-D__CINT__ -DOSF1"


##### dyincpath building (needed for use of ROOT dynamical loading in User Fct functionality of Dy)
make_fragment DyIncpath -header=DyIncpath_header -trailer=DyIncpath_trailer


###### The rootcint constructions
document rootcint VViewerSelectorDict -s=mysiesta VViewerSelector.h VViewerSelectorCint.h VViewerSelector_LinkDef.h 
document rootcint VDyPlotDict -s=mysiesta VDyPlot.h
document rootcint VDyPlot2Dict -s=mysiesta VDyPlot2.h
document rootcint URZoomSeveralDict -s=mysiesta URZoomSeveral.cc URZoomSeveral_LinkDef.h
document rootcint Wrapper_checkDict Wrapper_fl_check_forms.cc Wrapper_LinkDef.h
document rootcint UserFctDict -s=userfct AddVect.C DivVect.C \
  HighPassFilter.C Integrator.C LowPassFilter.C MultVect.C SubVect.C \
  AddVect.h DivVect.h HighPassFilter.h Integrator.h LowPassFilter.h MultVect.h SubVect.h \
  UserFct_LinkDef.h 


##### A special macro to get around a problem with threads on Linux
macro+ otherSources "" \
  OSF1 "-s=../src jmThread.c"\
  Linux " -s=../src jmThread.c" \
  CYGWIN " -s=../src jmThread.c"

##### dyincpath building last step
document DyIncpath dyincpath configTemplate=../src/dyincpath.in


##### Generate libraries and executable application

public

library Dy LINKMACRO=$(cpplink) -no_prototypes  \
  DyFdShm.c DyFd.c DyUtil.c DyXform.c DyVar.c DyCm.c DyDd.c DyConfig.c DyDump.c DyFiles.c            \
  DyHelp.c DyPlot.c DyVisu.c fselector.c DyXformUser.c DyFrOutput.c          \
  -s=mysiesta UArrayL.c UFrameL.c UJobL.c UMathL.c URPlot.c USignalL.c  \
  URootAccess.cc URootProcess.cc VDyPlot.cc VDyPlot2.cc VViewerSelector.cc VViewerSelectorCint.cc \
  $(otherSources)                                                          \
  -s=../$(Dy_tag) VDyPlotDict.cc VDyPlot2Dict.cc URZoomSeveralDict.cc Wrapper_checkDict.cc \
  VViewerSelectorDict.cc UserFctDict.cc \
  -s=xform cmservers.c dumpdata.c getdd.c getshm.c inputfile.c mainbrowser.c        \
  plot1d.c mainpanel.c plot2d.c plotaudio.c plotgenepar.c plotfft.c        \
  plotffttime.c plot1dtime.c plotrawtime.c plottrfct.c plottime.c userfuncbrowser.c plotraw.c \
  dydebug.c dyoptions.c dyoutput.c reffile.c

# The application

# Comment this under CYGWIN
application dataDisplay LINKMACRO=$(cpplink) -no_prototypes dataDisplay.c 

# Uncomment this under CYGWIN
#application dataDisplay LINKMACRO=$(cpplink) -no_prototypes dataDisplay.c \
#  DyFdShm.c DyFd.c DyUtil.c DyXform.c DyVar.c DyCm.c DyDd.c DyConfig.c DyDump.c DyFiles.c   \
#  DyHelp.c DyPlot.c DyVisu.c fselector.c DyXformUser.c DyFrOutput.c          \
#  -s=mysiesta UArrayL.c UFrameL.c UJobL.c UMathL.c URPlot.c USignalL.c  \
#  URootAccess.cc URootProcess.cc VDyPlot.cc VDyPlot2.cc VViewerSelector.cc VViewerSelectorCint.cc \
#  $(otherSources)                                                          \
#  -s=../$(Dy_tag) VDyPlotDict.cc VDyPlot2Dict.cc URZoomSeveralDict.cc Wrapper_checkDict.cc \
#  VViewerSelectorDict.cc UserFctDict.cc \
#  -s=xform cmservers.c dumpdata.c getdd.c getshm.c inputfile.c mainbrowser.c        \
#  plot1d.c mainpanel.c plot2d.c plotaudio.c plotgenepar.c plotfft.c        \
#  plotffttime.c plot1dtime.c plotrawtime.c plottrfct.c plottime.c userfuncbrowser.c plotraw.c \
#  dydebug.c dyoptions.c dyoutput.c reffile.c

library DataDisplay LINKMACRO=$(cpplink) -no_prototypes dataDisplay.c  \
  DyFdShm.c DyFd.c DyUtil.c DyXform.c DyVar.c DyCm.c DyDd.c DyConfig.c DyDump.c DyFiles.c            \
  DyHelp.c DyPlot.c DyVisu.c fselector.c DyXformUser.c DyFrOutput.c         \
  -s=mysiesta UArrayL.c UFrameL.c UJobL.c UMathL.c URPlot.c USignalL.c  \
  URootAccess.cc URootProcess.cc VDyPlot.cc VDyPlot2.cc VViewerSelector.cc VViewerSelectorCint.cc \
  $(otherSources)                                                          \
  -s=../$(Dy_tag) VDyPlotDict.cc VDyPlot2Dict.cc URZoomSeveralDict.cc Wrapper_checkDict.cc \
  VViewerSelectorDict.cc UserFctDict.cc \
  -s=xform cmservers.c dumpdata.c getdd.c getshm.c inputfile.c mainbrowser.c        \
  plot1d.c mainpanel.c plot2d.c plotaudio.c plotgenepar.c plotfft.c        \
  plotffttime.c plot1dtime.c plotrawtime.c plottrfct.c plottime.c userfuncbrowser.c plotraw.c \
  dydebug.c dyoptions.c dyoutput.c reffile.c

