超漢字開発環境でClangを使ってみるテスト
Rev. | 9c96c55bdcf5596dc3154a098f9dda6176a789c4 |
---|---|
Größe | 1,237 Bytes |
Zeit | 2015-11-19 01:59:38 |
Autor | ornse01 |
Log Message | add sample code.
* call system function.
|
require 'rake/clean'
require 'rake/loaders/makefile'
CC = "clang"
INCDIR = ["#{ENV['BD']}/include", "../src"]
CFLAGS = "-O2 -target i386-unknown-gnu -Wall"
CPPFLAGS = "#{INCDIR.map {|item| '-I'+item }.join(' ')} -DPCAT"
LINKER = "#{ENV['GNUi386']}/bin/gcc386"
LOADLIBES = "-limg -lapp -ltf -lgcc -lmain_r -ldbg -llang -lg -lsys -lg -lf -lsvc"
LDFLAGS = "-L#{ENV['BD']}/lib/i386e2"
NM = "#{ENV['GNUi386']}/bin/nm"
MAKEDEPS = "#{ENV['BD']}/etc/makedeps #{CPPFLAGS}"
TARGET = "hello"
TARGET_MAP = "#{TARGET}.map"
TARGET_BIN = "#{TARGET}.out"
SRCS = FileList["../src/*.c"]
OBJS = SRCS.pathmap("%f").ext('o')
CLEAN.include(OBJS)
CLOBBER.include(TARGET_MAP)
CLOBBER.include(TARGET_BIN)
CLOBBER.include("Dependencies.mf")
CLOBBER.include(FileList["*.d"])
task :default => [TARGET_MAP]
file TARGET_BIN => OBJS do |t|
sh "#{LINKER} #{LDFLAGS} #{t.prerequisites.join(' ')} #{LOADLIBES} -o #{t.name} "
end
rule '.o' => [proc{|t| t.pathmap("../src/%n.c") }] do |t|
sh "#{CC} #{CFLAGS} #{CPPFLAGS} -c #{t.source} -o #{t.name}"
end
rule '.map' => '.out' do |t|
sh "#{NM} -n #{t.source} > #{t.name}"
end
file "Dependencies.mf" => SRCS do |t|
sh "perl #{MAKEDEPS} #{t.name} #{t.prerequisites.join(' ')}"
end
import "Dependencies.mf"