diff --git a/build.rb b/build.rb index 52d1dd2..809fd4a 100755 --- a/build.rb +++ b/build.rb @@ -2,15 +2,9 @@ #I'll put this in here as an example -# make a folder called src and a folder called build -# then put some c source code in src -# then run rub and watch it build +# -# of course you could make your own build.rb to build any project - -# ruby might not let you modify CONSTANTS -# so put a $ in front of the name which makes -# them global and not CONSTANT +#should maybe use environment variables for these $CC="gcc" CFLAGS="-O1 -march=native -std=c11" $EFLAGS = "" #extra flags @@ -51,7 +45,6 @@ def parse(arg) else #error "unknown argument: #{arg}" - print arg end case arg.split("=")[0] @@ -75,12 +68,9 @@ end #main build function def main - #if Dir.children(SRCDIR).count == 0 - #error("src directory empty") - #end - - error("src directory empty") unless Dir.children(SRCDIR) + error("src directory empty") if Dir.children(SRCDIR).count == 0 + #create a thread for each compilation unit threads = [] Dir.each_child(SRCDIR) {|x| @@ -96,6 +86,7 @@ def main until threads.map { |t| t.alive? }.include?(false) end + #link build = Dir.each_child(BUILDDIR) o_files = [] build.each { |s|