Changes in / [216597d:c2051e10]


Ignore:
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    r216597d rc2051e10  
    294294FGREP = @FGREP@
    295295GREP = @GREP@
     296HAS_DISTCC = @HAS_DISTCC@
    296297HOST_FLAGS = @HOST_FLAGS@
    297298INSTALL = @INSTALL@
  • benchmark/Makefile.in

    r216597d rc2051e10  
    244244FGREP = @FGREP@
    245245GREP = @GREP@
     246HAS_DISTCC = @HAS_DISTCC@
    246247HOST_FLAGS = @HOST_FLAGS@
    247248INSTALL = @INSTALL@
  • configure

    r216597d rc2051e10  
    663663ac_ct_DUMPBIN
    664664DUMPBIN
    665 LD
    666665FGREP
    667666EGREP
     
    701700LDFLAGS
    702701CXXFLAGS
    703 CXX
    704702CFA_FLAGS
    705703LIBCFA_TARGET_MAKEFILES
     
    723721CFA_INCDIR
    724722CFA_PREFIX
     723HAS_DISTCC
     724LD
     725CXX
     726ENABLE_DISTCC_FALSE
     727ENABLE_DISTCC_TRUE
    725728DOendif
    726729DOifskipcompile
     
    797800enable_silent_rules
    798801with_cfa_name
     802enable_distcc
    799803with_target_hosts
    800804enable_gprofiler
     
    14591463  --enable-silent-rules   less verbose build output (undo: "make V=1")
    14601464  --disable-silent-rules  verbose build output (undo: "make V=0")
     1465  --enable-distcc     whether or not to enable distributed compilation
    14611466  --enable-gprofiler     whether or not to enable gprofiler tools (if available)
    14621467  --enable-demangler     whether or not to build the demangler (executable and library)
     
    31803185
    31813186DOendif='endif'
     3187
     3188
     3189
     3190#==============================================================================
     3191# distcc support
     3192
     3193# Check whether --enable-distcc was given.
     3194if test "${enable_distcc+set}" = set; then :
     3195  enableval=$enable_distcc; enable_distcc=$enableval
     3196else
     3197  enable_distcc=no
     3198fi
     3199
     3200
     3201 if test x$enable_distcc = xyes; then
     3202  ENABLE_DISTCC_TRUE=
     3203  ENABLE_DISTCC_FALSE='#'
     3204else
     3205  ENABLE_DISTCC_TRUE='#'
     3206  ENABLE_DISTCC_FALSE=
     3207fi
     3208
     3209HAS_DISTCC="False"
     3210
     3211if test x$enable_distcc = xyes; then
     3212        CXX="distcc ${CXX}"
     3213        LD="distcc ${LD} -lstdc++"
     3214        HAS_DISTCC="True"
     3215        echo "Enabling distributed builds"
     3216fi
     3217
     3218
    31823219
    31833220
     
    1701717054fi
    1701817055
     17056if test -z "${ENABLE_DISTCC_TRUE}" && test -z "${ENABLE_DISTCC_FALSE}"; then
     17057  as_fn_error $? "conditional \"ENABLE_DISTCC\" was never defined.
     17058Usually this means the macro was only invoked conditionally." "$LINENO" 5
     17059fi
    1701917060if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
    1702017061  as_fn_error $? "conditional \"AMDEP\" was never defined.
  • configure.ac

    r216597d rc2051e10  
    5656AC_SUBST([DOendif])
    5757AM_SUBST_NOTMAKE([DOendif])
     58
     59#==============================================================================
     60# distcc support
     61
     62AC_ARG_ENABLE(distcc,
     63        [  --enable-distcc     whether or not to enable distributed compilation],
     64        enable_distcc=$enableval, enable_distcc=no)
     65
     66AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
     67HAS_DISTCC="False"
     68
     69if test x$enable_distcc = xyes; then
     70        CXX="distcc ${CXX}"
     71        LD="distcc ${LD} -lstdc++"
     72        HAS_DISTCC="True"
     73        echo "Enabling distributed builds"
     74fi
     75
     76AC_SUBST(CXX)
     77AC_SUBST(LD)
     78AC_SUBST(HAS_DISTCC)
    5879
    5980#==============================================================================
  • driver/Makefile.in

    r216597d rc2051e10  
    231231FGREP = @FGREP@
    232232GREP = @GREP@
     233HAS_DISTCC = @HAS_DISTCC@
    233234HOST_FLAGS = @HOST_FLAGS@
    234235INSTALL = @INSTALL@
  • driver/cfa.cc

    r216597d rc2051e10  
    3535//#define __DEBUG_H__
    3636
    37 
    3837static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );               // "N__=" suffix
    3938
    4039void Putenv( char * argv[], string arg ) {
    41         static int flags = 0;                                                           // environment variables must have unique names
     40        // environment variables must have unique names
     41        static int flags = 0;
    4242
    4343        if ( putenv( (char *)( *new string( string( __CFA_FLAGPREFIX__ + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) ) {
     
    4747} // Putenv
    4848
    49 
    50 bool prefix( const string & arg, const string & pre ) { // check if string has prefix
     49// check if string has prefix
     50bool prefix( const string & arg, const string & pre ) {
    5151        return arg.substr( 0, pre.size() ) == pre;
    5252} // prefix
     53
     54inline bool ends_with(const string & str, const string & sfix) {
     55        if (sfix.size() > str.size()) return false;
     56        return std::equal(str.rbegin(), str.rbegin() + sfix.size(), sfix.rbegin(), sfix.rend());
     57}
    5358
    5459bool suffix( const string & arg ) {                                             // check if string has suffix
     
    6873        return (info.st_mode & S_IFDIR) != 0;
    6974} // dirExists
     75
     76static inline string dir(const string & path) {
     77        return path.substr(0, path.find_last_of('/'));
     78}
    7079
    7180
     
    105114        bool m64 = false;                                                                       // -m64 flag
    106115        bool intree = false;                                                            // build in tree
     116        bool compiling_libs = false;
     117        bool disttree = false;
    107118        int o_file = 0;                                                                         // -o filename position
    108119
     
    162173                        } else if ( arg == "-in-tree" ) {
    163174                                intree = true;
     175                        } else if ( arg == "-dist-tree" ) {
     176                                disttree = true;
     177                        } else if ( arg == "-cfalib") {
     178                                compiling_libs = true;
    164179                        } else if ( arg == "-compiler" ) {
    165180                                // use the user specified compiler
     
    293308        } else {
    294309                libbase = TOP_BUILDDIR "libcfa/";
     310        } // if
     311
     312        if( compiling_libs ) {
    295313                Putenv( argv, "-t" );
    296314        } // if
     
    305323        } // if
    306324
    307         string libdir( libbase + arch + "-" + (nolib ? "nolib" : (debug ? "debug": "nodebug")) );
    308         if ( ! dirExists( libdir ) ) {
    309                 cerr << argv[0] << " internal error, cannot find prelude directory " << libdir << endl;
    310                 exit( EXIT_FAILURE );
    311         } // if
    312 
     325        const char * config = nolib ? "nolib" : (debug ? "debug": "nodebug");
     326        string libdir = libbase + arch + "-" + config;
     327
     328        if (!disttree) {
     329                if ( ! nolib && ! dirExists( libdir ) ) {
     330                        cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
     331                        cerr << "Was looking for " << libdir << endl;
     332                        for(int i = 1; i < argc; i++) {
     333                                cerr << argv[i] << " ";
     334                        }
     335                        cerr << endl;
     336                        libdir = libbase + arch + "-" + "nolib";
     337                } // if
     338
     339                if ( ! dirExists( libdir ) ) {
     340                        cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
     341                        cerr << "Was looking for " << libdir << endl;
     342                        exit( EXIT_FAILURE );
     343                } // if
     344        } // if
     345
     346        if(disttree) {
     347                Putenv( argv, "--prelude-dir=" + dir(argv[0])) );
     348        } else if(intree) {
     349                Putenv( argv, "--prelude-dir=" + libdir + "/prelude") );
     350        } else {
     351                Putenv( argv, "--prelude-dir=" + libdir) );
     352        }
     353        nargs += 1;
    313354        for ( int i = 0; i < nlibs; i += 1 ) {                          // copy non-user libraries after all user libraries
    314355                args[nargs++] = libs[i];
     
    371412
    372413        if ( bprefix.length() == 0 ) {
    373                 bprefix = ! intree ? installlibdir : srcdriverdir;
     414                if(disttree) {
     415                        bprefix = dir(argv[0]);
     416                } else if(intree) {
     417                        bprefix = srcdriverdir;
     418                } else {
     419                        bprefix = installlibdir;
     420                }
    374421                if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/';
    375422                Putenv( argv, ( *new string( string("-B=") + bprefix ) ).c_str() );
     
    415462                cerr << " \"" << args[i] << "\"" << endl;
    416463        } // for
     464        cerr << endl;
    417465        #endif // __DEBUG_H__
    418466
    419467        if ( ! quiet ) {
    420468                cerr << "CFA " << "Version " << Version << heading << endl;
    421 
    422469                if ( help ) {
    423470                        cerr <<
  • libcfa/Makefile.in

    r216597d rc2051e10  
    231231CFACC = @CFACC@
    232232CFACPP = @CFACPP@
     233CFADIR_HASH = @CFADIR_HASH@
    233234CFA_BINDIR = @CFA_BINDIR@
    234235CFA_INCDIR = @CFA_INCDIR@
     
    274275LIPO = @LIPO@
    275276LN_S = @LN_S@
     277LOCAL_CFACC = @LOCAL_CFACC@
    276278LTLIBOBJS = @LTLIBOBJS@
    277279LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
     
    293295PACKAGE_VERSION = @PACKAGE_VERSION@
    294296PATH_SEPARATOR = @PATH_SEPARATOR@
     297PRELUDEFLAG = @PRELUDEFLAG@
    295298RANLIB = @RANLIB@
    296299SED = @SED@
  • libcfa/configure

    r216597d rc2051e10  
    707707CONFIG_CFLAGS
    708708ARCH_FLAGS
     709PRELUDEFLAG
     710CFADIR_HASH
     711LOCAL_CFACC
    709712CFACPP
    710713CFACC
     714ENABLE_DISTCC_FALSE
     715ENABLE_DISTCC_TRUE
    711716CFA_VERSION
    712717DRIVER_DIR
     
    783788enable_option_checking
    784789enable_silent_rules
     790enable_distcc
    785791with_cfa_name
    786792enable_shared
     
    14451451  --enable-silent-rules   less verbose build output (undo: "make V=1")
    14461452  --disable-silent-rules  verbose build output (undo: "make V=0")
     1453  --enable-distcc     whether or not to enable distributed compilation
    14471454  --enable-shared[=PKGS]  build shared libraries [default=yes]
    14481455  --enable-static[=PKGS]  build static libraries [default=yes]
     
    29412948
    29422949
    2943 CFACC=${DRIVER_DIR}cfa
     2950# Check whether --enable-distcc was given.
     2951if test "${enable_distcc+set}" = set; then :
     2952  enableval=$enable_distcc; enable_distcc=$enableval
     2953else
     2954  enable_distcc=no
     2955fi
     2956
     2957
     2958echo -n "checking for distributated build... "
     2959if test x$enable_distcc = xno; then
     2960        CFACC=${DRIVER_DIR}cfa
     2961        PRELUDEFLAG='-in-tree'
     2962        echo "no"
     2963else
     2964        tools="$(readlink -m $ac_confdir/)/../tools/build"
     2965        config=$(basename $(readlink -f .))
     2966        echo "$tools/distcc_hash $config"
     2967        CFADIR_HASH=$($tools/distcc_hash $config)
     2968        CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa"
     2969        PRELUDEFLAG='-dist-tree'
     2970        echo "yes (hash=${CFADIR_HASH})"
     2971fi
    29442972CFACPP=${DRIVER_DIR}cfa-cpp
     2973LOCAL_CFACC=${DRIVER_DIR}cfa
     2974
     2975 if test x$enable_distcc = xyes; then
     2976  ENABLE_DISTCC_TRUE=
     2977  ENABLE_DISTCC_FALSE='#'
     2978else
     2979  ENABLE_DISTCC_TRUE='#'
     2980  ENABLE_DISTCC_FALSE=
     2981fi
     2982
     2983
     2984
     2985
     2986
    29452987
    29462988
     
    1698217024fi
    1698317025
     17026if test -z "${ENABLE_DISTCC_TRUE}" && test -z "${ENABLE_DISTCC_FALSE}"; then
     17027  as_fn_error $? "conditional \"ENABLE_DISTCC\" was never defined.
     17028Usually this means the macro was only invoked conditionally." "$LINENO" 5
     17029fi
    1698417030if test -z "${BUILDLIB_TRUE}" && test -z "${BUILDLIB_FALSE}"; then
    1698517031  as_fn_error $? "conditional \"BUILDLIB\" was never defined.
  • libcfa/configure.ac

    r216597d rc2051e10  
    2727AC_ARG_VAR(CFA_VERSION, [The long version of cfa])
    2828
    29 CFACC=${DRIVER_DIR}cfa
     29AC_ARG_ENABLE(distcc,
     30        [  --enable-distcc     whether or not to enable distributed compilation],
     31        enable_distcc=$enableval, enable_distcc=no)
     32
     33echo -n "checking for distributated build... "
     34if test x$enable_distcc = xno; then
     35        CFACC=${DRIVER_DIR}cfa
     36        PRELUDEFLAG='-in-tree'
     37        echo "no"
     38else
     39        tools="$(readlink -m $ac_confdir/)/../tools/build"
     40        config=$(basename $(readlink -f .))
     41        echo "$tools/distcc_hash $config"
     42        CFADIR_HASH=$($tools/distcc_hash $config)
     43        CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa"
     44        PRELUDEFLAG='-dist-tree'
     45        echo "yes (hash=${CFADIR_HASH})"
     46fi
    3047CFACPP=${DRIVER_DIR}cfa-cpp
     48LOCAL_CFACC=${DRIVER_DIR}cfa
     49
     50AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
     51
    3152AC_SUBST(CFACC)
    3253AC_SUBST(CFACPP)
     54AC_SUBST(LOCAL_CFACC)
     55AC_SUBST(CFADIR_HASH)
    3356AC_SUBST(CFA_VERSION)
     57AC_SUBST(PRELUDEFLAG)
    3458
    3559#==============================================================================
  • libcfa/prelude/Makefile.am

    r216597d rc2051e10  
    2323cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c
    2424
    25 CC = @CFACC@
     25CC = @LOCAL_CFACC@
    2626AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    2727AM_CFAFLAGS = @CONFIG_CFAFLAGS@
     
    5454
    5555# create forward declarations for cfa builtins
    56 builtins.cf : builtins.c ${CC}
     56builtins.cf : builtins.c @LOCAL_CFACC@
    5757        ${AM_V_GEN}gcc ${AM_CFLAGS} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po -D__cforall
    5858        ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
     
    6868MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cfa
    6969MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
     70
     71if ENABLE_DISTCC
     72distribution: @LOCAL_CFACC@ @CFACPP@ gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c $(srcdir)/../../tools/build/push2dist.sh
     73        ${AM_V_GEN}$(srcdir)/../../tools/build/push2dist.sh @CFADIR_HASH@
     74        @echo "Dummy file to track distribution to remote hosts" > ${@}
     75
     76all: all-am distribution
     77endif ENABLE_DISTCC
  • libcfa/prelude/Makefile.in

    r216597d rc2051e10  
    167167AUTOMAKE = @AUTOMAKE@
    168168AWK = @AWK@
    169 CC = @CFACC@
     169CC = @LOCAL_CFACC@
    170170CCAS = @CCAS@
    171171CCASDEPMODE = @CCASDEPMODE@
     
    174174CFACC = @CFACC@
    175175CFACPP = @CFACPP@
     176CFADIR_HASH = @CFADIR_HASH@
    176177CFA_BINDIR = @CFA_BINDIR@
    177178CFA_INCDIR = @CFA_INCDIR@
     
    217218LIPO = @LIPO@
    218219LN_S = @LN_S@
     220LOCAL_CFACC = @LOCAL_CFACC@
    219221LTLIBOBJS = @LTLIBOBJS@
    220222LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
     
    236238PACKAGE_VERSION = @PACKAGE_VERSION@
    237239PATH_SEPARATOR = @PATH_SEPARATOR@
     240PRELUDEFLAG = @PRELUDEFLAG@
    238241RANLIB = @RANLIB@
    239242SED = @SED@
     
    555558
    556559# create forward declarations for cfa builtins
    557 builtins.cf : builtins.c ${CC}
     560builtins.cf : builtins.c @LOCAL_CFACC@
    558561        ${AM_V_GEN}gcc ${AM_CFLAGS} -E -P ${<} -o ${@} -MD -MP -MF $(DEPDIR)/builtins.Po -D__cforall
    559562        ${AM_V_at}sed -i 's/builtins.o/builtins.cf/g' $(DEPDIR)/builtins.Po
     
    566569maintainer-clean-local :
    567570        rm -rf $(DEPDIR)
     571
     572@ENABLE_DISTCC_TRUE@distribution: @LOCAL_CFACC@ @CFACPP@ gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c $(srcdir)/../../tools/build/push2dist.sh
     573@ENABLE_DISTCC_TRUE@    ${AM_V_GEN}$(srcdir)/../../tools/build/push2dist.sh @CFADIR_HASH@
     574@ENABLE_DISTCC_TRUE@    @echo "Dummy file to track distribution to remote hosts" > ${@}
     575
     576@ENABLE_DISTCC_TRUE@all: all-am distribution
    568577
    569578# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • libcfa/src/Makefile.am

    r216597d rc2051e10  
    3232# use -no-include-stdhdr to prevent rebuild cycles
    3333# The built sources must not depend on the installed headers
    34 AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
     34AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
    3535AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    3636AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     
    6464# add dependency of cfa files
    6565libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc))))
    66 $(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
     66$(libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
    6767
    6868thread_libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(thread_libsrc))))
    69 $(thread_libobjs) : @CFACC@ @CFACPP@ prelude.cfa
     69$(thread_libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
    7070
    7171
     
    8686
    8787
    88 prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
    89         ${AM_V_GEN}$(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
     88prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
     89        ${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
    9090
    91 prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
     91prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
    9292        ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
    93         $(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
     93        $(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
    9494
    9595
  • libcfa/src/Makefile.in

    r216597d rc2051e10  
    284284CFACC = @CFACC@
    285285CFACPP = @CFACPP@
     286CFADIR_HASH = @CFADIR_HASH@
    286287CFA_BINDIR = @CFA_BINDIR@
    287288CFA_INCDIR = @CFA_INCDIR@
     
    327328LIPO = @LIPO@
    328329LN_S = @LN_S@
     330LOCAL_CFACC = @LOCAL_CFACC@
    329331LTLIBOBJS = @LTLIBOBJS@
    330332LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
     
    346348PACKAGE_VERSION = @PACKAGE_VERSION@
    347349PATH_SEPARATOR = @PATH_SEPARATOR@
     350PRELUDEFLAG = @PRELUDEFLAG@
    348351RANLIB = @RANLIB@
    349352SED = @SED@
     
    441444# use -no-include-stdhdr to prevent rebuild cycles
    442445# The built sources must not depend on the installed headers
    443 AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
     446AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
    444447AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    445448AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     
    937940        $(LTCFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    938941        $(am__mv) $$depbase.Tpo $$depbase.Plo
    939 $(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
    940 $(thread_libobjs) : @CFACC@ @CFACPP@ prelude.cfa
     942$(libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
     943$(thread_libobjs) : @LOCAL_CFACC@ @CFACPP@ prelude.cfa
    941944
    942945-include $(libdeps)
     
    944947-include $(thread_libdeps)
    945948
    946 prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
    947         ${AM_V_GEN}$(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
    948 
    949 prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
     949prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
     950        ${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
     951
     952prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
    950953        ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
    951         $(CFACOMPILE) -quiet -in-tree -XCFA -l ${<} -c -o ${@}
     954        $(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
    952955
    953956#----------------------------------------------------------------------------------------------------------------
  • longrun_tests/Makefile.in

    r216597d rc2051e10  
    378378FGREP = @FGREP@
    379379GREP = @GREP@
     380HAS_DISTCC = @HAS_DISTCC@
    380381HOST_FLAGS = @HOST_FLAGS@
    381382INSTALL = @INSTALL@
  • src/Makefile.in

    r216597d rc2051e10  
    441441FGREP = @FGREP@
    442442GREP = @GREP@
     443HAS_DISTCC = @HAS_DISTCC@
    443444HOST_FLAGS = @HOST_FLAGS@
    444445INSTALL = @INSTALL@
  • tests/Makefile.am

    r216597d rc2051e10  
    3535
    3636# applies to both programs
     37# since automake doesn't have support for CFA we have to
    3738AM_CFLAGS = $(if $(test), 2> $(test), ) \
    3839        -g \
     
    4243        -DIN_DIR="${abs_srcdir}/.in/"
    4344
    44 AM_CFLAGS += ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
    45 CC = @CFACC@
     45CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
     46CFACCBIN = @CFACC@
     47CFACC = $(CC)
    4648
    4749PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
     
    5759#----------------------------------------------------------------------------------------------------------------
    5860all-local :
    59         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
     61        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
    6062
    6163all-tests :
    62         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     64        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    6365
    6466clean-local :
     
    8789
    8890# Use for all tests, make sure the path are correct and all flags are added
    89 CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
     91CFACOMPILETEST=$(PRETTY_PATH) $(CFACOMPILE) -c $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
    9092
    91 # Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
     93# Use for tests that either generate an executable, print directly to stdout or the make command is expected to fail
    9294CFATEST_STDOUT=$(CFACOMPILETEST) -o $(abspath ${@})
    9395
     
    98100
    99101# implicit rule so not all test require a rule
    100 % : %.cfa $(CFACC)
    101         $(CFATEST_STDOUT)
     102% : %.cfa $(CFACCBIN)
     103        $(CFACOMPILETEST) -o $(abspath ${@}).o
     104        $(CFACC) $(abspath ${@}).o -o $(abspath ${@})
     105
    102106
    103107% : %.cpp
     
    123127# CUSTOM TARGET
    124128#------------------------------------------------------------------------------
    125 typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
     129typedefRedef-ERR1: typedefRedef.cfa $(CFACCBIN)
    126130        $(CFATEST_STDOUT) -DERR1
    127131
    128 alloc-ERROR: alloc.cfa $(CFACC)
     132alloc-ERROR: alloc.cfa $(CFACCBIN)
    129133        $(CFATEST_STDOUT) -DERR1
    130134
    131 nested-types-ERR1: nested-types.cfa $(CFACC)
     135nested-types-ERR1: nested-types.cfa $(CFACCBIN)
    132136        $(CFATEST_STDOUT) -DERR1
    133137
    134 nested-types-ERR2: nested-types.cfa $(CFACC)
     138nested-types-ERR2: nested-types.cfa $(CFACCBIN)
    135139        $(CFATEST_STDOUT) -DERR2
    136140
    137 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
     141raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACCBIN)
    138142        $(CFATEST_STDOUT) -DERR1
    139143
    140 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
     144raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACCBIN)
    141145        $(CFATEST_STDOUT) -DERR2
    142146
    143 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
     147raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACCBIN)
    144148        $(CFATEST_STDOUT) -DERR1
    145149
    146 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
     150raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACCBIN)
    147151        $(CFATEST_STDOUT) -DERR1
    148152
    149153#builtins
    150 builtins/sync: builtins/sync.cfa $(CFACC)
     154builtins/sync: builtins/sync.cfa $(CFACCBIN)
    151155        $(CFATEST_STDERR) -fsyntax-only
    152156
    153157# Warnings
    154 warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
     158warnings/self-assignment: warnings/self-assignment.cfa $(CFACCBIN)
    155159        $(CFATEST_STDERR) -fsyntax-only
  • tests/Makefile.in

    r216597d rc2051e10  
    212212AWK = @AWK@
    213213BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
    214 CC = @CFACC@
     214CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
    215215CCAS = @CCAS@
    216216CCASDEPMODE = @CCASDEPMODE@
    217217CCASFLAGS = @CCASFLAGS@
    218218CCDEPMODE = @CCDEPMODE@
    219 CFACC = @CFACC@
     219CFACC = $(CC)
    220220CFACPP = @CFACPP@
    221221CFA_BACKEND_CC = @CFA_BACKEND_CC@
     
    248248FGREP = @FGREP@
    249249GREP = @GREP@
     250HAS_DISTCC = @HAS_DISTCC@
    250251HOST_FLAGS = @HOST_FLAGS@
    251252INSTALL = @INSTALL@
     
    386387
    387388# applies to both programs
    388 AM_CFLAGS = $(if $(test), 2> $(test), ) -g -Wall -Wno-unused-function \
    389         -quiet @CFA_FLAGS@ -DIN_DIR="${abs_srcdir}/.in/" \
    390         ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS}
     389# since automake doesn't have support for CFA we have to
     390AM_CFLAGS = $(if $(test), 2> $(test), ) \
     391        -g \
     392        -Wall \
     393        -Wno-unused-function \
     394        -quiet @CFA_FLAGS@ \
     395        -DIN_DIR="${abs_srcdir}/.in/"
     396
     397CFACCBIN = @CFACC@
    391398PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
    392399avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
     
    397404
    398405# Use for all tests, make sure the path are correct and all flags are added
    399 CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
    400 
    401 # Use for tests that either generate an executable, print directyl to stdout or the make command is expected to fail
     406CFACOMPILETEST = $(PRETTY_PATH) $(CFACOMPILE) -c $(shell realpath --relative-to=${srcdir} ${<}) $($(shell echo "${@}_FLAGS" | sed 's/-\|\//_/g'))
     407
     408# Use for tests that either generate an executable, print directly to stdout or the make command is expected to fail
    402409CFATEST_STDOUT = $(CFACOMPILETEST) -o $(abspath ${@})
    403410
     
    771778#----------------------------------------------------------------------------------------------------------------
    772779all-local :
    773         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
     780        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} ${quick_test}
    774781
    775782all-tests :
    776         @+${TEST_PY} --debug=${debug}  --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
     783        @+${TEST_PY} --debug=${debug} --install=${installed} --archive-errors=${archiveerrors} ${concurrent} ${timeouts} --all # '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    777784
    778785clean-local :
     
    801808
    802809# implicit rule so not all test require a rule
    803 % : %.cfa $(CFACC)
    804         $(CFATEST_STDOUT)
     810% : %.cfa $(CFACCBIN)
     811        $(CFACOMPILETEST) -o $(abspath ${@}).o
     812        $(CFACC) $(abspath ${@}).o -o $(abspath ${@})
    805813
    806814% : %.cpp
     
    810818# CUSTOM TARGET
    811819#------------------------------------------------------------------------------
    812 typedefRedef-ERR1: typedefRedef.cfa $(CFACC)
     820typedefRedef-ERR1: typedefRedef.cfa $(CFACCBIN)
    813821        $(CFATEST_STDOUT) -DERR1
    814822
    815 alloc-ERROR: alloc.cfa $(CFACC)
     823alloc-ERROR: alloc.cfa $(CFACCBIN)
    816824        $(CFATEST_STDOUT) -DERR1
    817825
    818 nested-types-ERR1: nested-types.cfa $(CFACC)
     826nested-types-ERR1: nested-types.cfa $(CFACCBIN)
    819827        $(CFATEST_STDOUT) -DERR1
    820828
    821 nested-types-ERR2: nested-types.cfa $(CFACC)
     829nested-types-ERR2: nested-types.cfa $(CFACCBIN)
    822830        $(CFATEST_STDOUT) -DERR2
    823831
    824 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
     832raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACCBIN)
    825833        $(CFATEST_STDOUT) -DERR1
    826834
    827 raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
     835raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACCBIN)
    828836        $(CFATEST_STDOUT) -DERR2
    829837
    830 raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
     838raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACCBIN)
    831839        $(CFATEST_STDOUT) -DERR1
    832840
    833 raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
     841raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACCBIN)
    834842        $(CFATEST_STDOUT) -DERR1
    835843
    836844#builtins
    837 builtins/sync: builtins/sync.cfa $(CFACC)
     845builtins/sync: builtins/sync.cfa $(CFACCBIN)
    838846        $(CFATEST_STDERR) -fsyntax-only
    839847
    840848# Warnings
    841 warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
     849warnings/self-assignment: warnings/self-assignment.cfa $(CFACCBIN)
    842850        $(CFATEST_STDERR) -fsyntax-only
    843851
  • tests/config.py.in

    r216597d rc2051e10  
    88BUILDDIR = "@abs_builddir@"
    99HOSTARCH = "@host_cpu@"
     10DISTRIBUTE = @HAS_DISTCC@
  • tests/pybin/settings.py

    r216597d rc2051e10  
    1414        SRCDIR = os.path.abspath(config.SRCDIR)
    1515        BUILDDIR = os.path.abspath(config.BUILDDIR)
     16        distribute = config.DISTRIBUTE
    1617        os.chdir(testpath)
    1718
     
    8889                self.string = "debug" if value else "no debug"
    8990                self.flags  = """DEBUG_FLAGS=%s""" % ("-debug -O0" if value else "-nodebug -O2")
     91                self.path   = "debug" if value else "nodebug"
    9092
    9193class Install:
    9294        def __init__(self, value):
     95                if value:
     96                        distribute = False
     97
    9398                self.string = "installed" if value else "in-tree"
    9499                self.flags  = """INSTALL_FLAGS=%s""" % ("" if value else "-in-tree")
     
    109114def init( options ):
    110115        global arch
     116        global archive
     117        global debug
     118        global distcc
    111119        global dry_run
    112120        global generating
     121        global install
    113122        global make
    114         global debug
    115         global install
     123        global output_width
    116124        global timeout
    117         global output_width
    118         global archive
    119125
     126        arch         = Architecture(options.arch)
     127        archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
     128        debug        = Debug(options.debug)
     129        distcc       = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash()
    120130        dry_run      = options.dry_run
    121131        generating   = options.regenerate_expected
     132        install      = Install(options.install)
    122133        make         = ['make']
    123         debug        = Debug(options.debug)
    124         install      = Install(options.install)
    125         arch         = Architecture(options.arch)
     134        output_width = 24
    126135        timeout      = Timeouts(options.timeout, options.global_timeout)
    127         output_width = 24
    128         archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
    129136
     137        # if we distribute, distcc errors will fail tests, use log file for distcc
     138        # don't use "'DISTCC_LOG' not in os.environ" because it can be set to ''
     139        if distribute and not os.environ.get('DISTCC_LOG'):
     140                os.putenv('DISTCC_LOG', os.path.join(BUILDDIR, 'distcc_error.log'))
    130141
    131142def update_make_cmd(force, jobs):
     
    136147def validate():
    137148        errf = os.path.join(BUILDDIR, ".validate.err")
    138         make_ret, out = tools.make( ".validate", error_file = errf, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
     149        make_ret, out = tools.make( ".validate", error_file = errf, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
    139150        if make_ret != 0:
    140151                with open (errf, "r") as myfile:
  • tests/pybin/tools.py

    r216597d rc2051e10  
    2323
    2424# helper functions to run terminal commands
    25 def sh(*cmd, timeout = False, output = None, input = None, error = subprocess.STDOUT):
     25def sh(*cmd, timeout = False, output_file = None, input_file = None, input_text = None, error = subprocess.STDOUT):
    2626        cmd = list(cmd)
     27
     28        if input_file and input_text:
     29                return 401, "Cannot use both text and file inputs"
    2730
    2831        # if this is a dry_run, only print the commands that would be ran
    2932        if settings.dry_run :
    3033                cmd = "{} cmd: {}".format(os.getcwd(), ' '.join(cmd))
    31                 if output and not isinstance(output, int):
     34                if output_file and not isinstance(output_file, int):
    3235                        cmd += " > "
    33                         cmd += output
     36                        cmd += output_file
    3437
    3538                if error and not isinstance(error, int):
     
    3740                        cmd += error
    3841
    39                 if input and not isinstance(input, int) and os.path.isfile(input):
     42                if input_file and not isinstance(input_file, int) and os.path.isfile(input_file):
    4043                        cmd += " < "
    41                         cmd += input
     44                        cmd += input_file
    4245
    4346                print(cmd)
     
    4649        with contextlib.ExitStack() as onexit:
    4750                # add input redirection if needed
    48                 input = openfd(input, 'r', onexit, True)
     51                input_file = openfd(input_file, 'r', onexit, True)
    4952
    5053                # add output redirection if needed
    51                 output = openfd(output, 'w', onexit, False)
     54                output_file = openfd(output_file, 'w', onexit, False)
    5255
    5356                # add error redirection if needed
     
    5861                        proc = subprocess.run(
    5962                                cmd,
    60                                 stdin =input,
    61                                 stdout=output,
    62                                 stderr=error,
    63                                 timeout=settings.timeout.single if timeout else None
     63                                **({'input' : bytes(input_text, encoding='utf-8')} if input_text else {'stdin' : input_file}),
     64                                stdout  = output_file,
     65                                stderr  = error,
     66                                timeout = settings.timeout.single if timeout else None
    6467                        )
     68
    6569                        return proc.returncode, proc.stdout.decode("utf-8") if proc.stdout else None
    6670                except subprocess.TimeoutExpired:
     
    7579                return False
    7680
    77         code, out = sh("file %s" % fname, output=subprocess.PIPE)
     81        code, out = sh("file %s" % fname, output_file=subprocess.PIPE)
    7882        if code != 0:
    7983                return False
     
    107111        if isinstance(files, str ): files = [ files ]
    108112        for file in files:
    109                 sh( 'rm', '-f', file, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
     113                sh( 'rm', '-f', file, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
    110114
    111115# Create 1 or more directory
     
    115119                p = os.path.normpath( file )
    116120                d = os.path.dirname ( p )
    117                 sh( 'mkdir', '-p', d, output=subprocess.DEVNULL, error=subprocess.DEVNULL )
     121                sh( 'mkdir', '-p', d, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
    118122
    119123
     
    138142                lhs,
    139143                rhs,
    140                 output=subprocess.PIPE
     144                output_file=subprocess.PIPE
    141145        )
    142146
    143147# call make
    144 def make(target, *, flags = '', output = None, error = None, error_file = None, silent = False):
     148def make(target, *, flags = '', output_file = None, error = None, error_file = None, silent = False):
    145149        test_param = """test="%s" """ % (error_file) if error_file else None
    146150        cmd = [
     
    151155                settings.debug.flags,
    152156                settings.install.flags,
     157                settings.distcc if settings.distribute else None,
    153158                flags,
    154159                target
    155160        ]
    156161        cmd = [s for s in cmd if s]
    157         return sh(*cmd, output=output, error=error)
     162        return sh(*cmd, output_file=output_file, error=error)
    158163
    159164def which(program):
     
    201206# cat one file into the other
    202207def cat(source, dest):
    203         ret, _ = sh("cat", source, output=dest)
     208        ret, _ = sh("cat", source, output_file=dest)
    204209        return ret
    205210
     
    274279################################################################################
    275280
     281# get hash for given configuration
     282def config_hash():
     283        path = os.path.normpath(os.path.join(
     284                settings.SRCDIR,
     285        ))
     286
     287        distcc_hash = os.path.join(settings.SRCDIR, '../tools/build/distcc_hash')
     288        config = "%s-%s" % (settings.arch.target, settings.debug.path)
     289        _, out = sh(distcc_hash, config, output_file=subprocess.PIPE)
     290        return out.strip()
     291
     292# get pretty string for time of day
    276293def pretty_now():
    277294        ts = time.time()
     
    308325                return 1, "ERR No core dump"
    309326
    310         return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output=subprocess.PIPE)
     327        return sh('gdb', '-n', path, core, '-batch', '-x', cmd, output_file=subprocess.PIPE)
    311328
    312329def core_archive(dst, name, exe):
  • tests/test.py

    r216597d rc2051e10  
    143143        # build, skipping to next test on error
    144144        with Timed() as comp_dur:
    145                 make_ret, _ = make( test.target(), output=subprocess.DEVNULL, error=out_file, error_file = err_file )
     145                make_ret, _ = make( test.target(), output_file=subprocess.DEVNULL, error=out_file, error_file = err_file )
    146146
    147147        run_dur = None
     
    153153                                if settings.dry_run or is_exe(exe_file):
    154154                                        # run test
    155                                         retcode, _ = sh(exe_file, output=out_file, input=in_file, timeout=True)
     155                                        retcode, _ = sh(exe_file, output_file=out_file, input_file=in_file, timeout=True)
    156156                                else :
    157157                                        # simply cat the result into the output
     
    219219def run_tests(tests, jobs) :
    220220        # clean the sandbox from previous commands
    221         make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL)
     221        make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
    222222
    223223        # create the executor for our jobs and handle the signal properly
     
    260260
    261261        # clean the workspace
    262         make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL)
     262        make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
    263263
    264264        return 1 if failed else 0
  • tools/Makefile.in

    r216597d rc2051e10  
    238238FGREP = @FGREP@
    239239GREP = @GREP@
     240HAS_DISTCC = @HAS_DISTCC@
    240241HOST_FLAGS = @HOST_FLAGS@
    241242INSTALL = @INSTALL@
  • tools/prettyprinter/Makefile.in

    r216597d rc2051e10  
    267267FGREP = @FGREP@
    268268GREP = @GREP@
     269HAS_DISTCC = @HAS_DISTCC@
    269270HOST_FLAGS = @HOST_FLAGS@
    270271INSTALL = @INSTALL@
Note: See TracChangeset for help on using the changeset viewer.