tcltest: do a better job of cleanup up after tests
[jimtcl.git] / autosetup / tmake.tcl
blobb9463628b5188ba9027fe659aba4addd8066cadd
1 # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
2 # All rights reserved
4 # @synopsis:
6 # The 'tmake' module makes it easy to support the tmake build system.
8 # The following variables are set:
10 ## CONFIGURED - to indicate that the project is configured
12 use system
14 module-options {}
16 define CONFIGURED
18 # @make-tmake-settings outfile patterns ...
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:
24 ## define ABC {3 monkeys}
26 # If the file would be unchanged, it is not written.
28 # Typical usage is:
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 {}
35 if {[llength $args] == 0} {
36 set args *
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
48 set buf [join $lines \n]
49 write-if-changed $file $buf {
50 msg-result "Created $file"