Changeset 474


Ignore:
Timestamp:
Nov 18, 2008, 12:28:03 PM (16 years ago)
Author:
rybkin
Message:

See C.L. 375

Location:
CMT/HEAD
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r473 r474  
     12008-11-18    <rybkin@lal.in2p3.fr> 375
     2       
     3        * source/cmt_generator.h: Introduce function CmtGenerator::fill_names_outputs
     4        in order to fill the Make LINE macro taking in account the constituent
     5        -k=regexp, -x=regexp options
     6        * source/cmt_generator.cxx: Implement the CmtGenerator::fill_names_outputs
     7        function
     8        * source/cmt_generators.cxx: Make use of the CmtGenerator::fill_names_outputs
     9        function to fill m_LINE. In function DependencyGenerator::build, allow for
     10        the options specification Windows style (/option[:value]) as the Windows
     11        command shell may not pass on -option=value with the = character
     12        * mgr/fragments/dependencies: Restore passing the arguments on to the
     13        $(build_dependencies) command (via $(LINE)) to allow for external tool use
     14        * mgr/fragments/nmake/dependencies: idem, use the -out:file option (rather
     15        than -out=file)
     16        * mgr/cmt_build_deps.sh: Add and implement options -no_stamps (creating
     17        stamps if not specified), -out=<dependencies file>.
     18        Use the same preprocessor flags as those used in fragments c, c_library,
     19        cpp, cpp_library. Treat the files with non-C or non-C++ extensions as C++
     20        files. Allow for the use of macro c_pp to specify the C preprocessor (the
     21        tool used by default is cpp -M)
     22        * mgr/cmt_filter3_version.sh: Minor correction in the description
     23        * mgr/cmt_lsb_system_version.sh: Add script to retrieve the Linux
     24        distribution info on LSB conformant systems in the format <distro>-<version>
     25        * mgr/cmt_filter1_version.sh: Add script to keep the major version only (in
     26        tags)
     27       
    1282008-11-02    <rybkin@lal.in2p3.fr> 374
    229       
  • CMT/HEAD/mgr/cmt_build_deps.sh

    r79 r474  
    33#
    44# This shell script emulates the behaviour of the 'cmt buid dependencies' operation
    5 # but using cpp -M instead
     5# but using the tool specified by the $(c_pp) macro (or cpp -M) instead
    66#
    77#===============================================================
     
    1616  #  ends with a dependency to the stamp file
    1717
    18   a=`eval cpp -M ${allflags} ${file} | \
     18if [ -z "$c_pp" ]; then
     19    c_pp="cpp -M"
     20fi
     21
     22  a=`eval ${c_pp} ${allflags} ${file} | \
    1923    sed -e 's#[.]o:#_'"${suffix}"'_dependencies = #' -e 's#[\\]$##'`
    2024
    2125  if test ! `echo ${a} | wc -w` = "0"; then
    22     echo -n ${a}
     26    line="`echo ${a}`"
    2327  else
    24     echo -n "${file_name}_${suffix}_dependencies = ${file}"
     28    line="${file_name}_${suffix}_dependencies = ${file}"
    2529  fi
    2630
    27   echo " \$(bin)${constituent}_deps/${file_name}_${suffix}.stamp"
     31if [ "$no_stamps" != yes ]; then
     32    stamp_output_base=${constituent}_deps/${file_name}_${suffix}.stamp
     33    stamp_output=${bin}${stamp_output_base}
     34    line="${line} \$(bin)${stamp_output_base}"
    2835
    2936  # create or update the stamp file
    30 
    31   touch ${bin}/${constituent}_deps/${file_name}_${suffix}.stamp
     37    if [ -f "${stamp_output}" ]; then
     38        read old_stamp <${stamp_output}
     39        if [ "${line}" != "${old_stamp}" ]; then
     40            /bin/rm -f ${stamp_output}
     41            printf "${line}\n" >${stamp_output}
     42        fi
     43    else
     44        printf "${line}\n" >${stamp_output}
     45    fi
     46
     47  #touch ${bin}/${constituent}_deps/${file_name}_${suffix}.stamp
     48fi
     49printf "${line}\n"
    3250}
    3351
     
    3755  name=$1
    3856  shift
    39 
    40   grep "^${name}=" ${tempmacros} | sed -e "s#^${name}=##"
     57  sed -n '/^'${name}'=/{s#^'${name}'=##p;q}' ${tempmacros}
     58#  grep "^${name}=" ${tempmacros} | sed -e "s#^${name}=##"
    4159}
    4260
     
    6078#  Expected arguments:
    6179#    1    : <constituent name>
    62 #    2    : -all_sources
     80#    2    : [ options: -all_sources | -no_stamps | -out=<dependencies file> ]
    6381#    3... : <source file list>
    6482#
    6583#------------------------------------------------------------------------------------------
    6684
     85[ $# -gt 0 ] || exit
    6786constituent=$1
    6887shift
    6988
    70 all_sources=$1
    71 shift
    72 
    73 files=$*
     89n=0
     90for f; do
     91    case ${f} in
     92        -all_sources) all_sources=yes; n=`expr $n + 1` ;;
     93        -no_stamps) no_stamps=yes; n=`expr $n + 1` ;;
     94        -out=*) output=`expr "$f" : '-out=\(.*\)'`; n=`expr $n + 1` ;;
     95        *) break ;;
     96    esac
     97done
     98shift $n
    7499
    75100#---------------
     
    77102#
    78103tempprefix=/tmp/CMT$$
    79 if test ! "${TMP}" = ""; then
    80   tempprefix=${TMP}/CMT$$
     104if test ! "${TMPDIR}" = ""; then
     105  tempprefix=${TMPDIR}/CMT$$
    81106fi
    82107
     
    96121prepare_context
    97122
     123type=`cmt show constituent ${constituent} | cut -d' ' -f1`
     124case "${type}" in
     125    application) type=app ;;
     126    library) type=lib ;;
     127    document) type=doc ;;
     128esac
     129
    98130incl=`macro_value includes`
    99131
    100132cflags=`macro_value cflags`
     133pp_cflags=`macro_value pp_cflags`
     134use_pp_cflags=`macro_value use_pp_cflags`
     135const_pp_cflags=`macro_value ${constituent}_pp_cflags`
     136type_pp_cflags=`macro_value ${type}_${constituent}_pp_cflags`
     137use_cflags=`macro_value use_cflags`
    101138const_cflags=`macro_value ${constituent}_cflags`
    102 const_pp_cflags=`macro_value ${constituent}_pp_cflags`
     139type_const_cflags=`macro_value ${type}_${constituent}_cflags`
    103140
    104141cppflags=`macro_value cppflags`
     142pp_cppflags=`macro_value pp_cppflags`
     143use_pp_cppflags=`macro_value use_pp_cppflags`
     144const_pp_cppflags=`macro_value ${constituent}_pp_cppflags`
     145type_pp_cppflags=`macro_value ${type}_${constituent}_pp_cppflags`
     146use_cppflags=`macro_value use_cppflags`
    105147const_cppflags=`macro_value ${constituent}_cppflags`
    106 const_pp_cppflags=`macro_value ${constituent}_pp_cppflags`
    107 
    108 bin=`macro_value bin`
     148type_const_cppflags=`macro_value ${type}_${constituent}_cppflags`
     149
     150c_pp=`macro_value c_pp`
     151
     152if [ "$output" ]; then
     153    bin=`dirname $output`/
     154elif [ -z "$bin" ]; then
     155    bin=`macro_value bin`
     156fi
    109157#--------------
    110158
     
    112160# Prepare the directory for the stamp files
    113161#
     162if [ "$no_stamps" != yes ]; then
    114163mkdir -p ${bin}/${constituent}_deps
     164fi
    115165#--------------
    116166
     
    118168# Prepare the dependency file
    119169#
     170if [ -z "$output" ]; then
    120171output=${bin}${constituent}_dependencies.make
     172fi
    121173#--------------
    122174
     
    124176# Loop over source files (if any)
    125177#
    126 for f in `echo ${files}`; do
     178for f; do
    127179  suffix=`echo ${f} | sed -e 's#.*[.]##'`
    128180  file_name=`basename ${f} .${suffix}`
     
    130182  # First remove the old dependency line from the output
    131183
     184if [ "$all_sources" != yes ]; then
    132185  if test -f ${output}; then
    133     grep -v "${file_name}_${suffix}_dependencies" ${output} >t$$; mv t$$ ${output}
     186    grep -v "${file_name}_${suffix}_dependencies" ${output} >${tempprefix}/t$$
     187    mv ${tempprefix}/t$$ ${output}
    134188  fi
    135 
    136   echo "computing dependencies for ${file_name}.${suffix}"
     189fi
     190#  echo "computing dependencies for ${file_name}.${suffix}"
    137191
    138192  case ${suffix} in
    139     c ) allflags="${incl} ${cflags} ${const_cflags} ${const_cpp_cflags}";;
    140     C|cc|cxx|cpp ) allflags="${incl} ${cppflags} ${const_cppflags} ${const_cpp_cppflags}";;
     193    c ) allflags="${incl} ${cflags} ${pp_cflags} ${use_pp_cflags} ${const_pp_cflags} ${type_pp_cflags} ${use_cflags} ${const_cflags} ${type_const_cflags}" ;;
     194    C|cc|cxx|cpp ) allflags="${incl} ${cppflags} ${pp_cppflags} ${use_pp_cppflags} ${const_pp_cppflags} ${type_pp_cppflags} ${use_cppflags} ${const_cppflags} ${type_const_cppflags}" ;;
     195    * ) allflags="-x c++ ${incl} ${cppflags} ${pp_cppflags} ${use_pp_cppflags} ${const_pp_cppflags} ${type_pp_cppflags} ${use_cppflags} ${const_cppflags} ${type_const_cppflags}" ;;
     196#    c ) allflags="${incl} ${cflags} ${const_cflags} ${const_cpp_cflags}";;
     197#    C|cc|cxx|cpp ) allflags="${incl} ${cppflags} ${const_cppflags} ${const_cpp_cppflags}";;
    141198  esac
    142 
    143   echo "cpp -M ${allflags} ${f}"
    144199
    145200  compute_dependencies ${f} >>${output}
    146201done
    147202#--------------
    148 
    149 
    150 
  • CMT/HEAD/mgr/cmt_filter3_version.sh

    r465 r474  
    1212#    <some letters><field1><field2><field3>
    1313#
    14 #   o only the first two numeric fields are kept
     14#   o only the first three numeric fields are kept
    1515#   o separators ('-' or '.') are all filtered out
    1616#
  • CMT/HEAD/mgr/fragments/dependencies

    r469 r474  
    77$(bin)${CONSTITUENT}_dependencies.make : ${LINE} $(use_requirements) $(cmt_final_setup_${CONSTITUENT})
    88        $(echo) "(${CONSTITUENT}.make) Rebuilding $@"; \
    9           $(build_dependencies) ${CONSTITUENT} -all_sources -out=$@
     9          $(build_dependencies) ${CONSTITUENT} -all_sources -out=$@ ${LINE}
    1010endif
    1111
  • CMT/HEAD/mgr/fragments/nmake/dependencies

    r472 r474  
    44
    55!if exist ("$(CMTROOT)/$(CMTBIN)/cmt.exe")
    6 !if [$(build_dependencies) ${CONSTITUENT} -all_sources -out=$(bin)${CONSTITUENT}_dependencies.nmake] == 0
     6!if [$(build_dependencies) ${CONSTITUENT} -all_sources -out:$(bin)${CONSTITUENT}_dependencies.nmake ${LINE}] == 0
    77!endif
    88!else
  • CMT/HEAD/source/cmt_generator.cxx

    r467 r474  
    316316
    317317//--------------------------------------------------
     318void CmtGenerator::fill_names_outputs ()
     319{
     320  bool first = true;
     321
     322  m_LINE = "";
     323  m_OBJS = "";
     324
     325  for (int i = 0; i < m_source_files.size (); i++)
     326    {
     327      const SourceFile& file = m_source_files[i];
     328      const cmt_string name = file.name ();
     329      const cmt_string output = file.output ();
     330
     331      if (output != "")
     332        {
     333          if (first)
     334            {
     335              first = false;
     336            }
     337          else
     338            {
     339              m_LINE += " ";
     340              m_OBJS += " ";
     341            }
     342          m_LINE += name;
     343          m_OBJS += output;
     344        }
     345
     346      if (Cmt::get_debug ())
     347        {
     348          cout << "CmtGenerator::fill_names_ outputs>" << endl;
     349          cout << "name=" << name << " LINE=" << m_LINE << endl;
     350          cout << "output=" << output << " OBJS=" << m_OBJS << endl;
     351        }
     352    }
     353}
     354
     355//--------------------------------------------------
    318356void CmtGenerator::fill_outputs ()
    319357{
  • CMT/HEAD/source/cmt_generator.h

    r466 r474  
    5656  void terminate ();
    5757
     58  void fill_names_outputs ();
    5859  void fill_outputs ();
    5960
  • CMT/HEAD/source/cmt_generators.cxx

    r469 r474  
    351351  filter_path (m_FILEPATH.value);
    352352
     353  /*
    353354  m_LINE = m_FULLNAME.value;
    354355  m_LINE += " ";
     356  */
    355357
    356358  filter_path (m_FULLNAME.value);
    357   filter_path (m_LINE.value);
     359  //  filter_path (m_LINE.value);
    358360
    359361  CmtSystem::get_suffix (name, m_FILESUFFIX.value);
     
    394396  if (m_PACKOS9)
    395397    {
    396       os9sources += m_LINE;
     398      //      os9sources += m_LINE;
     399      os9sources += m_FULLNAME.value;
    397400      os9sources += " ";
    398401    }
     
    464467  const cmt_vector<cmt_regexp>& selects = constituent.select_exprs;
    465468
    466   m_LINE = "";
     469  //  m_LINE = "";
    467470
    468471  for (i = 0; i < sources.size (); i++)
     
    496499        }
    497500
     501      /*
    498502      if (count > 0)
    499503        {
     
    501505          m_LINE += " ";
    502506        }
    503     }
    504 
    505   fill_outputs ();
     507      */
     508    }
     509
     510  fill_names_outputs ();
     511  //fill_outputs ();
    506512
    507513  prepare_use_context ();
     
    942948  const cmt_vector<cmt_regexp>& selects = constituent.select_exprs;
    943949
    944   m_LINE = "";
     950  //  m_LINE = "";
    945951
    946952  for (i = 0; i < sources.size (); i++)
     
    960966      filter_path (full_name);
    961967
     968      /*
    962969      if (count > 0)
    963970        {
     
    965972          m_LINE += " ";
    966973        }
     974      */
    967975
    968976      for (int j = 0; j < files.size (); j++)
     
    977985    }
    978986
    979   fill_outputs ();
     987  fill_names_outputs ();
     988  //  fill_outputs ();
    980989
    981990  prepare_use_context ();
     
    27432752      // Get rid of files that may come from the makefile fragment
    27442753      if (file_name.find ("requirements") != cmt_string::npos) source_number--;
    2745       else if (file_name.substr (0, 5) == "-out=")
    2746         {
    2747           if (!all_sources) source_number--;
     2754      else if (file_name.substr (0, 5) == "-out=" ||
     2755               file_name.substr (0, 5) == "-out:" ||
     2756               file_name.substr (0, 5) == "/out:" ||
     2757               file_name.substr (0, 5) == "/out=")
     2758        {
     2759          source_number--;
    27482760          file_name.erase (0, 5);
    27492761          m_output_file_name = file_name;
    27502762        }
    27512763      else if (file_name.find (".make") != cmt_string::npos) source_number--;
    2752       else if (file_name == "-all_sources")
     2764      else if (file_name == "-all_sources" ||
     2765               file_name == "/all_sources")
    27532766        {
    27542767          source_number = sources.size ();
    27552768          all_sources = true;
    27562769        }
    2757       else if (file_name == "-no_stamps")
    2758         {
    2759           if (!all_sources) source_number--;
     2770      else if (file_name == "-no_stamps" ||
     2771               file_name == "/no_stamps")
     2772        {
     2773          source_number--;
    27602774          m_stamps = false;
    27612775        }
Note: See TracChangeset for help on using the changeset viewer.