|
1
|
# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/ |
|
2
|
# All rights reserved |
|
3
|
|
|
4
|
# @synopsis: |
|
5
|
# |
|
6
|
# The 'tmake' module makes it easy to support the tmake build system. |
|
7
|
# |
|
8
|
# The following variables are set: |
|
9
|
# |
|
10
|
## CONFIGURED - to indicate that the project is configured |
|
11
|
|
|
12
|
use system |
|
13
|
|
|
14
|
options {} |
|
15
|
|
|
16
|
define CONFIGURED |
|
17
|
|
|
18
|
# @make-tmake-settings outfile patterns ... |
|
19
|
# |
|
20
|
# Examines all defined variables which match the given patterns (defaults to '*') |
|
21
|
# and writes a tmake-compatible .conf file defining those variables. |
|
22
|
# For example, if 'ABC' is '"3 monkeys"' and 'ABC' matches a pattern, then the file will include: |
|
23
|
# |
|
24
|
## define ABC {3 monkeys} |
|
25
|
# |
|
26
|
# If the file would be unchanged, it is not written. |
|
27
|
# |
|
28
|
# Typical usage is: |
|
29
|
# |
|
30
|
## make-tmake-settings [get-env BUILDDIR objdir]/settings.conf {[A-Z]*} |
|
31
|
proc make-tmake-settings {file args} { |
|
32
|
file mkdir [file dirname $file] |
|
33
|
set lines {} |
|
34
|
|
|
35
|
if {[llength $args] == 0} { |
|
36
|
set args * |
|
37
|
} |
|
38
|
|
|
39
|
foreach n [lsort [dict keys [all-defines]]] { |
|
40
|
foreach p $args { |
|
41
|
if {[string match $p $n]} { |
|
42
|
set value [get-define $n] |
|
43
|
lappend lines "define $n [list $value]" |
|
44
|
break |
|
45
|
} |
|
46
|
} |
|
47
|
} |
|
48
|
set buf [join $lines \n] |
|
49
|
write-if-changed $file $buf { |
|
50
|
msg-result "Created $file" |
|
51
|
} |
|
52
|
} |
|
53
|
|