Skip to content

Instantly share code, notes, and snippets.

@halllllll
Created July 17, 2018 08:03
Show Gist options
  • Save halllllll/cf059bbb8e5409cbd1c246d9c6ee8266 to your computer and use it in GitHub Desktop.
Save halllllll/cf059bbb8e5409cbd1c246d9c6ee8266 to your computer and use it in GitHub Desktop.
my first Rakefile practice.
#include <stdio.h>
#include "message.h"
int main(void){
printf("hello, ");
message();
return 0;
}
#include <stdio.h>
int message(void){
printf("fuckin world!");
return 0;
}
int message();
#参考 http://www2s.biglobe.ne.jp/~idesaku/sss/tech/rake/
require 'rake/clean'
# なぜか消えない
CLEAN.include('*.o')
CLOBBER.include('*.o')
CLEAN << "*.o"
CLOBBER << "*.o"
CC = "gcc"
BIN_OUT = "./out"
# なぜか作成されない
directory BIN_OUT
task :default => "hello"
file "hello" => ["hello.o", "message.o"] do |t|
sh "#{CC} -o #{t.name} #{t.prerequisites.join(' ')}"
end
rule '.o' => '.c' do |t|
sh "#{CC} -c #{t.source}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment