Menu

[r3]: / cmp / TMakeLib / CctMake.tcl  Maximize  Restore  History

Download this file

150 lines (124 with data), 4.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
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
##
## Cct - ::CctMake
##
## (C) IPN - Ingenieurbuero fuer Praezisionsnumerik
##
## Dipl.-Ing. Andreas Otto
## Ulmenstrasse 3
## D-34289 Zierenberg
## mailto:aotto@t-online.de
## http://tclcompiler.sourceforge.net
##
## Alle Rechte vorbehalten
##
namespace eval ::CctMake {}
proc ::CctMake::Cfg {} {
return [ list 1 {interface to the make tool} ]
}
if {[ info exists COMPILER_CCT_CFG ]} return
PkgProvide CctMake
package require Cct
package require CctCmd
package require Config
package require ITMakeLib
proc ::CctMake::ErrorN { args } {
lappend args {try "cct -h" or "cct make -h" for additional help}
::StdLib::ErrorN {BRASE ERROR} $args
}
##
## -------------------------------------------------------
## Pkg
##
namespace eval ::CctMake::Args {
variable ARGS_DEFAULT {-d 0 -k 0 -s 1 -v 0 -n 0 -ve 0 -p 0 -tgt {NOT SET} -equ {{NOT SET}} -f {package TMakeLib} --list 0}
variable VALUE
variable ARGS
array set ARGS {
-d {SetFlag CctMake -d}
-k {SetFlag CctMake -k}
-s {SetFlag CctMake -s}
-v {SetFlag CctMake -v}
-n {SetFlag CctMake -n}
-ve {SetFlag CctMake -ve}
-p {SetFlag CctMake -p}
--list {SetFlag CctMake --list}
-h ::CctMake::Args::Help
--help ::CctMake::Args::Help
}
namespace import ::Args::*
}
proc ::CctMake::Args::Help {} {
EnvRead CctMake
global argv0 VERSION VERDATE
::StdLib::StdErr "\nusage: cct \[master option ...\] make \[user-option ...\] \[--\] \[var=value]\ \[target ...\]"
::StdLib::StdErr ""
::StdLib::StdErr " construct files based on a rule-file"
::StdLib::StdErr " brasfile - rule-file to use (defaults: Brasfile or brasfile)"
::StdLib::StdErr ""
Print-Flag CctMake -d "show reasoning in addition to normal processing"
Print-Flag CctMake -k "continue as much as possible after an error"
Print-Flag CctMake -n "don't execute any commands (implies -v)"
Print-Flag CctMake -p "print database of rules, then exit"
Print-Flag CctMake -s "don't show anything except error messages"
Print-Flag CctMake -v "show all commands to be executed"
Print-Flag CctMake -ve "use verbose version of exec"
Print-Flag CctMake --list "list all (cct -a pkg --list) packages"
Print-Cmd %MASTER% Default
::StdLib::StdErr {
additional informations :
-- use the rest of the command-line as target list
(necessary, if a target starts with `-')
var=value just before starting to read brasfiles, element var of
the global array env is set to value
target target to be rebuilt (default: the target of the first
rule in brasfile)
}
exit 1
}
proc ::CctMake::Args::Main {} {
set FLAG 1
while {1} {
set Val [ GetArg ]
if {[ string equal $Val %%NO%% ]} break
if {[string match *=* $Val]} {
AppendVal CctMake -equ $Val
} else {
AppendVal CctMake -tgt $Val
}
if {$FLAG && [ IsOpt CctMake $Val ]} {
Test-Opt CctMake $Val
Invoke CctMake $Val
} else {
AppendVal CctMake -tgt $Val
}
}
EnvRead CctMake
}
##
## -------------------------------------------------------
##
proc ::CctMake::Main {} {
global errorInfo
upvar 0 Args::VALUE VALUE
## read the configuration
::Config::Main project.cct
## get the names
::Args::Test-NOT-SET %MASTER% -t
set Names [ FilterList [ ::Config::Query PACKAGE ] [ ::Args::GetVal %MASTER% -t ] ]
## list all names
if { $VALUE(--list) } {
puts $Names
exit 0
}
## does packages are available ?
if {[::CctCmd::NoPkgFound $Names]} return
## loop
::StdLib::Push STDIN stdin STDOUT stdout STDERR stderr ERROR EXIT
foreach Name $Names {
puts "\n\n working on package \"$Name\""
::Env::Set CMP_CONFIG $Name
if {$VALUE(-tgt) == {NOT SET}} { set VALUE(-tgt) help }
::ITMake::Exec [ array get VALUE ]
}
::StdLib::Pop STDIN STDOUT STDERR ERROR
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.