Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad2424007f | ||
|
|
c3c6385068 | ||
|
|
13b9499fbf | ||
|
|
4286925f95 | ||
|
|
0db5614555 | ||
|
|
5d0bbf73ab | ||
|
|
75977981c0 |
No files matched your search
@@ -8,9 +8,9 @@ module Rscons
|
|||||||
'OBJSUFFIX' => '.o',
|
'OBJSUFFIX' => '.o',
|
||||||
'LIBSUFFIX' => '.a',
|
'LIBSUFFIX' => '.a',
|
||||||
'LDFLAGS' => [],
|
'LDFLAGS' => [],
|
||||||
'LIBPATHS' => [],
|
'LIBPATH' => [],
|
||||||
'LIBS' => [],
|
'LIBS' => [],
|
||||||
'LDCOM' => ['$LD', '-o', '$TARGET', '$LDFLAGS', '$SOURCES', '-L$[LIBPATHS]', '-l$[LIBS]']
|
'LDCOM' => ['$LD', '-o', '$TARGET', '$LDFLAGS', '$SOURCES', '-L$[LIBPATH]', '-l$[LIBS]']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+15
-10
@@ -20,7 +20,7 @@ module Rscons
|
|||||||
@varset = VarSet.new(variables)
|
@varset = VarSet.new(variables)
|
||||||
@targets = {}
|
@targets = {}
|
||||||
@builders = {}
|
@builders = {}
|
||||||
@build_dirs = {}
|
@build_dirs = []
|
||||||
@varset[:exclude_builders] ||= []
|
@varset[:exclude_builders] ||= []
|
||||||
unless @varset[:exclude_builders] == :all
|
unless @varset[:exclude_builders] == :all
|
||||||
exclude_builders = Set.new(@varset[:exclude_builders] || [])
|
exclude_builders = Set.new(@varset[:exclude_builders] || [])
|
||||||
@@ -52,9 +52,6 @@ module Rscons
|
|||||||
@builders.each do |builder_name, builder|
|
@builders.each do |builder_name, builder|
|
||||||
env.add_builder(builder)
|
env.add_builder(builder)
|
||||||
end
|
end
|
||||||
@build_dirs.each do |src_dir, obj_dir|
|
|
||||||
env.build_dir(src_dir, obj_dir)
|
|
||||||
end
|
|
||||||
env.append(@varset)
|
env.append(@varset)
|
||||||
env.append(variables)
|
env.append(variables)
|
||||||
|
|
||||||
@@ -79,7 +76,9 @@ module Rscons
|
|||||||
# Specify a build directory for this Environment.
|
# Specify a build directory for this Environment.
|
||||||
# Source files from src_dir will produce object files under obj_dir.
|
# Source files from src_dir will produce object files under obj_dir.
|
||||||
def build_dir(src_dir, obj_dir)
|
def build_dir(src_dir, obj_dir)
|
||||||
@build_dirs[src_dir.gsub('\\', '/')] = obj_dir.gsub('\\', '/')
|
src_dir = src_dir.gsub('\\', '/') if src_dir.is_a?(String)
|
||||||
|
obj_dir = obj_dir.gsub('\\', '/')
|
||||||
|
@build_dirs << [src_dir, obj_dir]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return the file name to be built from source_fname with suffix suffix.
|
# Return the file name to be built from source_fname with suffix suffix.
|
||||||
@@ -89,7 +88,12 @@ module Rscons
|
|||||||
def get_build_fname(source_fname, suffix)
|
def get_build_fname(source_fname, suffix)
|
||||||
build_fname = source_fname.set_suffix(suffix).gsub('\\', '/')
|
build_fname = source_fname.set_suffix(suffix).gsub('\\', '/')
|
||||||
@build_dirs.each do |src_dir, obj_dir|
|
@build_dirs.each do |src_dir, obj_dir|
|
||||||
build_fname.sub!(/^#{src_dir}\//, "#{obj_dir}/")
|
if src_dir.is_a?(Regexp)
|
||||||
|
build_fname.sub!(src_dir, obj_dir)
|
||||||
|
else
|
||||||
|
build_fname.sub!(/^#{src_dir}\//, "#{obj_dir}/")
|
||||||
|
end
|
||||||
|
build_fname.gsub!('\\', '/')
|
||||||
end
|
end
|
||||||
FileUtils.mkdir_p(File.dirname(build_fname))
|
FileUtils.mkdir_p(File.dirname(build_fname))
|
||||||
build_fname
|
build_fname
|
||||||
@@ -212,10 +216,11 @@ module Rscons
|
|||||||
if line =~ /^(.*)\\\s*$/
|
if line =~ /^(.*)\\\s*$/
|
||||||
buildup += ' ' + $1
|
buildup += ' ' + $1
|
||||||
else
|
else
|
||||||
if line =~ /^(.*): (.*)$/
|
buildup += ' ' + line
|
||||||
target, tdeps = $1.strip, $2
|
if buildup =~ /^(.*): (.*)$/
|
||||||
if target == target
|
mf_target, mf_deps = $1.strip, $2
|
||||||
deps += tdeps.split(' ').map(&:strip)
|
if mf_target == target
|
||||||
|
deps += mf_deps.split(' ').map(&:strip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
buildup = ''
|
buildup = ''
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class String
|
|||||||
def has_suffix?(suffix)
|
def has_suffix?(suffix)
|
||||||
if suffix
|
if suffix
|
||||||
suffix = [suffix] if suffix.is_a?(String)
|
suffix = [suffix] if suffix.is_a?(String)
|
||||||
|
suffix = suffix.flatten
|
||||||
suffix.find {|s| self.end_with?(s)}
|
suffix.find {|s| self.end_with?(s)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
# gem version
|
# gem version
|
||||||
VERSION = "0.0.1"
|
VERSION = "0.0.2"
|
||||||
end
|
end
|
||||||
+2
-1
@@ -10,7 +10,8 @@ Gem::Specification.new do |gem|
|
|||||||
gem.email = ["jholtrop@gmail.com"]
|
gem.email = ["jholtrop@gmail.com"]
|
||||||
gem.description = %q{Software construction library inspired by SCons and implemented in Ruby}
|
gem.description = %q{Software construction library inspired by SCons and implemented in Ruby}
|
||||||
gem.summary = %q{Software construction library inspired by SCons and implemented in Ruby}
|
gem.summary = %q{Software construction library inspired by SCons and implemented in Ruby}
|
||||||
gem.homepage = ""
|
gem.homepage = "https://github.com/holtrop/rscons"
|
||||||
|
gem.license = 'MIT'
|
||||||
|
|
||||||
gem.files = `git ls-files`.split($/)
|
gem.files = `git ls-files`.split($/)
|
||||||
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
module Rscons
|
||||||
|
describe Environment do
|
||||||
|
describe '.parse_makefile_deps' do
|
||||||
|
it 'handles dependencies on one line' do
|
||||||
|
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
||||||
|
module.o: source.cc
|
||||||
|
EOS
|
||||||
|
env = Environment.new
|
||||||
|
env.parse_makefile_deps('makefile', 'module.o').should == ['source.cc']
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'handles dependencies split across many lines' do
|
||||||
|
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
||||||
|
module.o: module.c \\
|
||||||
|
module.h \\
|
||||||
|
other.h
|
||||||
|
EOS
|
||||||
|
env = Environment.new
|
||||||
|
env.parse_makefile_deps('makefile', 'module.o').should == [
|
||||||
|
'module.c', 'module.h', 'other.h']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in new issue
Block a user