demake 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/demake +67 -42
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e635ec0a30c148dc71c4aa8bb14e12cd0f45e62346fca6918e9164eef07b153
|
|
4
|
+
data.tar.gz: ca1693da772c3417751021bf9a436119af069a18becbb6882ad438fdb1e5fcaa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 354c414bfae2e7e9138dfd7bf7facc0b09f4b3aa71e420a305c2dda6330e9e7846de943f3ba9296014f1658d6638d2586442aa9d32a26c725e841619444ffb33
|
|
7
|
+
data.tar.gz: ccab035b4f0477e8b2d2b9676936bf28bcfe400a7997e88b11bd1ff623214d7a19734466850f1af3175bf57803982224cbeb0b3f0239392c730e9869e0a113de
|
data/bin/demake
CHANGED
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
#
|
|
4
|
-
# demake -
|
|
4
|
+
# demake - Single self-contained executeable script which uses Ruby to generate decorated make files
|
|
5
5
|
# for multiple related applications.
|
|
6
6
|
|
|
7
7
|
require 'pipetext'
|
|
8
8
|
|
|
9
|
+
demake_version = "0.0.3"
|
|
10
|
+
|
|
9
11
|
debug = true
|
|
10
12
|
quiet = false
|
|
11
13
|
compiler = "gcc"
|
|
12
14
|
#compiler = "clang"
|
|
13
15
|
#compiler = "arm-none-eabi-gcc"
|
|
14
16
|
#compiler = "arm-linux-gnu-gcc"
|
|
17
|
+
|
|
18
|
+
flags = String.new
|
|
19
|
+
linux_flags = String.new
|
|
20
|
+
x86_64_flags = String.new
|
|
21
|
+
aarch64_flags = String.new
|
|
22
|
+
darwin_flags = String.new
|
|
23
|
+
libraries = String.new
|
|
24
|
+
@raw_binary_files = String.new
|
|
25
|
+
|
|
15
26
|
binary_directory = "bin"
|
|
16
27
|
source_directory = "src"
|
|
17
28
|
object_directory = "obj"
|
|
18
|
-
@raw_binary_files = String.new
|
|
19
|
-
|
|
20
|
-
flags = "-ansi -pedantic -D_DEFAULT_SOURCE"
|
|
21
|
-
#flags = "-ansi -pedantic -static -static-libgcc"
|
|
22
|
-
|
|
23
|
-
libraries = "-lc"
|
|
24
29
|
|
|
25
30
|
@pipe = Class.new.extend(PipeText)
|
|
26
31
|
|
|
32
|
+
#
|
|
33
|
+
# !!! If there is a demake/settings.rb file that gets executed NOW as raw code !!!
|
|
34
|
+
#
|
|
35
|
+
# !!! Incredibly convenient, but potentially a security nightmare -- secure your environment !!!
|
|
36
|
+
#
|
|
27
37
|
begin
|
|
28
38
|
code = File.open('demake/settings.rb').read
|
|
29
39
|
eval code
|
|
@@ -63,7 +73,7 @@ end
|
|
|
63
73
|
|
|
64
74
|
@output = <<-END_OF_STRING
|
|
65
75
|
#
|
|
66
|
-
# Makefile automatically generated by demake
|
|
76
|
+
# Makefile automatically generated by demake #{demake_version}
|
|
67
77
|
#
|
|
68
78
|
END_OF_STRING
|
|
69
79
|
|
|
@@ -85,21 +95,28 @@ END_OF_STRING
|
|
|
85
95
|
|
|
86
96
|
@output << compiler_settings
|
|
87
97
|
|
|
88
|
-
compiler_flags =
|
|
89
|
-
|
|
90
|
-
ifeq '$(OS)' 'Linux'
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
ifeq '$(MACHINE)' 'aarch64'
|
|
101
|
-
FLAGS +=
|
|
102
|
-
endif
|
|
98
|
+
compiler_flags = "FLAGS = #{flags}\n"
|
|
99
|
+
if(linux_flags != "")
|
|
100
|
+
compiler_flags << "ifeq '$(OS)' 'Linux'\n"
|
|
101
|
+
compiler_flags << " FLAGS += #{linux_flags}\n"
|
|
102
|
+
compiler_flags << "endif\n"
|
|
103
|
+
end
|
|
104
|
+
if(darwin_flags != "")
|
|
105
|
+
compiler_flags << "ifeq '$(OS)' 'Darwin'\n"
|
|
106
|
+
compiler_flags << " FLAGS += #{darwin_flags}\n"
|
|
107
|
+
compiler_flags << "endif\n"
|
|
108
|
+
end
|
|
109
|
+
if(aarch64_flags != "")
|
|
110
|
+
compiler_flags << "ifeq '$(MACHINE)' 'aarch64'\n"
|
|
111
|
+
compiler_flags << " FLAGS += #{aarch64_flags}\n"
|
|
112
|
+
compiler_flags << "endif\n"
|
|
113
|
+
end
|
|
114
|
+
if(x86_64_flags != "")
|
|
115
|
+
compiler_flags << "ifeq '$(MACHINE)' 'x86_64'\n"
|
|
116
|
+
compiler_flags << " FLAGS += #{x86_64_flags}\n"
|
|
117
|
+
compiler_flags << "endif\n"
|
|
118
|
+
end
|
|
119
|
+
compiler_flags += <<-END_OF_STRING
|
|
103
120
|
ifeq '$(DEBUG)' 'true'
|
|
104
121
|
FLAGS += -g -Wall -W -Wconversion -Wshadow -Wcast-qual -Wwrite-strings
|
|
105
122
|
else
|
|
@@ -107,11 +124,11 @@ else
|
|
|
107
124
|
endif
|
|
108
125
|
CFLAGS = $(FLAGS)
|
|
109
126
|
END_OF_STRING
|
|
110
|
-
|
|
111
127
|
if(defined?($flags_override))
|
|
112
128
|
STDERR.puts("Overriding compiler flags")
|
|
113
129
|
compiler_flags = "FLAGS = #{flags}\nCFLAGS = $(FLAGS)\n"
|
|
114
130
|
end
|
|
131
|
+
|
|
115
132
|
@output << compiler_flags
|
|
116
133
|
|
|
117
134
|
compiler_directories = <<-END_OF_STRING
|
|
@@ -137,6 +154,17 @@ counter = 0
|
|
|
137
154
|
rescue Errno::ENOENT
|
|
138
155
|
@output << "FL#{counter} ="
|
|
139
156
|
end
|
|
157
|
+
if(File.directory?(source_directory + '/' + app[0]) == true)
|
|
158
|
+
Dir.entries(source_directory + '/' + app[0]).each do |e|
|
|
159
|
+
if(e != '.' && e != '..' && e =~ /(.*)\.cp?p?$/)
|
|
160
|
+
Dir.chdir(source_directory + '/' + app[0]) do
|
|
161
|
+
if(File.directory?(e) == false)
|
|
162
|
+
@output << " " + app[0] + '/' + $1 + '.o'
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
140
168
|
app[1]['dependencies'].each do |dep|
|
|
141
169
|
if(File.directory?(source_directory + '/' + dep) == true)
|
|
142
170
|
Dir.entries(source_directory + '/' + dep).each do |e|
|
|
@@ -159,28 +187,26 @@ end
|
|
|
159
187
|
|
|
160
188
|
menu_target = <<-END_OF_STRING
|
|
161
189
|
menu :
|
|
162
|
-
\t@
|
|
163
|
-
\t@echo "
|
|
164
|
-
\t@echo "
|
|
165
|
-
\t@echo "|]
|
|
166
|
-
\t@echo "
|
|
167
|
-
\t@echo "
|
|
168
|
-
\t@echo "
|
|
169
|
-
\t@echo "|
|
|
170
|
-
\t@echo "|-{|20-}|o"
|
|
190
|
+
\t@echo "|-[|23-]|o"
|
|
191
|
+
\t@echo "|-! Make targets:|9 !|o"
|
|
192
|
+
\t@echo "|-!|23 !|o"
|
|
193
|
+
\t@echo "|-! |g|[wrench]|n |Cbuild|n|14 !|o"
|
|
194
|
+
\t@echo "|-! |B|[droplet]|n |Cclean|n|14 !|o"
|
|
195
|
+
\t@echo "|-! |s|[nut and bolt]|n |Cinstall|n|12 !|o"
|
|
196
|
+
\t@echo "|-! |m|[counterclockwise arrows button]|n |Ctest|n|15 !|o"
|
|
197
|
+
\t@echo "|-{|23-}|o"
|
|
171
198
|
END_OF_STRING
|
|
172
199
|
@output << "\n"
|
|
173
200
|
@output << @pipe.pipetext(menu_target)
|
|
174
201
|
|
|
175
202
|
default_target = <<-END_OF_STRING
|
|
176
203
|
default :
|
|
177
|
-
@clear
|
|
178
204
|
END_OF_STRING
|
|
179
205
|
|
|
180
206
|
@applications.each do |app|
|
|
181
207
|
execute_target = <<-END_OF_STRING
|
|
182
208
|
\t@echo "|-[|50-]|o"
|
|
183
|
-
\t@echo "
|
|
209
|
+
\t@echo "|-! |g|[wrench] |nBuilding executable: |g#{app[0]}|n|17 !|o"
|
|
184
210
|
\t@echo "|-{|50-}|o"
|
|
185
211
|
\t@$(MAKE) #{app[0]}
|
|
186
212
|
END_OF_STRING
|
|
@@ -192,13 +218,12 @@ end
|
|
|
192
218
|
|
|
193
219
|
build_target = <<-END_OF_STRING
|
|
194
220
|
build :
|
|
195
|
-
@clear
|
|
196
221
|
END_OF_STRING
|
|
197
222
|
|
|
198
223
|
@applications.each do |app|
|
|
199
224
|
execute_target = <<-END_OF_STRING
|
|
200
225
|
\t@echo "|-[|50-]|o"
|
|
201
|
-
\t@echo "
|
|
226
|
+
\t@echo "|-! |g|[wrench] |nBuilding executable: |g#{app[0]}|n|17 !|o"
|
|
202
227
|
\t@echo "|-{|50-}|o"
|
|
203
228
|
\t@$(MAKE) #{app[0]}
|
|
204
229
|
END_OF_STRING
|
|
@@ -220,7 +245,7 @@ def add_dependencies(filename, path)
|
|
|
220
245
|
dependency_targets = <<-END_OF_STRING
|
|
221
246
|
# Dependencies
|
|
222
247
|
$(OBJECT)#{path}#{filename.sub(/\.cp?p?$/, '.o')} : $(SOURCE)#{path}#{filename}#{dependencies}
|
|
223
|
-
\t@echo "|=!|O |R|[fire]|n Compiling... |
|
|
248
|
+
\t@echo "|=!|O |R|[fire]|n Compiling... |Y$(OBJECT)#{path}#{filename.sub(/\.cp?p?$/, '.o')}|n"
|
|
224
249
|
ifeq '$(OS)' 'Linux'
|
|
225
250
|
\t@mkdir -p $(OBJECT)#{path}
|
|
226
251
|
else
|
|
@@ -266,14 +291,14 @@ counter = 0
|
|
|
266
291
|
execute_target = <<-END_OF_STRING
|
|
267
292
|
#{app[0]} : $(OL#{counter})
|
|
268
293
|
\t@echo "|-[|50-]|o"
|
|
269
|
-
\t@echo "
|
|
294
|
+
\t@echo "|-! |B|[link]|n Linking Files... |g#{app[0]}|n|21 !|o"
|
|
270
295
|
\t@echo "|-{|50-}|o"
|
|
271
296
|
ifeq '$(OS)' 'Linux'
|
|
272
297
|
\t@mkdir -p $(BINARY)
|
|
273
298
|
else
|
|
274
299
|
\t@if not exist $(BINARY) @mkdir $(BINARY)
|
|
275
300
|
endif
|
|
276
|
-
\t$(CC) $(LIBS) -o $(BINARY)/#{app[0]} $(OL#{counter})#{@raw_binary_files}
|
|
301
|
+
\t$(CC) $(CFLAGS) $(LIBS) -o $(BINARY)/#{app[0]} $(OL#{counter})#{@raw_binary_files}
|
|
277
302
|
END_OF_STRING
|
|
278
303
|
@output << "\n"
|
|
279
304
|
@output << @pipe.pipetext(execute_target)
|
|
@@ -282,7 +307,7 @@ end
|
|
|
282
307
|
dependency_targets = <<-END_OF_STRING
|
|
283
308
|
# General Auto-Dependencies
|
|
284
309
|
$(OBJECT)/%.o : $(SOURCE)/%.c
|
|
285
|
-
\t@echo "|=!|o |R|[fire]|n Compiling... |
|
|
310
|
+
\t@echo "|=!|o |R|[fire]|n Compiling... |Y$(@)|n"
|
|
286
311
|
ifeq '$(OS)' 'Linux'
|
|
287
312
|
\t@mkdir -p $(BINARY)
|
|
288
313
|
\t@mkdir -p $(OBJECT)
|
|
@@ -310,7 +335,7 @@ END_OF_STRING
|
|
|
310
335
|
|
|
311
336
|
test_target = <<-END_OF_STRING
|
|
312
337
|
test :
|
|
313
|
-
\t@echo "|m|[counterclockwise arrows button]|n
|
|
338
|
+
\t@echo -n "|m|[counterclockwise arrows button]|n Running tests"
|
|
314
339
|
END_OF_STRING
|
|
315
340
|
begin
|
|
316
341
|
code = File.open('demake/test-target.rb').read
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: demake
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Minaswan Nakamoto
|
|
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - ">="
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
89
|
+
version: 1.8.7
|
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
requirements:
|
|
92
92
|
- - ">="
|