package CMT

author arnault@lal.in2p3.fr

tag alpha          OSF1
tag alpha_dux40    alpha
tag alpha-debug    alpha debug

tag LynxOS-VGPW2   LynxOS
tag LynxOS-PowerPC LynxOS
tag RIO806X        LynxOS
tag VMTR2X         LynxOS

tag hp9000s780     HP-UX
tag hp9000s700     HP-UX
tag hp700_ux101    HP-UX
tag hp_ux102       HP-UX

tag Linux-i686     Linux
tag i386_redhat51  Linux
tag i386_linux22   Linux

tag rs_aix42       AIX

tag sun4u          SunOS
tag sun4x_57       SunOS

# Alternate possible tags for VisualC
tag VisualC        WIN32
tag VisualC        Win32
##tag WIN32          VisualC

# Some alternate definitions for debug on VisualC
tag VisualCdbg     WIN32 windebug
tag VisualD        WIN32 windebug
tag VisualDbg      WIN32 windebug
tag VisualDebug    WIN32 windebug
tag VisualD        VisualC windebug
tag VisualDbg      VisualC windebug
tag Win32Debug     VisualC windebug


path_remove  PATH      "CMT"
path_prepend PATH      "${CMTROOT}/${CMTBIN}" \
             VisualC   "%CMTROOT%\%CMTBIN%"

path_remove  CLASSPATH  "CMT"
path_append  CLASSPATH  "${CMTROOT}/java" \
             VisualC   "%CMTROOT%\java"

path_append include    ""
path_append lib        ""

#
#  C environment
#

macro cc              "gcc" \
      insure          "insure" \
      alpha           "cc" \
      alphat          "cc" \
      HP-UX           "aCC" \
      hp700_ux101     "gcc" \
      AIX             "xlc" \
      SunOS           "cc" \
      VisualC         "cl.exe"

macro cdebugflags     "" \
      debug           "-g"

macro cflags          "" \
      LynxOS-VGPW2    "-X" \
      insure          "-std1" \
      HP-UX           "+Z" \
      hp700_ux101     "-fpic -ansi" \
      alpha           "-std1" \
      alphat          "-std1" \
      SunOS           "-KPIC" \
      VisualC         '/nologo /DWIN32 /MD /W3 $(includes) /c'

macro pp_cflags       "" \
      LynxOS-VGPW2    "-DVGPW2" \
      HP-UX           "-D_HPUX_SOURCE" \
      alphat          "-DCTHREADS" \
      AIX             "-D_ALL_SOURCE -D_BSD" \
      Linux           "-Di586"

macro ccomp           "$(cc) -c -I$(inc) $(includes) $(cdebugflags) $(cflags) $(pp_cflags)" \
      VisualC         "cl.exe $(cdebugflags) $(cflags) $(pp_cflags)"

macro clinkflags      ""

macro clink           "$(cc) $(clinkflags)" \
      VisualC         "link.exe /nologo /machine:IX86 "


#
#  Developper Studio environment
#

macro msdevdll          "" \
      VisualC           "/dll"

macro msdevdllflags   "" \
      VisualC         '/MT /D "_USRDLL" /D "WDLL_EXPORTS"' \
      VisualD         '/MTd /D "_USRDLL" /D "WDLL_EXPORTS"'


#
#  C++ environment
#

macro ppcmd           "-I" \
      rs_aix41        "-WF,-I" \
      VisualC         "/I "

macro cpp             "g++" \
      insure          "insure" \
      alpha           "cxx" \
      OSF1            "g++" \
      HP-UX           "aCC" \
      hp700_ux101     "g++" \
      hp_ux102        "aCC" \
      AIX             "xlC" \
      Linux           "c++" \
      SunOS           "CC" \
      VisualC         "cl.exe"

macro cppdebugflags   "" \
      debug           "-g"

macro cppflags        "" \
      alpha           "-nocompress -std arm -msg_quiet" \
      OSF1            "-fpic" \
      hp9000s780      "+Z" \
      hp700_ux101     "-fpic" \
      HP-UX           "+Z -Wc,-ansi_for_scope,on" \
      hp_ux102        "-z +p -Wc,-ansi_for_scope,on +O2 +Onoinitcheck" \
      Linux           "-pipe -ansi -pedantic -W -Wall -Wwrite-strings -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -fnonnull-objects " \
      SunOS           "-KPIC" \
      VisualC         '/nologo /DWIN32 /MD /W3 $(includes) /c'

macro pp_cppflags     "" \
      HP-UX           "-D_HPUX_SOURCE" \
      Linux           "-D_GNU_SOURCE"

macro cppcomp         "$(cpp) -c $(includes) $(cppdebugflags) $(cppflags) $(pp_cppflags)" \
      VisualC         "cl.exe $(cppdebugflags) $(cppflags) $(pp_cppflags)"

macro cpplinkflags    ""

macro cpplink         "$(cpp) $(cpplinkflags)" \
      VisualC         "link.exe /nologo /machine:I386"

macro cpp_linkopts    "" \
      OSF1            " -lstdc++ " \
      alpha           " /usr/lib/cmplrs/cxx/libcxx.a -lcxxstd -lexc -lm " \
      alphat          " /usr/lib/cmplrs/cxx/libcxx.a -lcxxstd -lexc -lm "

#
#  Fortran environment
#

macro for             "f77" \
      HP-UX           "fort77" \
      rs_aix41        "xlf" \
      Linux           "g77"

macro fflags          "-g" \
      VisualC         ""

macro fcomp           "$(for) -c $(fincludes) $(fflags) $(pp_fflags)" \
      VisualC         ""

macro flink           "$(for) $(flinkflags)"

#
#  Java environment
#

macro javacomp        "javac"
macro javacopy        "cp"    VisualC "copy"
macro jar             "jar"

#
#  X11 environment
#

macro X11_cflags      "-I/usr/include" \
      HP-UX           "-I/usr/include/X11R5" \
      SunOS           "-I/usr/motif/usr/include" \
      VisualC         ""

macro Xm_cflags       "-I/usr/include" \
      HP-UX           "-I/usr/include/Motif1.2" \
      SunOS           "-I/usr/motif/usr/include" \
      VisualC         ""

####      hp9000s700      "/usr/lib/Motif1.2/libXm.sl /usr/lib/X11R5/libXt.sl /usr/lib/X11R5/libX11.sl"

macro X_linkopts      ""\
      alpha           "-lXm -lXmu -lXt -lXext -lX11 -ldnet_stub -lm -lots"\
      OSF1            "-lXm -lXmu -lXt -lXext -lX11 -ldnet_stub -lm -lots"\
      insure          "-lXm -lXmu -lXt -lXext -lX11 -ldnet_stub -lm -lots"\
      HP-UX           "-L/usr/lib -lXm -L/usr/contrib/X11R6/lib -lXmu -lXt -lXext -lX11" \
      SunOS           "-L/usr/motif/usr/lib -lXm -lXt -lX11 -lm"\
      LynxOS          "-lXt -lX11 -lm"\
      Linux           "-L/usr/X11R6/lib -lXm -lXt -lXext -lX11 -lm"\
      RIO806X         "-lXm -lXt -lXext -lX11 -lm"\
      VGPW2           "-lXm -lXt -lXext -lX11 -lm"\
      m68k            "-lXm -lXt -lXext -lX11 -lm"\
      IRIX            "/usr/lib/libXm.so /usr/lib/libXt.so /usr/lib/libX11.so -lm -lPW"\
      AIX             "/usr/lib/libXm.a /usr/lib/libXt.a /usr/lib/libX11.a -lm" \
      VisualC         ""

#
# Lex environment
#

macro lexflags        ""
macro lex             "lex $(lexflags)" \
      i686            "flex $(lexflags)"

#
# Yacc environment
#

macro yaccflags       " -l -d " \
      VisualC         ""

macro yacc            "yacc $(yaccflags)"

#
#  Archive environment
#

macro ar              "ar -clr" \
      SunOS           "ar clr" \
      VGPW2           "ar clr" \
      m68k            "ar clr" \
      LynxOS          "ar clr" \
      RIO806X         "ar clr" \
      Linux           "ar r" \
      VisualC         "lib.exe /nologo "

macro ranlib          "ranlib" \
      SunOS           "ar ts" \
      VGPW2           "ar ts" \
      m68k            "ranlib" \
      RIO806X         "ranlib" \
      LynxOS          "ar ts" \
      IRIX            "ar ts"

macro make_shlib    "echo" \
      HP-UX         "${CMTROOT}/mgr/cmt_make_shlib_common.sh extract" \
      OSF1          "${CMTROOT}/mgr/cmt_make_shlib_common.sh noextract" \
      Linux         "${CMTROOT}/mgr/cmt_make_shlib_common.sh extract" \
      SunOS         "${CMTROOT}/mgr/cmt_make_shlib_common.sh extract" \
      VisualC       "%CMTROOT%\mgr\cmt_make_shlib.bat"

macro shlibsuffix   "" \
      HP-UX         "sl" \
      OSF1          "so" \
      SunOS         "so" \
      Linux         "so"

macro shlibbuilder  "" \
      HP-UX         "aCC" \
      OSF1          "ld" \
      SunOS         "CC" \
      Linux         "g++"

macro shlibflags    "" \
      HP-UX         "-Wl,-a,shared -b +Z -q -Wl,+s -Wl,+vallcompatwarnings" \
      OSF1          "-shared -expect_unresolved '*'" \
      Linux         "-shared" \
      SunOS         "-G" \
      VisualC       ""

macro symlink       "/bin/ln -fs " \
      VisualC       ""

macro symunlink     "/bin/rm -f " \
      VisualC       ""

#
# Prototype and dependency generation
#

macro cmtexe             "${CMTROOT}/${CMTBIN}/cmt.exe" \
      VisualC            "%CMTROOT%\%CMTBIN%\cmt.exe" 

macro build_prototype    "$(cmtexe) build prototype"
macro build_dependencies "$(cmtexe) build dependencies"
macro build_triggers     "$(cmtexe) build triggers"

macro implied_library_prefix "-l" \
      VisualC                "$(<PACKAGE>ROOT)/$(bin)/" \
      LynxOS                 "$(<PACKAGE>ROOT)/$(bin)/lib"

macro implied_library_suffix "" \
      VisualC                ".lib" \
      LynxOS                 ".a"

#
# Generic environments
#

macro SHELL           "/bin/sh"

macro src             "../src/"
macro doc             "../doc/"
macro inc             "../src/"
macro mgr             "../mgr/"
##macro javabin         "../classes/"

macro lock_command "chmod -R a-w ../*" \   
      VisualC      "attrib /S /D +R ..\*"

macro unlock_command "chmod -R g+w ../*" \   
      VisualC      "attrib /S /D -R ..\*"

macro preprocessor_command "" \
      try                  "gcc -M" \
      VisualC              ""

#macro_prepend constituents " configclean "

#
# Remote definitions
#

macro gmake_hosts "lx1 rsplus lxtest as7 dxplus ax7 hp2 aleph hp1 hpplus papou1-fe atlas"

macro make_hosts  "virgo-control1 rio0a vmpc38a"

macro everywhere  "hosts" \
      LAL         "as7 lx1 virgo-control1 papou1-fe hp2 aleph hp1" \
      LHCb        "lxtest hpplus dxplus rsplus" \
      Atlas       "lxtest rsplus atlas dxplus" \
      Cascina     "ax7 vmpc38a rio0a"


#
#  Fragments
#

make_fragment make_header
make_fragment library_header
make_fragment application_header
make_fragment document_header
make_fragment java_header
make_fragment jar_header
make_fragment protos_header
make_fragment buildproto
make_fragment library
make_fragment library_no_share
make_fragment application
make_fragment jar
make_fragment java
make_fragment java_copy
make_fragment cleanup_header
make_fragment cleanup
make_fragment cleanup_library
make_fragment cleanup_application
make_fragment cleanup_java
make_fragment cleanup_objects

make_fragment fortran
make_fragment c
make_fragment cpp
make_fragment lex
make_fragment yacc

make_fragment fortran_library
make_fragment c_library
make_fragment cpp_library
make_fragment lex_library
make_fragment yacc_library

make_fragment dsw_header
make_fragment dsw_project
make_fragment dsw_trailer
make_fragment dsw_all_project_header
make_fragment dsw_all_project_dependency
make_fragment dsw_all_project_trailer

make_fragment dsp_library_header
make_fragment dsp_shared_library_header
make_fragment dsp_application_header
make_fragment dsp_windows_header
make_fragment dsp_contents
make_fragment dsp_trailer
make_fragment dsp_all

make_fragment make_setup
make_fragment make_setup_header

make_fragment constituents_header
make_fragment constituent

make_fragment dependencies
make_fragment dependencies_and_triggers

make_fragment readme_header
make_fragment readme
make_fragment readme_doc
make_fragment readme_use
make_fragment readme_trailer

make_fragment tex -suffix=ps

make_fragment check_application
make_fragment check_java
make_fragment check_application_header

macro install_command "cp " \
      VisualC         "copy /Y "

macro uninstall_command "/bin/rm -f " \
      VisualC           "del "

macro mkdir  "mkdir" \
      LynxOS "mkdir -f"

#-----------------------------------------------------------------
# Generic copy facility
#   It is customized through the parameter:
#     install_dir="<path where to install the sources>"
#
make_fragment installer -header=installer_header


#-----------------------------------------------------------------
# Generic usage of the cmt expand model facility
#   the fragment is customized through the following parameters:
#    model="<model text string>"
#    out="<output file name>"
#
make_fragment generator -header=generator_header


#
# The supported languages
#

language fortran -suffix=f -suffix=F -preprocessor_command=$(ppcmd) -linker=$(flink)
language c       -suffix=c -prototypes -linker=$(clink)
language c++     -suffix=C -suffix=cc -suffix=cxx -suffix=cpp -fragment=cpp -linker=$(cpplink)
language java    -suffix=java -linker=java
language yacc    -suffix=y -prototypes -linker=$(clink)
language lex     -suffix=l -prototypes -linker=$(clink)

#
# The cmt constituent
#

application cmt cmt.cxx \
cmt_awk.cxx \
cmt_branch.cxx \
cmt_constituent.cxx \
cmt_deps_builder.cxx \
cmt_fragment.cxx \
cmt_generator.cxx \
cmt_include.cxx \
cmt_parser.cxx \
cmt_script.cxx \
cmt_selector.cxx \
cmt_string.cxx \
cmt_system.cxx \
cmt_tag.cxx \
cmt_use.cxx \
cmt_symbol.cxx \
cmt_error.cxx \
cmt_pattern.cxx \
cmt_language.cxx \
cmt_cvs.cxx \
cmt_group.cxx \
cmt_database.cxx \
cmt_lock.cxx \
cmt_triggers.cxx \
cmt_regexp.cxx \
cmt_model.cxx

private

macro all_constituents cmt

macro_append cpplink "" VisualC " advapi32.lib "


