Changeset 588 for CMT/HEAD/source/cmt_deps_builder.cxx
- Timestamp:
- Nov 27, 2011, 4:36:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_deps_builder.cxx
r427 r588 11 11 #include "cmt_symbol.h" 12 12 #include "cmt_log.h" 13 #include "cmt_error.h" 13 14 14 15 // … … 92 93 { 93 94 cmt_string stamp_file; 95 log << "|header_file_action> header " << header_file_path << " against stamp " << stamp_file << log_endl; 94 96 if (header_filters[i].use_stamp (header_file_path, stamp_file)) 95 97 { … … 113 115 /////////////////////////////////////////////////////////////////////////////////////////////////////// 114 116 cmt_string text; 115 text.read (header_file_path); 117 if (!text.read (header_file_path)) 118 { 119 CmtError::set (CmtError::file_access_error, header_file_path); 120 return; 121 } 116 122 char* ptr = &text[0]; 117 123 cmt_string new_dir; … … 725 731 { 726 732 cmt_string text; 727 text.read (full_name); 733 if (!text.read (full_name)) 734 { 735 CmtError::set (CmtError::file_access_error, full_name); 736 return -2; 737 } 728 738 char* ptr = &text[0]; 729 739 cmt_string new_dir; … … 746 756 { 747 757 log << "CMT> build_deps3" << log_endl; 758 CmtError::set (CmtError::path_not_found, name); 748 759 } 749 760 return path_index; … … 811 822 812 823 //-------------------------------------------------------------------------- 824 DepsBuilder::DepsBuilder () 825 { } 826 827 //-------------------------------------------------------------------------- 828 DepsBuilder::~DepsBuilder () 829 { 830 clear (); 831 } 832 833 //-------------------------------------------------------------------------- 813 834 void DepsBuilder::clear () 814 835 { … … 820 841 } 821 842 m_header_filters.clear (); 843 m_deps.clear (); 844 m_all_deps.clear (); 822 845 } 823 846 … … 829 852 return; 830 853 } 854 855 cmt_string p = path; 831 856 if (path[path.size () - 1] == CmtSystem::file_separator ()) 832 857 { 833 cmt_string p = path;834 p.erase (path.size () - 1);835 m_include_paths.push_back (p);836 }837 else838 { 839 m_include_paths.push_back (path);840 }841 858 p = path.substr(0, path.size () - 1); 859 } 860 for (int k = m_include_paths.size () - 1; k >= 0; k--) 861 if (m_include_paths[k] == p) 862 { 863 return; 864 } 865 866 m_include_paths.push_back (p); 842 867 m_substitutions.push_back (substitution); 843 868 } … … 919 944 920 945 //-------------------------------------------------------------------------- 921 CmtSystem::cmt_string_vector& DepsBuilder::run (const cmt_string& file_name) 946 CmtSystem::cmt_string_vector& DepsBuilder::run (const cmt_string& file_name, 947 const cmt_string& constituent_name) 922 948 { 923 949 Log; 924 950 925 951 log << "Starting deps builder on " << file_name << log_endl; 952 CmtMessage::info ("calculating dependencies for " + file_name); 926 953 927 954 m_deps.clear (); … … 974 1001 // missing) 975 1002 // 976 preprocessor += " ";977 1003 macro = Symbol::find ("includes"); 978 preprocessor += macro->resolve_macro_value (); 1004 if (0 != macro) 1005 { 1006 preprocessor += " "; 1007 preprocessor += macro->resolve_macro_value (); 1008 } 1009 macro = Symbol::find ("app_" + constituent_name + "_cppflags"); 1010 if (0 != macro) 1011 { 1012 preprocessor += " "; 1013 preprocessor += macro->resolve_macro_value (); 1014 } 1015 macro = Symbol::find ("lib_" + constituent_name + "_cppflags"); 1016 if (0 != macro) 1017 { 1018 preprocessor += " "; 1019 preprocessor += macro->resolve_macro_value (); 1020 } 1021 979 1022 preprocessor += " "; 980 1023 preprocessor += file_name; … … 982 1025 cmt_string output; 983 1026 984 CmtSystem::execute (preprocessor, output); 1027 int status = CmtSystem::execute (preprocessor, output); 1028 if (0 != status) 1029 { 1030 CmtError::set (CmtError::execution_failed, preprocessor, status); 1031 return m_deps; 1032 } 985 1033 986 1034 // … … 1041 1089 1042 1090 //-------------------------------------------------------------------------- 1043 void DepsBuilder::add_header_filter (const Use* use, c onst cmt_regexp* filter, const cmt_string& stamp)1091 void DepsBuilder::add_header_filter (const Use* use, cmt_regexp* filter, const cmt_string& stamp) 1044 1092 { 1045 1093 add_header_filter (HeaderFilter (use, filter, stamp));
Note: See TracChangeset
for help on using the changeset viewer.