Skip to content

Instantly share code, notes, and snippets.

@rkachowski
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkachowski/be91c426b46725c20250 to your computer and use it in GitHub Desktop.
Save rkachowski/be91c426b46725c20250 to your computer and use it in GitHub Desktop.
Rudimentary C Rakefile
rule ".o" => ".c" do |t|
execute "cc -c #{t.source} -o #{t.name}"
end
rule /^((?!\w*\.\w*).)*$/ => ".c" do |t|
deps = t.prerequisites
objects = deps.select { |d| d.pathmap == ".o" }
execute "cc #{t.source} #{objects.join ' '} -o #{t.name}"
end
def execute(cmd)
puts(cmd)
system(cmd, out: $stdout)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment