107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/flak/rake/templates/cpp.rb', line 107
def self.task_factory target
settings = target.settings
files = settings[:source_files]
unless files.nil?
files.each do |f|
object = target.object_file(f)
file object => f do |t|
target.make_directory_for(object)
sh target.c_compile_cmd(f)
end
= f.ext('h')
file object => if File.exists?()
end
objects = target.object_files
build_file = target.build_filename
file build_file => objects do
target.make_directory_for(build_file)
sh target.c_link_cmd
end
namespace settings[:name].to_sym do
desc "build the #{settings[:name].to_sym} binary"
task :build => build_file end
task :build => "#{settings[:name].to_sym}:build"
namespace settings[:name].to_sym do
desc "clean the #{settings[:name].to_sym} build files"
task :clean do
sh target.c_clean_cmd
end
end
task :clean => "#{settings[:name].to_sym}:clean"
release_binary = target.release_filename
build_file = target.build_filename
file release_binary => build_file do
target.make_directory_for(release_binary)
rm_r release_binary if File.exists?(release_binary)
cp build_file, release_binary
File.chmod 0755, release_binary
end
namespace settings[:name].to_sym do
task :release => release_binary
end
task :release => "#{settings[:name].to_sym}:release"
end
end
|