<commit_before>require 'cxxproject/buildingblocks/building_block'
require 'cxxproject/buildingblocks/has_libraries_mixin'
require 'cxxproject/utils/printer'

module Cxxproject
  class Makefile < BuildingBlock
    include HasLibraries

    def set_target(x)
      @target = x
      self
    end
    
    def set_flags(x)
      @flags = x
      self
    end  
      
    def get_flags(x)
      @flags
    end    
      

    def set_makefile(x)
      @makefile = x
      self
    end

    def set_path_to(array)
      @path_to = array
      self
    end

    def get_makefile
      @makefile
    end

    def get_target
      @target
    end

    def initialize(mfile, mtarget)
      @target = mtarget != "" ? mtarget : "all"
      @makefile = mfile
      @flags = ""
      @path_to = []
      @num = Rake.application.makefile_number  
      super(get_task_name)
    end

    def get_task_name()
      "makefile (#{@num}): " + get_makefile + (get_target ? ("_"+get_target) : "")    
    end

    def calc_pathes_to_projects
      vars = []
      @path_to.each do |p|
        bb = ALL_BUILDING_BLOCKS[p]
        if bb
          pref = File.rel_from_to_project(@project_dir,bb.project_dir)
          rex = Regexp.new "\\.\\.\\/(.*)#{p}"
          var = pref.scan(rex)[0]
          if var
            vars << "PATH_TO_#{p}=#{var[0]}"
          end
        else
          Printer.printWarning "Warning: Project '#{p}' not found for makefile #{@project_dir}/#{@makefile}}"
        end
      end
      vars.join(" ")
    end

    def convert_to_rake()
      pathes_to_projects = calc_pathes_to_projects
    
      mfile = get_makefile()
      make = @tcs[:MAKE]
      cmd = remove_empty_strings_and_join([
        make[:COMMAND], # make
        get_target, # all
        make[:MAKE_FLAGS],<commit_msg>missing makefile path is an error, not a warning<commit_after>require 'cxxproject/buildingblocks/building_block'
require 'cxxproject/buildingblocks/has_libraries_mixin'
require 'cxxproject/utils/printer'

module Cxxproject
  class Makefile < BuildingBlock
    include HasLibraries

    def set_target(x)
      @target = x
      self
    end
    
    def set_flags(x)
      @flags = x
      self
    end  
      
    def get_flags(x)
      @flags
    end    
      

    def set_makefile(x)
      @makefile = x
      self
    end

    def set_path_to(array)
      @path_to = array
      self
    end

    def get_makefile
      @makefile
    end

    def get_target
      @target
    end

    def initialize(mfile, mtarget)
      @target = mtarget != "" ? mtarget : "all"
      @makefile = mfile
      @flags = ""
      @path_to = []
      @num = Rake.application.makefile_number  
      super(get_task_name)
    end

    def get_task_name()
      "makefile (#{@num}): " + get_makefile + (get_target ? ("_"+get_target) : "")    
    end

    def calc_pathes_to_projects
      vars = []
      @path_to.each do |p|
        bb = ALL_BUILDING_BLOCKS[p]
        if bb
          pref = File.rel_from_to_project(@project_dir,bb.project_dir)
          rex = Regexp.new "\\.\\.\\/(.*)#{p}"
          var = pref.scan(rex)[0]
          if var
            vars << "PATH_TO_#{p}=#{var[0]}"
          end
        else
          Printer.printError "Error: Project '#{p}' not found for makefile #{@project_dir}/#{@makefile}"
          ExitHelper.exit(1)
        end
      end
      vars.join(" ")
    end

    def convert_to_rake()
      pathes_to_projects = calc_pathes_to_projects
    
      mfile = get_makefile()
      make = @tcs[:MAKE]
      cmd = remove_empty_strings_and_join([
        make[:COMMAND], # make
        get_target, # all
        make[:MAKE_FLAGS],
{'fraction_non_alphanumeric': 0.10781893004115227, 'fraction_numerical': 0.0013717421124828531, 'mean_word_length': 1.966639544344996, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1202134', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1228, 'n_words': 254}