Changeset 7cd8827 for driver/cfa.cc
- Timestamp:
- Aug 14, 2018, 4:10:58 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 636e1b9
- Parents:
- c3a8ecd (diff), 5a5d31a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
driver/cfa.cc (moved) (moved from src/driver/cfa.cc ) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
driver/cfa.cc
rc3a8ecd r7cd8827 21 21 #include <string.h> // strcmp 22 22 23 #include <sys/types.h> 24 #include <sys/stat.h> 25 23 26 #include "Common/SemanticError.h" 24 27 #include "config.h" // configure info … … 66 69 } // shuffle 67 70 71 static inline bool dirExists(const string & path) { 72 struct stat info; 73 if(stat( path.c_str(), &info ) != 0) 74 return false; 75 else if(info.st_mode & S_IFDIR) 76 return true; 77 else 78 return false; 79 } //dirExists 80 68 81 69 82 #define str(s) #s … … 73 86 string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) ); 74 87 75 string installincdir( CFA_INCDIR ); // fixed location of include files 76 string installlibdir( CFA_LIBDIR ); // fixed location of cc1 and cfa-cpp commands 88 string installincdir( CFA_INCDIR ); // fixed location of include files 89 string installlibdir( CFA_LIBDIR ); // fixed location of cc1 and cfa-cpp commands when installed 90 string srcdriverdir ( TOP_BUILDDIR "driver"); // fixed location of cc1 and cfa-cpp commands when in tree 77 91 78 92 string heading; // banner printed at start of cfa compilation … … 96 110 bool xflag = false; // user supplied -x flag 97 111 bool debugging __attribute(( unused )) = false; // -g flag 112 bool m32 = false; // -m32 flag 113 bool m64 = false; // -m64 flag 114 bool intree = false; 98 115 99 116 const char *args[argc + 100]; // cfa command line values, plus some space for additional flags … … 154 171 } else if ( arg == "-no-include-stdhdr" ) { 155 172 noincstd_flag = true; // strip the no-include-stdhdr flag 173 } else if ( arg == "-in-tree" ) { 174 intree = true; 156 175 } else if ( arg == "-compiler" ) { 157 176 // use the user specified compiler … … 258 277 libs[nlibs] = argv[i]; 259 278 nlibs += 1; 279 } else if ( arg == "-m32" ) { 280 m32 = true; 281 m64 = false; 282 args[nargs] = argv[i]; 283 nargs += 1; 284 } else if ( arg == "-m64" ) { 285 m64 = true; 286 m32 = false; 287 args[nargs] = argv[i]; 288 nargs += 1; 260 289 } else { 261 290 // concatenate any other arguments … … 309 338 310 339 // add the CFA include-library paths, which allow direct access to header files without directory qualification 311 args[nargs] = "-I" CFA_INCDIR; 312 nargs += 1; 313 if ( ! noincstd_flag ) { // do not use during build 314 args[nargs] = "-I" CFA_INCDIR "/stdhdr"; 315 nargs += 1; 316 } // if 317 args[nargs] = "-I" CFA_INCDIR "/concurrency"; 318 nargs += 1; 319 args[nargs] = "-I" CFA_INCDIR "/containers"; 320 nargs += 1; 340 if( !intree ) { 341 args[nargs] = "-I" CFA_INCDIR; 342 nargs += 1; 343 if ( ! noincstd_flag ) { // do not use during build 344 args[nargs] = "-I" CFA_INCDIR "/stdhdr"; 345 nargs += 1; 346 } // if 347 args[nargs] = "-I" CFA_INCDIR "/concurrency"; 348 nargs += 1; 349 args[nargs] = "-I" CFA_INCDIR "/containers"; 350 nargs += 1; 351 } else { 352 args[nargs] = "-I" TOP_SRCDIR "libcfa/src"; 353 nargs += 1; 354 if ( ! noincstd_flag ) { // do not use during build 355 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr"; 356 nargs += 1; 357 } // if 358 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency"; 359 nargs += 1; 360 args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/containers"; 361 nargs += 1; 362 } 321 363 322 364 // add stdbool to get defines for bool/true/false … … 326 368 nargs += 1; 327 369 328 #ifdef HAVE_LIBCFA 370 string libbase; 371 if( !intree ) { 372 libbase = CFA_LIBDIR; 373 } else { 374 libbase = TOP_BUILDDIR "libcfa/"; 375 args[nargs] = "-D__CFA_FLAG__=-t"; 376 nargs += 1; 377 } 378 379 const char * const arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU); 380 const char * config = debug ? "debug": "nodebug"; 381 string libdir = libbase + arch + "-" + config; 382 if( !dirExists(libdir) ) { 383 cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl; 384 cerr << "Was looking for " << libdir << endl; 385 libdir = libbase + arch + "-" + "nolib"; 386 } 387 388 if( !dirExists(libdir) ) { 389 cerr << argv[0] << " internal error, cannot find prelude directory." << endl; 390 cerr << "Was looking for " << libdir << endl; 391 exit( EXIT_FAILURE ); 392 } 393 394 args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str(); 395 nargs += 1; 396 329 397 if ( link ) { 330 #if ! defined(HAVE_LIBCFA_RELEASE)331 if ( ! debug ) {332 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;333 exit( EXIT_FAILURE );334 } // if335 #endif336 #if ! defined(HAVE_LIBCFA_DEBUG)337 if ( debug ) {338 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;339 exit( EXIT_FAILURE );340 } // if341 #endif342 343 398 args[nargs] = "-Xlinker"; 344 399 nargs += 1; … … 359 414 360 415 // include the cfa library in case it's needed 361 args[nargs] = "-L" CFA_LIBDIR; 362 nargs += 1; 363 if ( debug ) { 364 args[nargs] = "-lcfa-d"; 365 } else { 366 args[nargs] = "-lcfa"; 367 } // if 416 args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src" : "")) ).c_str(); 417 nargs += 1; 418 args[nargs] = "-lcfa"; 368 419 nargs += 1; 369 420 args[nargs] = "-lpthread"; … … 374 425 nargs += 1; 375 426 } // if 376 #endif // HAVE_LIBCFA377 427 378 428 // Add exception flags (unconditionally) … … 420 470 421 471 if ( Bprefix.length() == 0 ) { 422 Bprefix = installlibdir;472 Bprefix = !intree ? installlibdir : srcdriverdir; 423 473 args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str(); 424 474 nargs += 1; 425 475 } // if 426 476 427 args[nargs] = "-Xlinker"; // used by backtrace428 nargs += 1;429 args[nargs] = "-export-dynamic";430 nargs += 1;477 args[nargs] = "-Xlinker"; // used by backtrace 478 nargs += 1; 479 args[nargs] = "-export-dynamic"; 480 nargs += 1; 431 481 432 482 // execute the compilation command
Note:
See TracChangeset
for help on using the changeset viewer.