paper_house 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +17 -0
  5. data/Gemfile +35 -0
  6. data/Guardfile +28 -0
  7. data/README.md +116 -0
  8. data/Rakefile +139 -0
  9. data/cucumber.yml +3 -0
  10. data/examples/c_extension/.gitignore +5 -0
  11. data/examples/c_extension/Rakefile +3 -0
  12. data/examples/c_extension/Rakefile.llvm +5 -0
  13. data/examples/c_extension/hello.c +6 -0
  14. data/examples/executable/.gitignore +4 -0
  15. data/examples/executable/Rakefile +3 -0
  16. data/examples/executable/Rakefile.llvm +5 -0
  17. data/examples/executable/hello.c +7 -0
  18. data/examples/executable_subdirs/.gitignore +4 -0
  19. data/examples/executable_subdirs/Rakefile +9 -0
  20. data/examples/executable_subdirs/includes/hello.h +1 -0
  21. data/examples/executable_subdirs/sources/hello.c +6 -0
  22. data/examples/executable_subdirs/sources/main.c +8 -0
  23. data/examples/shared_library/.gitignore +8 -0
  24. data/examples/shared_library/Rakefile +17 -0
  25. data/examples/shared_library/Rakefile.llvm +19 -0
  26. data/examples/shared_library/hello.c +6 -0
  27. data/examples/shared_library/hello.h +1 -0
  28. data/examples/shared_library/main.c +7 -0
  29. data/examples/shared_library/symlinks.rake +7 -0
  30. data/examples/shared_library_subdirs/.gitignore +8 -0
  31. data/examples/shared_library_subdirs/Rakefile +27 -0
  32. data/examples/shared_library_subdirs/includes/hello.h +1 -0
  33. data/examples/shared_library_subdirs/sources/hello.c +6 -0
  34. data/examples/shared_library_subdirs/sources/main.c +8 -0
  35. data/examples/static_library/.gitignore +7 -0
  36. data/examples/static_library/Rakefile +13 -0
  37. data/examples/static_library/Rakefile.llvm +14 -0
  38. data/examples/static_library/hello.c +6 -0
  39. data/examples/static_library/hello.h +1 -0
  40. data/examples/static_library/main.c +7 -0
  41. data/examples/static_library_subdirs/.gitignore +7 -0
  42. data/examples/static_library_subdirs/Rakefile +17 -0
  43. data/examples/static_library_subdirs/includes/hello.h +1 -0
  44. data/examples/static_library_subdirs/sources/hello.c +6 -0
  45. data/examples/static_library_subdirs/sources/main.c +8 -0
  46. data/features/c_extension_task.feature +119 -0
  47. data/features/executable_task.feature +83 -0
  48. data/features/shared_library_task.feature +209 -0
  49. data/features/static_library_task.feature +116 -0
  50. data/features/step_definitions/paper_house_steps.rb +8 -0
  51. data/features/support/env.rb +41 -0
  52. data/features/support/hooks.rb +12 -0
  53. data/lib/paper_house/auto_depends.rb +95 -0
  54. data/lib/paper_house/build_task.rb +188 -0
  55. data/lib/paper_house/c_extension_task.rb +95 -0
  56. data/lib/paper_house/cc_options.rb +81 -0
  57. data/lib/paper_house/dependency.rb +74 -0
  58. data/lib/paper_house/executable_task.rb +77 -0
  59. data/lib/paper_house/library_task.rb +64 -0
  60. data/lib/paper_house/linker_options.rb +89 -0
  61. data/lib/paper_house/platform.rb +69 -0
  62. data/lib/paper_house/safe_popen.rb +50 -0
  63. data/lib/paper_house/shared_library_task.rb +92 -0
  64. data/lib/paper_house/static_library_task.rb +65 -0
  65. data/lib/paper_house/version.rb +30 -0
  66. data/lib/paper_house.rb +30 -0
  67. data/paper_house.gemspec +34 -0
  68. data/spec/paper_house/c_extension_task_spec.rb +59 -0
  69. data/spec/paper_house/cc_options_spec.rb +59 -0
  70. data/spec/paper_house/executable_task_spec.rb +49 -0
  71. data/spec/paper_house/shared_library_task_spec.rb +94 -0
  72. data/spec/paper_house/static_library_task_spec.rb +61 -0
  73. data/spec/paper_house/version_spec.rb +31 -0
  74. data/spec/spec_helper.rb +46 -0
  75. metadata +161 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 76f6b308698dc77f7b335bc6b0ef88673815a48e
4
+ data.tar.gz: 64f2969fa8e010f9508d07b268c8492effde8594
5
+ SHA512:
6
+ metadata.gz: ffba1f28e1c9deb249c5e48cb14bb152103439831367586bf8c4284d04f86c7aab34b615ce09247491689c8989586d7b72c9b899ffda1b52835ec3aaf1e50231
7
+ data.tar.gz: fe01a0af5f02b5a122bbb2f16aad92f61c862190504e185f3af086bc42522594620b4413c140cb92a430ca1b43d87b2299ff919d7f16846919724de8da30eba1
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ Gemfile.lock
6
+ InstalledFiles
7
+ coverage
8
+ lib/bundler/man
9
+ pkg
10
+ rdoc
11
+ spec/reports
12
+ test/tmp
13
+ test/version_tmp
14
+ tmp
15
+
16
+ # YARD artifacts
17
+ .yardoc
18
+ _yardoc
19
+ doc/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+
3
+ script: "rake travis"
4
+
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+
9
+ branches:
10
+ only:
11
+ - master
12
+ - develop
13
+
14
+ before_install:
15
+ - sudo apt-get update -qq
16
+ - sudo apt-get install -qq llvm-gcc-4.6
17
+
data/Gemfile ADDED
@@ -0,0 +1,35 @@
1
+ source "https://rubygems.org"
2
+
3
+
4
+ gemspec
5
+
6
+
7
+ group :development do
8
+ gem "aruba", "~> 0.5.3"
9
+ gem "coveralls", "~> 0.7.0", :require => false
10
+ gem "cucumber", "~> 1.3.8"
11
+ gem "flay", "~> 2.4.0"
12
+ gem "flog", "~> 4.1.2"
13
+ gem "guard", "~> 1.8.3"
14
+ gem "guard-bundler", "~> 1.0.0"
15
+ gem "guard-cucumber", "~> 1.4.0"
16
+ gem "guard-rspec", "~> 3.1.0"
17
+ gem "rb-fchange", "~> 0.0.6", :require => false
18
+ gem "rb-fsevent", "~> 0.9.3", :require => false
19
+ gem "rb-inotify", "~> 0.9.2", :require => false
20
+ gem "redcarpet", "~> 2.3.0" if RUBY_VERSION < "1.9.0"
21
+ gem "redcarpet", "~> 3.0.0" if RUBY_VERSION >= "1.9.0"
22
+ gem "reek", "~> 1.3.3"
23
+ gem "relish", "~> 0.7"
24
+ gem "rspec", "~> 2.14.1"
25
+ gem "rspec-instafail", "~> 0.2.4"
26
+ gem "terminal-notifier-guard", "~> 1.5.3"
27
+ gem "yard", "~> 0.8.7.2"
28
+ end
29
+
30
+
31
+ ### Local variables:
32
+ ### mode: Ruby
33
+ ### coding: utf-8-unix
34
+ ### indent-tabs-mode: nil
35
+ ### End:
data/Guardfile ADDED
@@ -0,0 +1,28 @@
1
+ # More info at https://github.com/guard/guard#readme
2
+
3
+ notification :terminal_notifier
4
+ notification :tmux, :display_message => true
5
+
6
+
7
+ guard :bundler do
8
+ watch('Gemfile')
9
+ watch(/^.+\.gemspec/)
10
+ end
11
+
12
+
13
+ guard :rspec, :cli => "--color -r rspec/instafail -f RSpec::Instafail", :all_on_start => false do
14
+ watch(%r{^spec/paper_house/.+_spec\.rb$})
15
+ watch(%r{^lib/paper_house/(.+)\.rb$}) { |m| "spec/paper_house/#{m[1]}_spec.rb" }
16
+ watch('spec/spec_helper.rb') { "spec" }
17
+ end
18
+
19
+
20
+ require "paper_house/platform"
21
+
22
+ cli_opts = %w(--format progress --strict --profile) + [ PaperHouse::Platform::MAC ? "mac" : "linux" ]
23
+
24
+ guard :cucumber, :cli => cli_opts.join( " " ), :all_on_start => false do
25
+ watch(%r{^features/.+\.feature$})
26
+ watch(%r{^features/support/.+$}) { 'features' }
27
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
28
+ end
data/README.md ADDED
@@ -0,0 +1,116 @@
1
+ Paper House
2
+ ===========
3
+ [![Gem Version](https://badge.fury.io/rb/paper-house.png)](http://badge.fury.io/rb/paper-house)
4
+ [![Build Status](https://travis-ci.org/trema/paper-house.png?branch=develop)](https://travis-ci.org/trema/paper-house)
5
+ [![Code Climate](https://codeclimate.com/github/trema/paper-house.png)](https://codeclimate.com/github/trema/paper-house)
6
+ [![Coverage Status](https://coveralls.io/repos/trema/paper-house/badge.png?branch=develop)](https://coveralls.io/r/trema/paper-house)
7
+ [![Dependency Status](https://gemnasium.com/trema/paper-house.png)](https://gemnasium.com/trema/paper-house)
8
+
9
+ <a href="http://www.flickr.com/photos/studiobeerhorst/8221979536/" title="paper houses - 3d woodcut prints by Rick&Brenda Beerhorst, on Flickr"><img src="http://farm9.staticflickr.com/8202/8221979536_60404c309d_n.jpg" width="320" height="240" alt="paper houses - 3d woodcut prints" align="right"></a>
10
+
11
+ Paper House is a ruby gem to easily build C projects using [Rake](https://github.com/jimweirich/rake). It supports the following build targets:
12
+
13
+ * [Executable](http://rubydoc.info/github/trema/paper-house/PaperHouse/ExecutableTask)
14
+ * [Static library](http://rubydoc.info/github/trema/paper-house/PaperHouse/StaticLibraryTask)
15
+ * [Shared library](http://rubydoc.info/github/trema/paper-house/PaperHouse/SharedLibraryTask)
16
+ * [C extension for Ruby](http://rubydoc.info/github/trema/paper-house/PaperHouse/CExtensionTask)
17
+
18
+
19
+ Features Overview
20
+ -----------------
21
+
22
+ * Provides a simple yet a powerful syntax to build above mentioned
23
+ targets using predefined Rake tasks.
24
+ * Pure Ruby. No additional dependency on other external tools
25
+ (`makedepend` etc.) to resolve file dependencies.
26
+ * Multi-Platform. Runs on both Linux and MacOSX, and supports all
27
+ major version of Ruby (1.8.7, 1.9.3, 2.0.0).
28
+
29
+
30
+ Example
31
+ -------
32
+
33
+ Its usage is dead simple: to build an executable from all the `*.c`
34
+ and `*.h` files in the current directory, just add the following lines
35
+ to your `Rakefile`.
36
+
37
+ ```ruby
38
+ require "paper_house"
39
+
40
+ PaperHouse::ExecutableTask.new :hello
41
+ ```
42
+
43
+ This defines a new task `hello`, and `rake hello` will automatically
44
+ analyze all file dependencies of the source files, compile them into
45
+ an executable named `hello``.
46
+
47
+ If you wish to customize the build process more, please set the
48
+ following options defined in `PaperHouse::ExecutableTask`:
49
+
50
+ ```ruby
51
+ PaperHouse::ExecutableTask.new :hello do | task |
52
+ task.executable_name = "hello_world"
53
+ task.target_directory = "objects"
54
+ task.cc = "llvm-gcc"
55
+ task.includes = "includes"
56
+ task.sources = "sources"
57
+ task.cflags = [ "-Werror", "-Wall", "-Wextra" ]
58
+ task.ldflags = "-L/some/path"
59
+ task.library_dependencies = "m"
60
+ end
61
+ ```
62
+
63
+ You can find more examples in the
64
+ [examples/](https://github.com/trema/paper-house/tree/master/examples)
65
+ directory.
66
+
67
+
68
+ Installation
69
+ ------------
70
+
71
+ The simplest way to install Paper House is to use [Bundler](http://gembundler.com/).
72
+
73
+ Add Paper House to your `Gemfile`:
74
+
75
+ ```ruby
76
+ gem 'paper_house'
77
+ ```
78
+
79
+ and install it by running Bundler:
80
+
81
+ ```bash
82
+ $ bundle
83
+ ```
84
+
85
+
86
+ Documents
87
+ ---------
88
+
89
+ * [API document generated with YARD](http://rubydoc.info/github/trema/paper-house/frames/file/README.md)
90
+ * [Usage document generated with Cucumber and Relish](https://www.relishapp.com/trema/paper-house/docs)
91
+
92
+
93
+ ### Author
94
+
95
+ [Yasuhito Takamiya](https://github.com/yasuhito) ([@yasuhito](http://twitter.com/yasuhito))
96
+
97
+ ### Contributors
98
+
99
+ [https://github.com/trema/paper-house/contributors](https://github.com/trema/paper-house/contributors)
100
+
101
+
102
+ Alternatives
103
+ ------------
104
+
105
+ * rake-compiler: https://github.com/luislavena/rake-compiler
106
+ * rake-builder: https://github.com/joeyates/rake-builder
107
+ * Rant: http://rant.rubyforge.org/
108
+ * cxxproject: https://github.com/marcmo/cxxproject
109
+
110
+
111
+ License
112
+ -------
113
+
114
+ Trema is released under the GNU General Public License version 3.0:
115
+
116
+ * http://www.gnu.org/licenses/gpl.html
data/Rakefile ADDED
@@ -0,0 +1,139 @@
1
+ #
2
+ # Copyright (C) 2013 NEC Corporation
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License, version 3, as
6
+ # published by the Free Software Foundation.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License along
14
+ # with this program; if not, write to the Free Software Foundation, Inc.,
15
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
+ #
17
+
18
+
19
+ require "bundler/gem_tasks"
20
+ require "coveralls/rake/task"
21
+ require "flay"
22
+ require "flay_task"
23
+ require "flog"
24
+ require "rake/tasklib"
25
+ require "reek/rake/task"
26
+ require "rspec/core"
27
+ require "rspec/core/rake_task"
28
+ require "yaml"
29
+ require "yard"
30
+
31
+
32
+ $ruby_source = FileList[ "lib/**/*.rb" ]
33
+
34
+
35
+ task :default => :travis
36
+ task :travis => [ :spec, :cucumber, :quality, "coveralls:push" ]
37
+ task :quality => [ :reek, :flog, :flay ]
38
+
39
+
40
+ Coveralls::RakeTask.new
41
+
42
+
43
+ RSpec::Core::RakeTask.new do | task |
44
+ task.rspec_opts = "--format documentation --color"
45
+ end
46
+
47
+
48
+ require "cucumber/rake/task"
49
+ Cucumber::Rake::Task.new do | t |
50
+ profile = %w(--profile)
51
+ require "paper_house/platform"
52
+ if PaperHouse::Platform::MAC
53
+ profile << "mac"
54
+ else
55
+ profile << "linux"
56
+ end
57
+ t.cucumber_opts = profile.join( " " )
58
+ end
59
+
60
+
61
+ Reek::Rake::Task.new do | t |
62
+ t.fail_on_error = true
63
+ t.verbose = false
64
+ t.ruby_opts = [ "-rubygems" ]
65
+ t.reek_opts = "--quiet"
66
+ t.source_files = $ruby_source
67
+ end
68
+
69
+
70
+ desc "Analyze for code complexity"
71
+ task :flog do
72
+ flog = Flog.new( :continue => true )
73
+ flog.flog( *$ruby_source )
74
+ threshold = 10
75
+
76
+ bad_methods = flog.totals.select do | name, score |
77
+ ( not ( /##{flog.no_method}$/=~ name ) ) and score > threshold
78
+ end
79
+ bad_methods.sort do | a, b |
80
+ a[ 1 ] <=> b[ 1 ]
81
+ end.reverse.each do | name, score |
82
+ puts "%8.1f: %s" % [ score, name ]
83
+ end
84
+ unless bad_methods.empty?
85
+ raise "#{ bad_methods.size } methods have a flog complexity > #{ threshold }"
86
+ end
87
+ end
88
+
89
+
90
+ FlayTask.new do | t |
91
+ t.dirs = $ruby_source.collect do | each |
92
+ each[ /[^\/]+/ ]
93
+ end.uniq
94
+ t.threshold = 0
95
+ t.verbose = $trace
96
+ end
97
+
98
+
99
+ task :relish do
100
+ sh "relish push trema/paper-house"
101
+ end
102
+
103
+
104
+ YARD::Rake::YardocTask.new do | t |
105
+ t.options = [ "--no-private" ]
106
+ t.options << "--debug" << "--verbose" if $trace
107
+ end
108
+
109
+
110
+ def travis_yml
111
+ File.join File.dirname( __FILE__ ), ".travis.yml"
112
+ end
113
+
114
+
115
+ def rubies
116
+ ( [ "1.8.7" ] + YAML.load_file( travis_yml )[ "rvm" ] ).uniq.sort
117
+ end
118
+
119
+
120
+ desc "Run tests against multiple rubies"
121
+ task :portability
122
+
123
+ rubies.each do | each |
124
+ portability_task_name = "portability:#{ each }"
125
+ task :portability => portability_task_name
126
+
127
+ desc "Run tests against Ruby#{ each }"
128
+ task portability_task_name do
129
+ sh "rvm #{ each } exec bundle"
130
+ sh "rvm #{ each } exec bundle exec rake"
131
+ end
132
+ end
133
+
134
+
135
+ ### Local variables:
136
+ ### mode: Ruby
137
+ ### coding: utf-8-unix
138
+ ### indent-tabs-mode: nil
139
+ ### End:
data/cucumber.yml ADDED
@@ -0,0 +1,3 @@
1
+ linux: --tags ~@wip --tags ~@mac
2
+ mac: --tags ~@wip --tags ~@linux
3
+
@@ -0,0 +1,5 @@
1
+ .hello.depends
2
+ hello.bundle
3
+ hello.o
4
+ hello.so
5
+
@@ -0,0 +1,3 @@
1
+ require "paper_house"
2
+
3
+ PaperHouse::CExtensionTask.new :hello
@@ -0,0 +1,5 @@
1
+ require "paper_house"
2
+
3
+ PaperHouse::CExtensionTask.new :hello do | task |
4
+ task.cc = "llvm-gcc"
5
+ end
@@ -0,0 +1,6 @@
1
+ #include "ruby.h"
2
+
3
+ void
4
+ Init_hello() {
5
+ VALUE cHelloPaperHouse = rb_define_class( "HelloPaperHouse", rb_cObject );
6
+ }
@@ -0,0 +1,4 @@
1
+ .hello.depends
2
+ hello
3
+ hello.o
4
+
@@ -0,0 +1,3 @@
1
+ require "paper_house"
2
+
3
+ PaperHouse::ExecutableTask.new :hello
@@ -0,0 +1,5 @@
1
+ require "paper_house"
2
+
3
+ PaperHouse::ExecutableTask.new :hello do | task |
4
+ task.cc = "llvm-gcc"
5
+ end
@@ -0,0 +1,7 @@
1
+ #include <stdio.h>
2
+
3
+ int
4
+ main() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ return 0;
7
+ }
@@ -0,0 +1,4 @@
1
+ .hello.depends
2
+ hello
3
+ hello.o
4
+ main.o
@@ -0,0 +1,9 @@
1
+ require "paper_house"
2
+
3
+ PaperHouse::ExecutableTask.new :hello do | task |
4
+ task.executable_name = "hello"
5
+ task.target_directory = "objects"
6
+ task.sources = "sources/*.c"
7
+ task.includes = "includes"
8
+ task.cflags = [ "-Wall", "-Wextra" ]
9
+ end
@@ -0,0 +1 @@
1
+ void print_hello();
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ print_hello() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ }
@@ -0,0 +1,8 @@
1
+ #include <stdlib.h>
2
+ #include "hello.h"
3
+
4
+ int
5
+ main() {
6
+ print_hello();
7
+ return 0;
8
+ }
@@ -0,0 +1,8 @@
1
+ .hello.depends
2
+ .libhello.depends
3
+ hello
4
+ hello.o
5
+ libhello.so
6
+ libhello.so.0
7
+ libhello.so.0.1.0
8
+ main.o
@@ -0,0 +1,17 @@
1
+ require "paper_house"
2
+
3
+ $libhello = PaperHouse::SharedLibraryTask.new :libhello do | task |
4
+ task.version = "0.1.0"
5
+ task.sources = "hello.c"
6
+ task.library_dependencies = "m" # not used.
7
+ end
8
+
9
+
10
+ task :hello => [ :libhello, $libhello.linker_name, $libhello.soname ]
11
+
12
+ PaperHouse::ExecutableTask.new :hello do | task |
13
+ task.sources = "main.c"
14
+ task.ldflags = "-L."
15
+ end
16
+
17
+ load "symlinks.rake"
@@ -0,0 +1,19 @@
1
+ require "paper_house"
2
+
3
+ $libhello = PaperHouse::SharedLibraryTask.new :libhello do | task |
4
+ task.version = "0.1.0"
5
+ task.sources = "hello.c"
6
+ task.cc = "llvm-gcc"
7
+ task.library_dependencies = "m" # not used.
8
+ end
9
+
10
+
11
+ task :hello => [ :libhello, $libhello.linker_name, $libhello.soname ]
12
+
13
+ PaperHouse::ExecutableTask.new :hello do | task |
14
+ task.sources = "main.c"
15
+ task.cc = "llvm-gcc"
16
+ task.ldflags = "-L."
17
+ end
18
+
19
+ load "symlinks.rake"
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ hello() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ }
@@ -0,0 +1 @@
1
+ void hello();
@@ -0,0 +1,7 @@
1
+ #include "hello.h"
2
+
3
+ int
4
+ main() {
5
+ hello();
6
+ return 0;
7
+ }
@@ -0,0 +1,7 @@
1
+ [ $libhello.linker_name, $libhello.soname ].each do | each |
2
+ file each do | task |
3
+ symlink $libhello.target_file_name, task.name
4
+ end
5
+
6
+ CLOBBER.include each if FileTest.exists?( each )
7
+ end
@@ -0,0 +1,8 @@
1
+ .hello.depends
2
+ .libhello.depends
3
+ hello
4
+ hello.o
5
+ libhello.so
6
+ libhello.so.0
7
+ libhello.so.0.1.0
8
+ main.o
@@ -0,0 +1,27 @@
1
+ require "paper_house"
2
+
3
+ libhello = PaperHouse::SharedLibraryTask.new :libhello do | task |
4
+ task.library_name = "hello"
5
+ task.version = "0.1.0"
6
+ task.target_directory = "objects"
7
+ task.sources = "sources/hello.c"
8
+ task.includes = "includes"
9
+ task.cflags = [ "-Werror", "-Wall", "-Wextra" ]
10
+ end
11
+
12
+
13
+ task :hello => [ :libhello, libhello.linker_name, libhello.soname ]
14
+
15
+ PaperHouse::ExecutableTask.new :hello do | task |
16
+ task.sources = "sources/main.c"
17
+ task.includes = "includes"
18
+ task.ldflags = "-L."
19
+ end
20
+
21
+ [ libhello.linker_name, libhello.soname ].each do | each |
22
+ file each do | task |
23
+ symlink File.join( "objects", libhello.target_file_name ), task.name
24
+ end
25
+
26
+ CLOBBER.include each if FileTest.exists?( each )
27
+ end
@@ -0,0 +1 @@
1
+ void print_hello();
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ print_hello() {
5
+ printf( "Hello, PaperHouse!\n" );
6
+ }
@@ -0,0 +1,8 @@
1
+ #include <stdlib.h>
2
+ #include "hello.h"
3
+
4
+ int
5
+ main() {
6
+ print_hello();
7
+ return 0;
8
+ }
@@ -0,0 +1,7 @@
1
+ .hello.depends
2
+ .libhello.depends
3
+ hello
4
+ hello.o
5
+ libhello.a
6
+ main.o
7
+
@@ -0,0 +1,13 @@
1
+ require "paper_house"
2
+
3
+ task :hello => :libhello
4
+
5
+ PaperHouse::StaticLibraryTask.new :libhello do | task |
6
+ task.sources = "hello.c"
7
+ end
8
+
9
+
10
+ PaperHouse::ExecutableTask.new :hello do | task |
11
+ task.ldflags = "-L."
12
+ task.sources = "main.c"
13
+ end
@@ -0,0 +1,14 @@
1
+ require "paper_house"
2
+
3
+ task :hello => :libhello
4
+
5
+ PaperHouse::StaticLibraryTask.new :libhello do | task |
6
+ task.cc = "llvm-gcc"
7
+ task.sources = "hello.c"
8
+ end
9
+
10
+ PaperHouse::ExecutableTask.new :hello do | task |
11
+ task.cc = "llvm-gcc"
12
+ task.ldflags = "-L."
13
+ task.sources = "main.c"
14
+ end
@@ -0,0 +1,6 @@
1
+ #include <stdio.h>
2
+
3
+ void
4
+ hello() {
5
+ printf( "Hello, PaperHouse!\n");
6
+ }
@@ -0,0 +1 @@
1
+ void hello();
@@ -0,0 +1,7 @@
1
+ #include "hello.h"
2
+
3
+ int
4
+ main() {
5
+ hello();
6
+ return 0;
7
+ }
@@ -0,0 +1,7 @@
1
+ .hello.depends
2
+ .libhello.depends
3
+ hello
4
+ hello.o
5
+ libhello.a
6
+ main.o
7
+