class RBT::GenerateMakefile
Constants
- NAME_OF_MAKEFILE
#¶ ↑
NAME_OF_MAKEFILE
¶ ↑#¶ ↑
- NAME_OF_THE_FILE_HERE
#¶ ↑
NAME_OF_THE_FILE_HERE
¶ ↑#¶ ↑
- WHICH_SHELL_TO_USE
#¶ ↑
WHICH_SHELL_TO_USE
¶ ↑#¶ ↑
Attributes
base_dir[W]
Public Class Methods
Public Instance Methods
add_comment()
click to toggle source
add_header()
click to toggle source
add_newline()
click to toggle source
add_tabs()
click to toggle source
array_available_C_files?()
click to toggle source
#¶ ↑
array_available_C_files?¶ ↑
#¶ ↑
# File lib/rbt/generate_files/generate_makefile.rb, line 110 def array_available_C_files? @array_available_C_files end
Also aliased as: all_c_files?
consider_generating_a_new_makefile()
click to toggle source
#¶ ↑
consider_generating_a_new_makefile
¶ ↑
#¶ ↑
# File lib/rbt/generate_files/generate_makefile.rb, line 277 def consider_generating_a_new_makefile target = 'Makefile' if File.exist?(target) and !@may_we_overwrite_existing_makefiles opne 'A file '+sfile(target)+rev+' already exists. We may '\ 'not generate the same-named file.' end save_to(target) end
could_we_find_a_C_file?()
click to toggle source
create_makefile_variable(this_variable)
click to toggle source
create_rule( name_of_rule, action, extended_instruction_set = '' )
click to toggle source
#¶ ↑
create_rule
¶ ↑
Use this to create a specific rule.
#¶ ↑
# File lib/rbt/generate_files/generate_makefile.rb, line 156 def create_rule( name_of_rule, action, extended_instruction_set = '' ) extended_instruction_set = ' '+extended_instruction_set unless extended_instruction_set.empty? @_ << N # right now, we always add a newline @_ << name_of_rule+':'+extended_instruction_set+N @_ << TABULATOR+action+N # rm *.o temp end
data?()
click to toggle source
fill_up_string()
click to toggle source
#¶ ↑
fill_up_string
¶ ↑
#¶ ↑
# File lib/rbt/generate_files/generate_makefile.rb, line 194 def fill_up_string @_ << '# =========================================================================== # # MACRO LISTING # =========================================================================== # SHELL='+WHICH_SHELL_TO_USE+' # =========================================================================== # # === CFLAGS TO USE # =========================================================================== # CFLAGS = # -O -systype bsd43 # =========================================================================== # # === COMPILER TO USE # # This variable can be used to keep track as to which compiler has to be # used. # =========================================================================== # CC=gcc CCOPTS=-Wall # =========================================================================== # # === TARGET # =========================================================================== # # foobar.dvi: $(SRCS) # $(DITROFF) $(MACROS) $(SRCS) >paper.dvi dummy: '+all_c_files?.join(' ')+' $(CC) $(CCOPTS) -o dummy '+all_c_files?.join(' ')+' prefix = '+prefix?+' exec_prefix = ${prefix} ' end
input(i)
click to toggle source
prefix?()
click to toggle source
report_what_we_will_do()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/generate_files/generate_makefile.rb, line 82 def reset super() infer_the_namespace # ======================================================================= # # === @_ # ======================================================================= # @_ = ''.dup # string that will be generated # ======================================================================= # # === @base_dir # ======================================================================= # @base_dir = return_pwd.dup # Trailing / is easier. # ======================================================================= # # === @prefix # ======================================================================= # @prefix = '/usr/' # prefix to use # ======================================================================= # # === @may_we_overwrite_existing_makefiles # ======================================================================= # @may_we_overwrite_existing_makefiles = false # ======================================================================= # # === @array_available_C_files # ======================================================================= # @array_available_C_files = Dir['*.c'] end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
Bundle together the various actions.
#¶ ↑
# File lib/rbt/generate_files/generate_makefile.rb, line 317 def run check_against_input report_what_we_will_do add_header fill_up_string if could_we_find_a_C_file? else create_rule 'joe_goes_crazy', 'echo "ok joe is crazy..."' create_rule 'all','g++ main.cpp hello.cpp factorial.cpp -o hello' create_rule 'hello','g++ main.o factorial.o hello.o -o hello','main.o factorial.o hello.o' end sanitize add_tabs # should be called right before save_to is invoked consider_generating_a_new_makefile end
sanitize()
click to toggle source
save_to( where_to = 'Makefile', mode_to_use = 'w+' )
click to toggle source
#¶ ↑
save_to
¶ ↑
Where to save the Makefile.
#¶ ↑
# File lib/rbt/generate_files/generate_makefile.rb, line 298 def save_to( where_to = 'Makefile', mode_to_use = 'w+' ) if File.exist? where_to name = 'old_Makefile' opne 'A Makefile already exists in this directory. We will rename this' opne 'Makefile to '+sfile(name)+' before generating a new Makefile.' opnn; mv('Makefile', name) end save_what_into(data?, where_to) opne 'A new '+steelblue('Makefile')+rev+' was generated!' end