-;#\r
-;# Open source Tcl utilities. This contains material to automatically create\r
-;# MS project or automake builders from the OpenCascade modules definition.\r
-;# This file requires:\r
-;# 1. Tcl utilities of Wok.\r
-;# 2. Wok commands and workbench environment.\r
-;#\r
-;# Author: yolanda_forbes@hotmail.com\r
-;# \r
-;# (((((((((((((((((((((((( MS PROJECT )))))))))))))))))))))))\r
-;#\r
-;# the full path of a MS project template file.\r
-;# Should be overwritten\r
-;#\r
-proc osutils:vc8:readtemplate { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc8]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:vc8:readtemplatex { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc8x]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:vc7:readtemplate { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc7]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:vc7:readtemplatex { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc7x]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:vc6:readtemplate { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc6 ]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:vc6:readtemplatex { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc6x]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:mak:readtemplate { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.mak ]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:mak:readtemplatex { } {\r
- puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.makx]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-}\r
-proc osutils:am:readtemplate { } {\r
- puts stderr "Info : readtemplate : Template for Makefile.am from [set loc [woklocate -p WOKTclLib:source:template.mam]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-\r
-}\r
-proc osutils:am:readtemplatex { } {\r
- puts stderr "Info : readtemplatex : Template for Makefile.am from [set loc [woklocate -p WOKTclLib:source:template.mamx]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-\r
-}\r
-proc osutils:in:readtemplate { } {\r
- puts stderr "Info : readtemplate : Template for Makefile.in from [set loc [woklocate -p WOKTclLib:source:template.min]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-\r
-}\r
-proc osutils:in:readtemplatex { } {\r
- puts stderr "Info : readtemplatex : Template for Makefile.in from [set loc [woklocate -p WOKTclLib:source:template.minx]]"\r
- return [wokUtils:FILES:FileToString $loc]\r
-\r
-}\r
-;#\r
-;# \r
-;#\r
-proc osutils:vc6proj:header { } {\r
- append var \\r
- "Microsoft Developer Studio Workspace File, Format Version 6.00" "\n" \\r
- "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!" "\n" \\r
- "\n" \\r
- "###############################################################################" "\n" \\r
- "\n"\r
- return $var\r
-}\r
-proc osutils:vc7proj:header { } {\r
- append var \\r
- "Microsoft Visual Studio Solution File, Format Version 8.00\n" \r
- return $var\r
-}\r
-proc osutils:vc8proj:header { } {\r
- append var \\r
- "Microsoft Visual Studio Solution File, Format Version 9.00\n" \\r
- "# Visual Studio 2005\n"\r
- return $var\r
-}\r
-;#\r
-;# the leaf of a workspace file\r
-;#\r
-proc osutils:vc6proj:projectleaf { TK } {\r
- append var \\r
- "Project: \"$TK\"=.\\$TK.dsp - Package Owner=<4>" "\n" \\r
- "\n" \\r
- "Package=<5>" "\n" \\r
- "\{\{\{" "\n" \\r
- "\}\}\}" "\n" \\r
- "\n" \\r
- "Package=<4>" "\n" \\r
- "\{\{\{" "\n" \\r
- "\}\}\}" "\n" \\r
- "\n" \\r
- "###############################################################################" "\n" \\r
- "\n"\r
- return $var\r
-}\r
-;#\r
-;# an item of a workspace file\r
-;#\r
-proc osutils:vc6proj:projectby2 { TK Dep_Name } {\r
- append var \\r
- "Project: \"$TK\"=.\\$TK.dsp - Package Owner=<4>" "\n" \\r
- "\n" \\r
- "Package=<5>" "\n" \\r
- "\{\{\{" "\n" \\r
- "\}\}\}" "\n" \\r
- "\n" \\r
- "Package=<4>" "\n" \\r
- "\{\{\{" "\n" \r
- if {[wokinfo -x $TK] != "0"} {\r
- if {[uinfo -t $TK] == "toolkit"} {\r
- set deplist [LibToLink $TK]\r
- } else {\r
- set deplist [LibToLinkX $TK $TK]\r
- ;#puts $deplist\r
- }\r
- foreach deplib $deplist {\r
- if {$deplib != $TK} {\r
- append var " Begin Project Dependency" "\n" \\r
- " Project_Dep_Name $deplib" "\n" \\r
- " End Project Dependency" "\n" \r
- }\r
- }\r
- }\r
- \r
- append var "\}\}\}" "\n" \\r
- "\n" \\r
- "###############################################################################" "\n" \\r
- "\n" \r
- return $var\r
-}\r
-;#\r
-;#\r
-;#\r
-proc osutils:vc6proj:footer { } {\r
- append var \\r
- "Global:" "\n" \\r
- "\n" \\r
- "Package=<5>" "\n" \\r
- "{{{" "\n" \\r
- "}}}" "\n" \\r
- "\n" \\r
- "Package=<3>" "\n" \\r
- "{{{" "\n" \\r
- "}}}" "\n" \\r
- "\n" \\r
- "###############################################################################" "\n" \r
- return $var\r
-}\r
-;#\r
-;# An item for compiling a c++ class\r
-;#\r
-proc osutils:vc6:fmtcpp { } {\r
- return {# ADD CPP /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}\r
-}\r
-proc osutils:mak:fmtcpp { } {\r
- return {CPP_SWITCHES=$(CPP_PROJ) /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}\r
-}\r
-;#\r
-;# An item for compiling a c++ main\r
-;#\r
-proc osutils:vc6:fmtcppx { } {\r
- return {# ADD CPP /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}\r
-}\r
-proc osutils:vc7:fmtcpp { } {\r
- return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"\r
- PreprocessorDefinitions="__%s_DLL;"}\r
-}\r
-proc osutils:vc7:fmtcppx { } {\r
- return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"\r
- PreprocessorDefinitions="__%s_DLL;$(NoInherit)"}\r
-}\r
-proc osutils:vc8:fmtcpp { } {\r
- return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"\r
- PreprocessorDefinitions="__%s_DLL;"}\r
-}\r
-proc osutils:vc8:fmtcppx { } {\r
- return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"\r
- PreprocessorDefinitions="__%s_DLL;$(NoInherit)"}\r
-}\r
-proc osutils:mak:fmtcppx { } {\r
- return {CPP_SWITCHES=$(CPP_PROJ) /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}\r
-}\r
-;#\r
-;# List extensions of files devoted to be eaten by cl.exe compiler.\r
-;#\r
-proc osutils:vc6:compilable { } {\r
- return [list .c .cxx .cpp]\r
-}\r
-proc osutils:vc7:compilable { } {\r
- return [list .c .cxx .cpp]\r
-}\r
-proc osutils:vc8:compilable { } {\r
- return [list .c .cxx .cpp]\r
-}\r
-;#\r
-;# remove from listloc OpenCascade units indesirables on NT\r
-;#\r
-proc osutils:juststation {goaway listloc} {\r
- set lret {}\r
- foreach u $listloc {\r
- if { \r
- (\r
- [woklocate -u $u] != ""\r
- &&\r
- [lsearch $goaway [wokinfo -n [woklocate -u $u]]] == -1\r
- )\r
- ||\r
- (\r
- [woklocate -u $u] == ""\r
- &&\r
- [lsearch $goaway [wokinfo -n $u]] == -1\r
- )\r
- \r
- } {\r
- lappend lret $u\r
- }\r
- }\r
- return $lret \r
-}\r
-\r
-proc osutils:justwnt { listloc } {\r
- set goaway [list Xdps Xw ImageUtility WOKUnix]\r
- return [osutils:juststation $goaway $listloc]\r
-}\r
-;#\r
-;# remove from listloc OpenCascade units indesirables on Unix\r
-;#\r
-proc osutils:justunix { listloc } {\r
- set goaway [list WNT WOKNT]\r
- return [osutils:juststation $goaway $listloc]\r
-}\r
-;#\r
-;# Define libraries to link\r
-proc LibToLink {tkit} {\r
- if {[uinfo -t $tkit] == "toolkit"} {\r
- set l {}\r
- set LibList [woklocate -p [wokinfo -n $tkit]:stadmfile:[wokinfo -n $tkit]_lib_tks.Out]\r
- if ![ catch { set id [ open $LibList r ] } status ] {\r
- while {[gets $id x] >= 0 } {\r
- if [regexp -- {(-E[^ ]*)} $x] {\r
- set endnameid [expr { [string wordend $x 4] -1 }]\r
- set fx [string range $x 3 $endnameid]\r
- if {[uinfo -t [woklocate -u [file rootname $fx]]] == "toolkit"} { \r
- lappend l $fx\r
- }\r
- }\r
- #if [regexp -- {(-VE[^ ]*)} $x] {\r
- # set startid [string first CSF $x]\r
- # set endid [ expr { [string wordend $x $startid] -1 } ]\r
- # set fx [string range $x $startid $endid]\r
- # lappend l $fx\r
- #}\r
-\r
- }\r
- close $id\r
- } else {\r
- puts $status\r
- }\r
- return $l\r
- }\r
-}\r
-\r
-proc LibToLinkX {tkit name} {\r
- if {[uinfo -t $tkit] == "executable"} {\r
- set l {}\r
- set LibList [woklocate -p [wokinfo -n $tkit]:stadmfile:[wokinfo -n $tkit]_exec_tks_${name}.Out]\r
- if ![ catch { set id [ open $LibList r ] } status ] {\r
- while {[gets $id x] >= 0 } {\r
- if [regexp -- {(-E[^ ]*)} $x] {\r
- if {[regexp -- {library} $x]} {\r
- set endnameid [expr { [string wordend $x 4] -1 }]\r
- set fx [string range $x 3 $endnameid]\r
- lappend l $fx\r
- }\r
- }\r
- #if [regexp -- {(-VE[^ ]*)} $x] {\r
- # set startid [string first CSF $x]\r
- # set endid [ expr { [string wordend $x $startid] -1 } ]\r
- # set CSF_fx [string range $x $startid $endid]\r
- # if { $CSF_fx != "-"} {\r
- # puts $CSF_fx\r
- # set fx [file tail [lindex [wokparam -v \%$CSF_fx $tkit] 0]]\r
- # lappend l $fx\r
- # }\r
- #}\r
-\r
- }\r
- close $id\r
- } else {\r
- puts $status\r
- }\r
- return $l\r
- }\r
-}\r
-\r
-\r
-;#\r
-;# ((((((((WOK toolkits manipulations))))))))\r
-;#\r
-;# close dependencies of ltk. (full wok pathes of toolkits)\r
-;# The CURRENT WOK LOCATION MUST contains ALL TOOLKITS required. \r
-;# (locate not performed.)\r
-proc osutils:tk:close { ltk } {\r
- set result {}\r
- set recurse {}\r
- foreach dir $ltk {\r
- #set ids [woklocate -p [wokinfo -n [wokinfo -u $dir]]:source:EXTERNLIB [wokinfo -w $dir]]\r
- set ids [LibToLink $dir]\r
- set eated [osutils:tk:eatpk $ids]\r
- set result [concat $result $eated]\r
- set ids [LibToLink $dir]\r
- set result [concat $result $ids]\r
- #puts "EXTERNLIB dir = $dir ids = $ids result = $result eated = $eated"\r
- foreach file $eated {\r
- set kds [woklocate -p [wokinfo -n [wokinfo -u $file]]:source:EXTERNLIB [wokinfo -w $file]]\r
- if { [osutils:tk:eatpk $kds] != {} } {\r
- lappend recurse $file\r
- }\r
- }\r
- }\r
- ;# if ![lempty $recurse] {\r
- ;# set result [concat $result [osutils:tk:close $recurse]]\r
- ;# }\r
- if { $recurse != {} } {\r
- set result [concat $result [osutils:tk:close $recurse]]\r
- }\r
- #puts $result\r
- return $result\r
-}\r
-;#\r
-;# Topological sort of toolkits in tklm\r
-;#\r
-proc osutils:tk:sort { tklm } {\r
- set tkby2 {}\r
- foreach tkloc $tklm {\r
- set lprg [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]\r
- foreach tkx $lprg {\r
- if { [lsearch $tklm $tkx] != -1 } {\r
- lappend tkby2 [list $tkx $tkloc]\r
- } else {\r
- lappend tkby2 [list $tkloc {}]\r
- }\r
- }\r
- }\r
- set lret {}\r
- foreach e [wokUtils:EASY:tsort $tkby2] {\r
- if { $e != {} } {\r
- lappend lret $e\r
- }\r
- }\r
- return $lret\r
-}\r
-\r
-;#\r
-;# Returns liste of UD in a toolkit. tkloc is a full path wok.\r
-;# \r
-proc osutils:tk:units { tkloc {typed 0} } {\r
- set l {}\r
- set PACKAGES [woklocate -p [wokinfo -n [wokinfo -u $tkloc]]:source:PACKAGES [wokinfo -w $tkloc]]\r
- foreach u [wokUtils:FILES:FileToList $PACKAGES] {\r
- set fu [woklocate -u $u]\r
- if { [set fu [woklocate -u $u]] != {} } {\r
- if { $typed == 0 } {\r
- lappend l $fu\r
- } \r
- if { $typed == 1 } {\r
- lappend l [list [uinfo -c $fu] [wokinfo -n $fu]]\r
- }\r
- if { $typed == 2 } {\r
- lappend l [list [uinfo -c $fu] $fu]\r
- }\r
- if { $typed == 3 } {\r
- lappend l [list [uinfo -t $fu] [wokinfo -n $fu]]\r
- }\r
- if { $typed == 4 } {\r
- lappend l [list [uinfo -t $fu] $fu]\r
- }\r
- } else {\r
- puts stderr "Unit inconnue $u"\r
- }\r
- }\r
- if { $l == {} } {\r
- ;#puts stderr "Warning. No devunit included in $tkloc"\r
- }\r
- return $l\r
-}\r
-;#\r
-;# for a unit returns a map containing all its file in the current\r
-;# workbench\r
-;# local = 1 only local files\r
-;#\r
-proc osutils:tk:loadunit { loc map {local 0}} {\r
- upvar $map TLOC\r
- catch { unset TLOC }\r
- if { $local == 1 } {\r
- set lfiles [uinfo -Fpl $loc]\r
- } else {\r
- set lfiles [uinfo -Fp $loc]\r
- }\r
- foreach f $lfiles { \r
- #puts $f\r
- set t [lindex $f 0]\r
- set p [lindex $f 2]\r
- if [info exists TLOC($t)] {\r
- set l $TLOC($t)\r
- lappend l $p\r
- set TLOC($t) $l\r
- } else {\r
- set TLOC($t) $p\r
- }\r
- }\r
- return\r
-}\r
-;#\r
-;# Returns the list of all compilable files name in a toolkit, or devunit of any type\r
-;# Call unit filter on units name to accept or reject a unit\r
-;# Tfiles lists for each unit the type of file that can be compiled.\r
-;#\r
-proc osutils:tk:files { tkloc {l_compilable {} } {justail 1} {unitfilter {}} } {\r
- set Tfiles(source,package) {source derivated privinclude pubinclude drvfile}\r
- set Tfiles(source,nocdlpack) {source pubinclude drvfile}\r
- set Tfiles(source,schema) {source derivated privinclude pubinclude drvfile}\r
- set Tfiles(source,toolkit) {}\r
- set Tfiles(source,executable) {source pubinclude drvfile}\r
- set listloc [concat [osutils:tk:units [woklocate -u $tkloc]] [woklocate -u $tkloc]]\r
- #puts " listloc = $listloc"\r
- if { $l_compilable == {} } {\r
- set l_comp [list .c .cxx .cpp]\r
- } else {\r
- set l_comp [$l_compilable]\r
- }\r
- if { $unitfilter == {} } {\r
- set resultloc $listloc\r
- } else {\r
- set resultloc [$unitfilter $listloc]\r
- }\r
- set lret {}\r
- foreach loc $resultloc {\r
- set utyp [uinfo -t $loc]\r
- if [array exists map] { unset map } \r
- osutils:tk:loadunit $loc map\r
- #puts " loc = $loc === > [array names map]"\r
- set LType $Tfiles(source,${utyp})\r
- foreach typ [array names map] {\r
- if { [lsearch $LType $typ] == -1 } {\r
- unset map($typ)\r
- }\r
- }\r
- foreach type [array names map] {\r
- #puts $type\r
- foreach f $map($type) {\r
- #puts $f\r
- if { [lsearch $l_comp [file extension $f]] != -1 } {\r
- if { $justail == 1 } {\r
- if {$type == "source"} {\r
- if {[lsearch $lret "@top_srcdir@/drv/[wokinfo -n $loc]/[file tail $f]"] == -1} {\r
- lappend lret @top_srcdir@/src/[wokinfo -n $loc]/[file tail $f]\r
- }\r
- } elseif {$type == "derivated" || $type == "drvfile"} {\r
- if {[lsearch $lret "@top_srcdir@/src/[wokinfo -n $loc]/[file tail $f]"] == -1} {\r
- lappend lret @top_srcdir@/drv/[wokinfo -n $loc]/[file tail $f]\r
- }\r
- }\r
- } else {\r
- lappend lret $f\r
- }\r
- }\r
- }\r
- }\r
- }\r
- return $lret\r
-}\r
-;#\r
-;# \r
-;#\r
-proc osutils:tk:eatpk { EXTERNLIB } {\r
- set l [wokUtils:FILES:FileToList $EXTERNLIB]\r
- set lret {}\r
- foreach str $l {\r
- if ![regexp -- {(CSF_[^ ]*)} $str csf] {\r
- lappend lret $str\r
- }\r
- }\r
- return $lret\r
-}\r
-;#\r
-;# Return the list of name *CSF_ in a EXTERNLIB description of a toolkit\r
-;#\r
-proc osutils:tk:hascsf { EXTERNLIB } {\r
- set l [wokUtils:FILES:FileToList $EXTERNLIB]\r
- set lret {STLPort}\r
- foreach str $l {\r
- if [regexp -- {(CSF_[^ ]*)} $str csf] {\r
- lappend lret $csf\r
- }\r
- }\r
- return $lret\r
-}\r
-;#\r
-;# Create file tkloc.dsp for a shareable library (dll).\r
-;# in dir return the full path of the created file\r
-;#\r
-proc osutils:vc6 { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- if { $tmplat == {} } {set tmplat [osutils:vc6:readtemplate]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:vc6:fmtcpp]}\r
- set fp [open [set fdsp [file join $dir ${tkloc}.dsp]] w]\r
- fconfigure $fp -translation crlf\r
- set l_compilable [osutils:vc6:compilable]\r
- regsub -all -- {__TKNAM__} $tmplat $tkloc temp0\r
- set tkused ""\r
- foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {\r
- append tkused "${tkx}.lib "\r
- }\r
- foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] $tkloc] {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set felem [file tail [lindex [wokparam -v "%$element"] 0]]\r
- if {[lsearch $tkused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- set tkused [concat $tkused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
-\r
- #puts "alternative [LibToLink $tkloc]"\r
- puts "$tkloc requires $tkused"\r
- regsub -all -- {__TKDEP__} $temp0 $tkused temp1\r
- set files ""\r
- ;#set listloc [concat [osutils:tk:units [woklocate -u $tkloc]] [woklocate -u $tkloc]]\r
- set listloc [osutils:tk:units [woklocate -u $tkloc]]\r
- set resultloc [osutils:justwnt $listloc]\r
- ;#puts "result = $resultloc"\r
- ;#set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justwnt]]\r
- if [array exists written] { unset written }\r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo]\r
- append files "# Begin Group \"${xlo}\"" "\n" \r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
- set fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]\r
- set fxloparam "$fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]"\r
- set needparam ""\r
- foreach partopt $fxloparam {\r
- if { "-I[lindex [wokparam -v %CSF_TCL_INCLUDE] 0]" != "$partopt "} {\r
- if { "-I[lindex [wokparam -v %CSF_JAVA_INCLUDE] 0]" != "$partopt "} {\r
- set needparam "$needparam $partopt"\r
- }\r
- }\r
- }\r
- foreach f $lsrc {\r
- ;#puts " f = $f"\r
- if { ![info exists written([file tail $f])] } {\r
- set written([file tail $f]) 1\r
- append files "# Begin Source File" "\n"\r
- append files "SOURCE=..\\..\\..\\" [wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]] "\n"\r
- append files [format $fmtcpp $xlo $xlo $xlo] "$needparam" "\n"\r
- append files "# End Source File" "\n"\r
- } else {\r
- puts "Warning : in dsp more than one occurences for [file tail $f]"\r
- }\r
- }\r
- append files "# End Group" "\n"\r
- }\r
- \r
- regsub -all -- {__FILES__} $temp1 $files temp2\r
- puts $fp $temp2\r
- close $fp\r
- return $fdsp\r
-}\r
-proc osutils:vc7 { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- if { $tmplat == {} } {set tmplat [osutils:vc7:readtemplate]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:vc7:fmtcpp]}\r
- set fp [open [set fvcproj [file join $dir ${tkloc}.vcproj]] w]\r
- fconfigure $fp -translation crlf\r
- set l_compilable [osutils:vc7:compilable]\r
- regsub -all -- {__TKNAM__} $tmplat $tkloc temp0\r
- set tkused ""\r
- foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {\r
- append tkused "${tkx}.lib "\r
- }\r
- foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] $tkloc] {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set felem [file tail [lindex [wokparam -v "%$element"] 0]]\r
- if {[lsearch $tkused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- set tkused [concat $tkused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
-\r
- puts "$tkloc requires $tkused"\r
- regsub -all -- {__TKDEP__} $temp0 $tkused temp1\r
- set files ""\r
- set listloc [osutils:tk:units [woklocate -u $tkloc]]\r
- set resultloc [osutils:justwnt $listloc]\r
- if [array exists written] { unset written }\r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo] \r
- append files " <Filter\n"\r
- append files " Name=\"${xlo}\"\n"\r
- append files " Filter=\"\">\n"\r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
- set fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]\r
- set fxloparam "$fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]"\r
- set needparam ""\r
- foreach partopt $fxloparam {\r
- if { "-I[lindex [wokparam -v %CSF_TCL_INCLUDE] 0]" != "$partopt "} {\r
- if { "-I[lindex [wokparam -v %CSF_JAVA_INCLUDE] 0]" != "$partopt "} {\r
- set needparam "$needparam $partopt"\r
- }\r
- }\r
- }\r
- foreach f $lsrc {\r
- #puts " f = $f"\r
- if { ![info exists written([file tail $f])] } {\r
- set written([file tail $f]) 1\r
- append files "\t\t\t\t<File\n"\r
- append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Debug\|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- if {$needparam != ""} {\r
- append files "\t\t\t\t\t\t\tAdditionalOptions=\""\r
- foreach paramm $needparam {\r
- append files "$paramm "\r
- }\r
- append files "\"\n"\r
- }\r
- append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Release\|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- if {$needparam != ""} {\r
- append files "\t\t\t\t\t\t\tAdditionalOptions=\""\r
- foreach paramm $needparam {\r
- append files "$paramm "\r
- }\r
- append files "\"\n"\r
- }\r
- append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t</File>\n"\r
- } else {\r
- puts "Warning : in vcproj more than one occurences for [file tail $f]"\r
- }\r
- }\r
- append files "\t\t\t</Filter>"\r
- }\r
- \r
- regsub -all -- {__FILES__} $temp1 $files temp2\r
- puts $fp $temp2\r
- close $fp\r
- return $fvcproj\r
-}\r
-proc osutils:vc8 { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- if { $tmplat == {} } {set tmplat [osutils:vc8:readtemplate]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:vc8:fmtcpp]}\r
- set fp [open [set fvcproj [file join $dir ${tkloc}.vcproj]] w]\r
- fconfigure $fp -translation crlf\r
- set l_compilable [osutils:vc8:compilable]\r
- regsub -all -- {__TKNAM__} $tmplat $tkloc temp0\r
- set tkused ""\r
- foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {\r
- append tkused "${tkx}.lib "\r
- }\r
- foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] $tkloc] {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set felem [file tail [lindex [wokparam -v "%$element"] 0]]\r
- if {[lsearch $tkused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- set tkused [concat $tkused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
-\r
- puts "$tkloc requires $tkused"\r
- regsub -all -- {__TKDEP__} $temp0 $tkused temp1\r
- set files ""\r
- set listloc [osutils:tk:units [woklocate -u $tkloc]]\r
- set resultloc [osutils:justwnt $listloc]\r
- if [array exists written] { unset written }\r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo] \r
- append files " <Filter\n"\r
- append files " Name=\"${xlo}\"\n"\r
- append files " Filter=\"\">\n"\r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
- set fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]\r
- set fxloparam "$fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]"\r
- set needparam ""\r
- foreach partopt $fxloparam {\r
- if { "-I[lindex [wokparam -v %CSF_TCL_INCLUDE] 0]" != "$partopt "} {\r
- if { "-I[lindex [wokparam -v %CSF_JAVA_INCLUDE] 0]" != "$partopt "} {\r
- set needparam "$needparam $partopt"\r
- }\r
- }\r
- }\r
- foreach f $lsrc {\r
- #puts " f = $f"\r
- if { ![info exists written([file tail $f])] } {\r
- set written([file tail $f]) 1\r
- append files "\t\t\t\t<File\n"\r
- append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Debug\|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- if {$needparam != ""} {\r
- append files "\t\t\t\t\t\t\tAdditionalOptions=\""\r
- foreach paramm $needparam {\r
- append files "$paramm "\r
- }\r
- append files "\"\n"\r
- }\r
- append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Release\|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- if {$needparam != ""} {\r
- append files "\t\t\t\t\t\t\tAdditionalOptions=\""\r
- foreach paramm $needparam {\r
- append files "$paramm "\r
- }\r
- append files "\"\n"\r
- }\r
- append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t</File>\n"\r
- } else {\r
- puts "Warning : in vcproj more than one occurences for [file tail $f]"\r
- }\r
- }\r
- append files "\t\t\t</Filter>"\r
- }\r
- \r
- regsub -all -- {__FILES__} $temp1 $files temp2\r
- puts $fp $temp2\r
- close $fp\r
- return $fvcproj\r
-}\r
-;#\r
-;# Create file tkloc.dsp for a executable "console" application\r
-;# in dir return the full path of the created file\r
-;#\r
-proc osutils:vc6x { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- if { $tmplat == {} } {set tmplat [osutils:vc6:readtemplatex]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:vc6:fmtcppx]}\r
- foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {\r
- set tf [file rootname [file tail $f]] \r
- set fp [open [set fdsp [file join $dir ${tf}.dsp]] w]\r
- puts $fdsp\r
- fconfigure $fp -translation crlf\r
- set l_compilable [osutils:vc6:compilable]\r
- regsub -all -- {__XQTNAM__} $tmplat $tf temp0\r
- set tkused ""\r
- puts [LibToLinkX [woklocate -u $tkloc] $tf]\r
- foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {\r
- append tkused "${tkx}.lib "\r
- }\r
-# if {[lsearch [w_info -l] [woklocate -u $tkx]] == "-1"} {\r
-# append tkused "${tkx}.lib "\r
-# }\r
- if {[woklocate -u $tkx] == "" } {\r
- append tkused "${tkx}.lib "\r
- }\r
- }\r
- foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokinfo -N [woklocate -u $tk]]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set elemlist [wokparam -v "%$element"]\r
- set felem [file tail [lindex $elemlist 0]] \r
- if {[lsearch $tkused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- #puts "was found $element $felem" \r
- set tkused [concat $tkused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
- if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)"} { \r
- set tkused [concat $tkused "\/dll"]\r
- }\r
- regsub -all -- {__COMPOPT__} $temp0 "\/MD" temp1 \r
- regsub -all -- {__COMPOPTD__} $temp1 "\/MDd" temp2 \r
- puts "$tf requires $tkused"\r
- regsub -all -- {__TKDEP__} $temp2 $tkused temp3\r
- set files ""\r
- ;#set lsrc [osutils:tk:files $tkloc osutils:am:compilable 0]\r
- ;#foreach f $lsrc {\r
- if { ![info exists written([file tail $f])] } {\r
- set written([file tail $f]) 1\r
- append files "# Begin Group \"" $tkloc "\" \n"\r
- append files "# Begin Source File" "\n"\r
- append files "SOURCE=..\\..\\..\\" [wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]] "\n"\r
- append files [format $fmtcpp $tkloc $tkloc $tkloc] "\n"\r
- append files "# End Source File" "\n"\r
- append files "# End Group" "\n"\r
- } else {\r
- puts "Warning : in dsp more than one occurences for [file tail $f]"\r
- }\r
- ;#}\r
- \r
- regsub -all -- {__FILES__} $temp3 $files temp4\r
- puts $fp $temp4\r
- close $fp\r
- set fout [lappend fout $fdsp]\r
- }\r
- return $fout\r
-}\r
-proc osutils:vc7x { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- if { $tmplat == {} } {set tmplat [osutils:vc7:readtemplatex]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:vc7:fmtcppx]}\r
- set fout {}\r
- foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {\r
- puts "1"\r
- set tf [file rootname [file tail $f]] \r
- set l_compilable [osutils:vc7:compilable]\r
- regsub -all -- {__XQTNAM__} $tmplat $tf temp0\r
- set tkused ""\r
- foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {\r
- append tkused "${tkx}.lib "\r
- }\r
- if {[lsearch [w_info -l] $tkx] == "-1"} {\r
- append tkused "${tkx}.lib "\r
- }\r
- }\r
- foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set elemlist [wokparam -v "%$element"]\r
- set felem [file tail [lindex $elemlist 0]] \r
- if {[lsearch $tkused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- #puts "was found $element $felem" \r
- set tkused [concat $tkused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
- if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)"} { \r
- set tkused [concat $tkused "\/dll"]\r
- set binext 2\r
- } else {\r
- set binext 1\r
- }\r
- #puts "$tf requires $tkused"\r
- regsub -all -- {__TKDEP__} $temp0 $tkused temp3\r
- set files ""\r
- ;#set lsrc [osutils:tk:files $tkloc osutils:am:compilable 0]\r
- ;#foreach f $lsrc {\r
- if { ![info exists written([file tail $f])] } {\r
- set written([file tail $f]) 1\r
- append files "\t\t\t<Filter\n"\r
- append files "\t\t\t\tName=\"$tkloc\"\n"\r
- append files "\t\t\t\tFilter=\"\">\n"\r
- append files "\t\t\t\t<File\n"\r
- append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Debug|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"\r
- append files "\t\t\t\t\t\t\tBasicRuntimeChecks=\"3\"\n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Release|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t</File>\n"\r
- append files "\t\t\t</Filter>\n"\r
- } else {\r
- puts "Warning : in dsp more than one occurences for [file tail $f]"\r
- }\r
- ;#}\r
- #puts "$temp3 $files"\r
- regsub -all -- {__FILES__} $temp3 $files temp4\r
- regsub -all -- {__CONF__} $temp4 $binext temp5\r
- set fp [open [set fdsp [file join $dir ${tf}.vcproj]] w]\r
- fconfigure $fp -translation crlf\r
- \r
- puts $fp $temp5\r
- set fout [lappend fout $fdsp]\r
- close $fp\r
- }\r
- return $fout\r
-}\r
-\r
-proc osutils:vc8x { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- if { $tmplat == {} } {set tmplat [osutils:vc8:readtemplatex]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:vc8:fmtcppx]}\r
- set fout {}\r
- foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {\r
- puts "1"\r
- set tf [file rootname [file tail $f]] \r
- set l_compilable [osutils:vc8:compilable]\r
- regsub -all -- {__XQTNAM__} $tmplat $tf temp0\r
- set tkused ""\r
- foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {\r
- append tkused "${tkx}.lib "\r
- }\r
- if {[lsearch [w_info -l] $tkx] == "-1"} {\r
- append tkused "${tkx}.lib "\r
- }\r
- }\r
- foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set elemlist [wokparam -v "%$element"]\r
- set felem [file tail [lindex $elemlist 0]] \r
- if {[lsearch $tkused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- #puts "was found $element $felem" \r
- set tkused [concat $tkused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
- if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)"} { \r
- set tkused [concat $tkused "\/dll"]\r
- set binext 2\r
- } else {\r
- set binext 1\r
- }\r
- #puts "$tf requires $tkused"\r
- regsub -all -- {__TKDEP__} $temp0 $tkused temp3\r
- set files ""\r
- ;#set lsrc [osutils:tk:files $tkloc osutils:am:compilable 0]\r
- ;#foreach f $lsrc {\r
- if { ![info exists written([file tail $f])] } {\r
- set written([file tail $f]) 1\r
- append files "\t\t\t<Filter\n"\r
- append files "\t\t\t\tName=\"$tkloc\"\n"\r
- append files "\t\t\t\tFilter=\"\">\n"\r
- append files "\t\t\t\t<File\n"\r
- append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Debug|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"\r
- append files "\t\t\t\t\t\t\tBasicRuntimeChecks=\"3\"\n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t\t<FileConfiguration\n"\r
- append files "\t\t\t\t\t\tName=\"Release|Win32\">\n"\r
- append files "\t\t\t\t\t\t<Tool\n"\r
- append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"\r
- append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"\r
- append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"\r
- append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"\r
- append files "\t\t\t\t\t</FileConfiguration>\n"\r
- append files "\t\t\t\t</File>\n"\r
- append files "\t\t\t</Filter>\n"\r
- } else {\r
- puts "Warning : in dsp more than one occurences for [file tail $f]"\r
- }\r
- ;#}\r
- #puts "$temp3 $files"\r
- regsub -all -- {__FILES__} $temp3 $files temp4\r
- regsub -all -- {__CONF__} $temp4 $binext temp5\r
- set fp [open [set fdsp [file join $dir ${tf}.vcproj]] w]\r
- fconfigure $fp -translation crlf\r
- \r
- puts $fp $temp5\r
- set fout [lappend fout $fdsp]\r
- close $fp\r
- }\r
- return $fout\r
-}\r
-\r
-;#\r
-;# Create file tkloc.mak for a shareable library (dll).\r
-;# in dir return the full path of the created file\r
-;#\r
-proc osutils:mkmak { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- puts $tkloc\r
- if { $tmplat == {} } {set tmplat [osutils:mak:readtemplate]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:mak:fmtcpp]}\r
- set fp [open [set fdsp [file join $dir ${tkloc}.mak]] w]\r
- fconfigure $fp -translation crlf\r
- set l_compilable [osutils:vc6:compilable]\r
- set tkused [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]\r
- set listloc [osutils:tk:units [woklocate -u $tkloc]]\r
- set resultloc [osutils:justwnt $listloc]\r
- regsub -all -- {__TKNAM__} $tmplat $tkloc temp0\r
- set area1 ""\r
- append area1 "\!IF \"\$(RECURSE)\" == \"0\" \n"\r
- append area1 "ALL : \"\$(OUTDIR)\\${tkloc}.dll\"\n"\r
- append area1 "\!ELSE\n"\r
- append area1 "ALL : "\r
- if {$tkused != ""} {\r
- foreach tkproj $tkused {\r
- append area1 "\"$tkproj - Win32 Release\" " \r
- }\r
- }\r
- append area1 " \"\$(OUTDIR)\\$tkloc.dll\"\n"\r
- append area1 "\!ENDIF \n"\r
- append area1 "\!IF \"\$(RECURSE)\" == \"1\"\n" \r
- append area1 "CLEAN :"\r
- if {$tkused != ""} {\r
- foreach tkproj $tkused {\r
- append area1 "\"$tkproj - Win32 ReleaseCLEAN\" " \r
- }\r
- }\r
- append area1 "\n" \r
- append area1 "\!ELSE\n" \r
- append area1 "CLEAN :\n"\r
- append area1 "\!ENDIF\n"\r
- set tclused 0\r
- set javaused 0\r
- if [array exists written] { unset written }\r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo]\r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
- set fxlocxxparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]\r
- set fxlocparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]\r
- if {[lsearch [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_TCL_INCLUDE] 0] 0 end]"] != -1} {\r
- set tclused 1\r
- }\r
- if {[lsearch [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_JavaHome]/include 0] 0 end]"] != -1} {\r
- set javaused 1\r
- }\r
- if {[lsearch [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_TCL_INCLUDE] 0] 0 end]"] != -1} {\r
- set tclused 1\r
- }\r
- if {[lsearch [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_JavaHome]/include 0] 0 end]"] != -1} {\r
- set javaused 1\r
- }\r
-\r
- foreach srcfile $lsrc {\r
- if { ![info exists written([file tail $srcfile])] } {\r
- set written([file tail $srcfile]) 1\r
- append area1 "\t-@erase \"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\"\n"\r
- }\r
- }\r
- } \r
- regsub -all -- {__FIELD1__} $temp0 $area1 temp1\r
-\r
- set area2 "LINK32_FLAGS=-nologo -subsystem:windows -dll -incremental:no -machine:IX86 -libpath:\"\$(LIBDIR)\" -implib:\$(LIBDIR)\\$tkloc.lib -out:\$(OUTDIR)\\$tkloc.dll "\r
- set libused ""\r
- foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {\r
- append libused "${tkx}.lib "\r
- }\r
- set ltk [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]\r
- set ltk [lappend ltk $tkloc]\r
- foreach tk $ltk {\r
- foreach element [osutils:tk:hascsf [woklocate -p $tk:source:EXTERNLIB [wokcd]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set felem [file tail [lindex [wokparam -v "%$element"] 0]]\r
- if {[lsearch $libused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- set libused [concat $libused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
- if {$tclused == 1} {\r
- append area2 "-libpath:\"\$(TCLHOME)\\lib\" "\r
- }\r
- \r
- foreach tk $libused {\r
- append area2 "$tk "\r
- }\r
- append area2 "\n"\r
- append area2 "LINK32_OBJS= \\\n"\r
- if [array exists written] { unset written }\r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo]\r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
- foreach srcfile $lsrc {\r
- if { ![info exists written([file tail $srcfile])] } {\r
- set written([file tail $srcfile]) 1\r
- append area2 "\t\"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\" \\\n"\r
- }\r
- }\r
- } \r
- \r
- regsub -all -- {__FIELD2__} $temp1 $area2 temp2\r
- \r
- set area3 ""\r
- append area3 "\!IF \"\$(RECURSE)\" == \"0\" \n"\r
- append area3 "ALL : \"\$(OUTDIR)\\${tkloc}.dll\"\n"\r
- append area3 "\!ELSE\n"\r
- append area3 "ALL : "\r
- if {$tkused != ""} {\r
- foreach tkproj $tkused {\r
- append area3 "\"$tkproj - Win32 Debug\" " \r
- }\r
- }\r
- append area3 " \"\$(OUTDIR)\\$tkloc.dll\"\n"\r
- append area3 "\!ENDIF \n"\r
- append area3 "\!IF \"\$(RECURSE)\" == \"1\"\n" \r
- append area3 "CLEAN :"\r
- if {$tkused != ""} {\r
- foreach tkproj $tkused {\r
- append area3 "\"$tkproj - Win32 DebugCLEAN\"" \r
- }\r
- }\r
- append area3 "\n" \r
- append area3 "\!ELSE\n" \r
- append area3 "CLEAN :\n"\r
- append area3 "\!ENDIF\n"\r
- if [array exists written] { unset written }\r
- \r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo]\r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
-\r
- foreach srcfile $lsrc {\r
- if { ![info exists written([file tail $srcfile])] } {\r
- set written([file tail $srcfile]) 1\r
- append area3 "\t-@erase \"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\"\n"\r
- }\r
- }\r
- } \r
- regsub -all -- {__FIELD3__} $temp2 $area3 temp3\r
-\r
- set area4 "LINK32_FLAGS=-nologo -subsystem:windows -dll -incremental:no -machine:IX86 -debug -libpath:\"\$(LIBDIR)\" -implib:\$(LIBDIR)\\$tkloc.lib -out:\$(OUTDIR)\\$tkloc.dll -pdb:\$(OUTDIR)\\$tkloc.pdb "\r
- foreach tk $libused {\r
- append area4 "$tk "\r
- }\r
- if {$tclused == 1} {\r
- append area4 "-libpath:\"\$(TCLHOME)\\lib\" "\r
- }\r
-\r
- append area4 "\n"\r
- append area4 "LINK32_OBJS= \\\n"\r
- if [array exists written] { unset written }\r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo]\r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
- foreach srcfile $lsrc {\r
- if { ![info exists written([file tail $srcfile])] } {\r
- set written([file tail $srcfile]) 1\r
- append area4 "\t\"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\" \\\n"\r
- }\r
- }\r
- } \r
- \r
- regsub -all -- {__FIELD4__} $temp3 $area4 temp4\r
-\r
- set area5 ""\r
- if [array exists written] { unset written }\r
- foreach fxlo $resultloc {\r
- set xlo [wokinfo -n $fxlo]\r
- set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]\r
- set fxlocxxparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]\r
- set fxlocparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]\r
- if {$tclused == 1} {\r
- set fxlocxxparam "-I\$(TCLHOME)\\include"\r
- }\r
- if {$javaused == 1} {\r
- set fxlocxxparam "-I\$(JAVAHOME)\\include -I\$(JAVAHOME)\\include\\win32"\r
- }\r
- set fxloparam "$fxlocparam $fxlocxxparam"\r
- #puts $fxloparam\r
- foreach srcfile $lsrc {\r
- if { ![info exists written([file tail $srcfile])] } {\r
- set written([file tail $srcfile]) 1\r
- set pkname [wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]]\r
- \r
- append area5 "SOURCE=..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $srcfile 3]]\n"\r
- append area5 "\!IF \"\$(CFG)\" == \"$tkloc - Win32 Release\"\n"\r
- append area5 "CPP_SWITCHES=\/nologo \/MD \/W3 \/GX \/O2 $fxloparam \/I \"..\\..\\..\\inc\" \/I \"..\\..\\..\\drv\\$xlo\" \/I \"..\\..\\..\\src\\$xlo\" \/D \"WIN32\" \/D \"NDEBUG\" \/D \"_WINDOWS\" \/D \"WNT\" \/D \"No_Exception\" \/D \"__${xlo}_DLL\" \/Fo\"\$(INTDIR)\\\\\\\" \/Fd\"\$(INTDIR)\\\\\\\" \/FD \/D \"CSFDB\" \/c\n"\r
- append area5 "\"\$(INTDIR)\\$pkname.obj\" : \$(SOURCE) \"\$(INTDIR)\"\n"\r
- append area5 "\t\t\$(CPP) \$(CPP_SWITCHES) \$(SOURCE)\n"\r
- append area5 "\n"\r
- append area5 "\!ELSEIF \"\$(CFG)\" == \"$tkloc - Win32 Debug\"\n"\r
- append area5 "CPP_SWITCHES=\/nologo \/MDd \/W3 \/GX \/Zi \/Od $fxloparam \/I \"..\\..\\..\\inc\" \/I \"..\\..\\..\\drv\\$xlo\" \/I \"..\\..\\..\\src\\$xlo\" \/D \"WIN32\" \/D \"DEB\" \/D \"_DEBUG\" \/D \"_WINDOWS\" \/D \"WNT\" \/D \"CSFDB\" \/D \"__${xlo}_DLL\" \/Fo\"\$(INTDIR)\\\\\\\" \/Fd\"\$(INTDIR)\\\\\\\" \/FD \/c \n"\r
- append area5 "\"\$(INTDIR)\\$pkname.obj\" : \$(SOURCE) \"\$(INTDIR)\"\n"\r
- append area5 "\t\t\$(CPP) \$(CPP_SWITCHES) \$(SOURCE)\n"\r
- append area5 "\n"\r
- append area5 "\!ENDIF \n"\r
- }\r
- }\r
- } \r
- regsub -all -- {__FIELD5__} $temp4 $area5 temp5\r
-\r
- set area6 ""\r
- foreach tk $tkused {\r
- append area6 "\!IF \"\$(CFG)\" == \"$tkloc - Win32 Release\"\n"\r
- append area6 "\"$tk - Win32 Release\" \: \n"\r
- append area6 " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" \n"\r
- append area6 "\"$tk - Win32 ReleaseCLEAN\" \: \n"\r
- append area6 " \$(MAKE)\/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" RECURSE=1 CLEAN\n"\r
- append area6 "\!ELSEIF \"\$(CFG)\" == \"$tkloc - Win32 Debug\"\n"\r
- append area6 "\"$tk - Win32 Debug\" \: \n"\r
- append area6 " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" \n"\r
- append area6 "\"$tk - Win32 DebugCLEAN\" \: \n"\r
- append area6 " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" RECURSE=1 CLEAN\n"\r
- append area6 "\!ENDIF\n"\r
- }\r
- regsub -all -- {__FIELD6__} $temp5 $area6 temp6\r
- \r
- if {$tclused == 1} {\r
- set tclwarning "\!IFNDEF TCLHOME \n\!MESSAGE Compilation of this toolkit requires tcl. Set TCLHOME environment variable for proper compilation\n\!ENDIF"\r
- } else {\r
- set tclwarning ""\r
- }\r
- regsub -all -- {__TCLUSED__} $temp6 $tclwarning temp7\r
-\r
- if {$javaused == 1} {\r
- set javawarning "\!IFNDEF JAVAHOME \n\!MESSAGE Compilation of this toolkit requires java. Set JAVAHOME environment variable for proper compilation\n\!ENDIF"\r
- } else {\r
- set javawarning ""\r
- }\r
- regsub -all -- {__JAVAUSED__} $temp7 $javawarning temp8\r
- puts $fp $temp8\r
- close $fp\r
- return $fdsp\r
-}\r
-\r
-proc osutils:mkmakx { dir tkloc {tmplat {} } {fmtcpp {} } } {\r
- if { $tmplat == {} } {set tmplat [osutils:mak:readtemplatex]}\r
- if { $fmtcpp == {} } {set fmtcpp [osutils:mak:fmtcppx]}\r
- foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {\r
- set tf [file rootname [file tail $f]] \r
- set fp [open [set fdsp [file join $dir ${tf}.mak]] w]\r
- puts $fdsp\r
- set tclused 0\r
- fconfigure $fp -translation crlf\r
- set l_compilable [osutils:vc6:compilable]\r
- regsub -all -- {__XQTNAM__} $tmplat $tf temp0\r
- set tkused ""\r
- puts [LibToLinkX [woklocate -u $tkloc] $tf]\r
- foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {\r
- append tkused "${tkx}.lib "\r
- }\r
- if {[woklocate -u $tkx] == "" } {\r
- append tkused "${tkx}.lib "\r
- }\r
- }\r
- foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[wokparam -t %$element] != 0} {\r
- set elemlist [wokparam -v "%$element"]\r
- set felem [file tail [lindex $elemlist 0]] \r
- if {[lsearch $tkused $felem] == "-1"} {\r
- if {$felem != "\{\}"} {\r
- #puts "was found $element $felem" \r
- if {$element == "CSF_TclLibs"} { set tclused 1} \r
- set tkused [concat $tkused $felem]\r
- }\r
- } \r
- }\r
- }\r
- }\r
- \r
- if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)" } { \r
- set tkused [concat $tkused "\/dll"]\r
- if {$tclused != 1} {\r
- regsub -all -- {__COMPOPT__} $temp0 "\/MD" temp1 \r
- regsub -all -- {__COMPOPTD__} $temp1 "\/MDd" temp2 \r
- } else {\r
- regsub -all -- {__COMPOPT__} $temp0 "\/MD \/I \"\$(TCLHOME)\\include\"" temp1 \r
- regsub -all -- {__COMPOPTD__} $temp1 "\/MDd \/I \"\$(TCLHOME)\\include\"" temp2 \r
- } \r
- regsub -all -- {__XQTNAMEX__} $temp2 "$tf.dll" temp3\r
- } else {\r
- if {$tclused != 1} {\r
- regsub -all -- {__COMPOPT__} $temp0 "\/MD" temp1\r
- regsub -all -- {__COMPOPTD__} $temp1 "\/MDd" temp2 \r
- } else {\r
- regsub -all -- {__COMPOPT__} $temp0 "\/MD \/I \"\$(TCLHOME)\\include\"" temp1\r
- regsub -all -- {__COMPOPTD__} $temp1 "\/MDd \/I \"\$(TCLHOME)\\include\"" temp2 \r
- }\r
- regsub -all -- {__XQTNAMEX__} $temp2 "$tf.exe" temp3\r
- }\r
- #puts "$tf requires $tkused"\r
- if {$tclused == 1} {\r
- append tkused " -libpath:\"\$(TCLHOME)\\lib\" "\r
- }\r
- regsub -all -- {__TKDEP__} $temp3 $tkused temp4\r
- set files ""\r
- set field1 ""\r
- set field2 ""\r
- set field3 ""\r
- set field4 ""\r
- foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {\r
-\r
- append files "\!IF \"\$(CFG)\" == \"$tf - Win32 Release\"\n"\r
- append files "\"$tk - Win32 Release\" \: \n"\r
- append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" \n"\r
- append files "\"$tk - Win32 ReleaseCLEAN\" \: \n"\r
- append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" RECURSE=1 CLEAN\n"\r
- append files "\!ELSEIF \"\$(CFG)\" == \"$tf - Win32 Debug\"\n"\r
- append files "\"$tk - Win32 Debug\" \: \n"\r
- append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" \n"\r
- append files "\"$tk - Win32 DebugCLEAN\" \: \n"\r
- append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" RECURSE=1 CLEAN\n"\r
- append files "\!ENDIF\n"\r
- \r
- append field1 "\"$tk - Win32 Release\" "\r
- append field2 "\"$tk - Win32 ReleaseCLEAN\" "\r
- append field3 "\"$tk - Debug\" "\r
- append field4 "\"$tk - Win32 DebugCLEAN\" "\r
- \r
- }\r
- regsub -all -- {__FILES__} $temp4 $files temp5\r
- regsub -all -- {__FIELD1__} $temp5 $field1 temp6\r
- regsub -all -- {__FIELD2__} $temp6 $field2 temp7\r
- regsub -all -- {__FIELD3__} $temp7 $field3 temp8\r
- regsub -all -- {__FIELD4__} $temp8 $field4 temp9\r
- regsub -all -- {__XNAM__} $temp9 $tkloc temp10\r
- puts $fp $temp10\r
- close $fp\r
- set fout [lappend fout $fdsp]\r
- }\r
- return $fout\r
-}\r
-\r
-\r
-;# \r
-;# (((((((((((((((((((((((( AUTOMAKE/ PROJECTs )))))))))))))))))))))))\r
-;#\r
-;# Create in dir the Makefile.am associated with toolkit tkloc.\r
-;# Returns the full path of the created file.\r
-;#\r
-proc osutils:tk:mkam { dir tkloc } {\r
- set pkgs [woklocate -p ${tkloc}:PACKAGES]\r
- if { $pkgs == {} } {\r
- puts stderr "osutils:tk:mkam : Error. File PACKAGES not found for toolkit $tkloc."\r
- return {}\r
- }\r
-\r
- set tmplat [osutils:am:readtemplate]\r
- set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]\r
- set close [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]\r
- set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justunix]]\r
- set lobj [wokUtils:LIST:sanspoint $lsrc]\r
-\r
- set lcsf [osutils:tk:hascsf [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]\r
-\r
- set final 0\r
- set externinc ""\r
- set externlib ""\r
- if { $lcsf != {} } {\r
- set final 1\r
- set fmtinc "\$(%s_INCLUDES) "\r
- set fmtlib "\$(%s_LIB) "\r
- set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]\r
- set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]\r
- }\r
-\r
- regsub -all -- {__TKNAM__} "$tmplat" "$tkloc" temp0\r
- set vpath [osutils:am:__VPATH__ $lpkgs]\r
- regsub -all -- {__VPATH__} "$temp0" "$vpath" temp1\r
- set inclu [osutils:am:__INCLUDES__ $lpkgs]\r
- regsub -all -- {__INCLUDES__} "$temp1" "$inclu" temp2\r
- if { $close != {} } {\r
- set libadd [osutils:am:__LIBADD__ $close $final]\r
- } else {\r
- set libadd ""\r
- }\r
- regsub -all -- {__LIBADD__} "$temp2" "$libadd" temp3\r
- set source [osutils:am:__SOURCES__ $lsrc]\r
- regsub -all -- {__SOURCES__} "$temp3" "$source" temp4\r
- regsub -all -- {__EXTERNINC__} "$temp4" "$externinc" temp5\r
- set CXXFl [osutils:am:__CXXFLAG__ $lpkgs]\r
- regsub -all -- {__CXXFLAG__} "$temp5" "$CXXFl" temp6\r
- set CFl [osutils:am:__CFLAG__ $lpkgs]\r
- regsub -all -- {__CFLAG__} "$temp6" "$CFl" temp7\r
-\r
- regsub -all -- {__EXTERNLIB__} "$temp7" "$externlib" MakeFile_am\r
-\r
- wokUtils:FILES:StringToFile "$MakeFile_am" [set fmam [file join $dir Makefile.am]]\r
-\r
- catch { unset temp0 temp1 temp2 temp3 temp4 temp5 temp6 temp7}\r
-\r
- #set tmplat [osutils:in:readtemplate]\r
- \r
- #regsub -all -- {__TKNAM__} "$tmplat" "$tkloc" temp0\r
- #if { $close != {} } {\r
- #set dpncies [osutils:in:__DEPENDENCIES__ $close]\r
- #} else {\r
- #set dpncies ""\r
- #}\r
- #regsub -all -- {__DEPENDENCIES__} "$temp0" "$dpncies" temp1\r
-\r
- #set objects [osutils:in:__OBJECTS__ $lobj]\r
- #regsub -all -- {__OBJECTS__} "$temp1" "$objects" temp2\r
- #set amdep [osutils:in:__AMPDEP__ $lobj]\r
- #regsub -all -- {__AMPDEP__} "$temp2" "$amdep" temp3\r
- #set amdeptrue [osutils:in:__AMDEPTRUE__ $lobj]\r
- #regsub -all -- {__AMDEPTRUE__} "$temp3" "$amdeptrue" temp4\r
-;# so easy.. \r
- #regsub -all -- {__MAKEFILEIN__} "$temp4" "$MakeFile_am" MakeFile_in\r
-\r
- #wokUtils:FILES:StringToFile "$MakeFile_in" [set fmin [file join $dir Makefile.in]]\r
-\r
- return [list $fmam]\r
- #return [list $fmam $fmin]\r
-}\r
-;#\r
-;# Create in dir the Makefile.am associated with toolkit tkloc.\r
-;# Returns the full path of the created file.\r
-;#\r
-proc osutils:tk:mkamx { dir tkloc } {\r
- if { [lsearch [uinfo -f -T source [woklocate -u $tkloc]] ${tkloc}_WOKSteps.edl] != "-1"} {\r
- set pkgs [woklocate -p ${tkloc}:EXTERNLIB]\r
- if { $pkgs == {} } {\r
- puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."\r
- #return {}\r
- }\r
- set tmplat [osutils:am:readtemplatex]\r
- set close [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]\r
- set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justunix]]\r
- set lobj [wokUtils:LIST:sanspoint $lsrc]\r
- set CXXList {}\r
- foreach SourceFile [uinfo -f -T source [woklocate -u $tkloc]] { \r
- if {[file extension $SourceFile] == ".cxx"} { \r
- lappend CXXList [file rootname $SourceFile]\r
- }\r
- }\r
- set pkgs [LibToLinkX [woklocate -u $tkloc] [lindex $CXXList 0]]\r
- set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]\r
- puts "pkgs $pkgs"\r
- #set lcsf [osutils:tk:hascsf [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]\r
-\r
- set lcsf {}\r
- foreach tk $pkgs {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[lsearch $lcsf $element] == "-1"} { \r
- set lcsf [concat $lcsf $element]\r
- }\r
- }\r
- }\r
- set final 0\r
- set externinc ""\r
- set externlib ""\r
- if { $lcsf != {} } {\r
- set final 1\r
- set fmtinc "\$(%s_INCLUDES) "\r
- set fmtlib "\$(%s_LIB) "\r
- set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]\r
- set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]\r
- }\r
- regsub -all -- {__XQTNAM__} "$tmplat" "$tkloc" temp0\r
- set temp1 "$temp0 \nlib_LTLIBRARIES="\r
- foreach entity $CXXList {\r
- set temp1 "${temp1} lib${entity}.la"\r
- }\r
- set temp1 "${temp1}\n"\r
- set inclu [osutils:am:__INCLUDES__ $lpkgs]\r
- regsub -all -- {__INCLUDES__} "$temp1" "$inclu" temp2\r
- if { $pkgs != {} } {\r
- set libadd [osutils:am:__LIBADD__ $pkgs $final]\r
- } else {\r
- set libadd ""\r
- }\r
- regsub -all -- {__LIBADD__} "$temp2" "$libadd" temp3\r
- set source [osutils:am:__SOURCES__ $CXXList]\r
- regsub -all -- {__SOURCES__} "$temp3" "$source" temp4\r
- regsub -all -- {__EXTERNINC__} "$temp4" "$externinc" MakeFile_am\r
- foreach entity $CXXList {\r
- set MakeFile_am "$MakeFile_am lib${entity}_la_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"\r
- }\r
- foreach entity $CXXList {\r
- set MakeFile_am "$MakeFile_am lib${entity}_la_LIBADD = $libadd $externlib \n"\r
- }\r
- wokUtils:FILES:StringToFile "$MakeFile_am" [set fmam [file join $dir Makefile.am]]\r
-\r
- catch { unset temp0 temp1 temp2 temp3 temp4 temp5}\r
- return [list $fmam]\r
-\r
- } else {\r
- set pkgs [woklocate -p ${tkloc}:EXTERNLIB]\r
- if { $pkgs == {} } {\r
- puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."\r
- #return {}\r
- }\r
- set tmplat [osutils:am:readtemplatex]\r
- set close [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]\r
- set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justunix]]\r
- set lobj [wokUtils:LIST:sanspoint $lsrc]\r
- set CXXList {}\r
- foreach SourceFile [uinfo -f -T source [woklocate -u $tkloc]] { \r
- if {[file extension $SourceFile] == ".cxx"} { \r
- lappend CXXList [file rootname $SourceFile]\r
- }\r
- }\r
- set pkgs [LibToLinkX [woklocate -u $tkloc] [lindex $CXXList 0]]\r
- set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]\r
- set lcsf [osutils:tk:hascsf [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]\r
-\r
- set lcsf {}\r
- foreach tk $pkgs {\r
- foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {\r
- if {[lsearch $lcsf $element] == "-1"} { \r
- set lcsf [concat $lcsf $element]\r
- }\r
- }\r
- }\r
- set final 0\r
- set externinc ""\r
- set externlib ""\r
- if { $lcsf != {} } {\r
- set final 1\r
- set fmtinc "\$(%s_INCLUDES) "\r
- set fmtlib "\$(%s_LIB) "\r
- set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]\r
- set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]\r
- }\r
- regsub -all -- {__XQTNAM__} "$tmplat" "$tkloc" temp0\r
- set temp1 "$temp0 \nbin_PROGRAMS="\r
- foreach entity $CXXList {\r
- set temp1 "${temp1} ${entity}"\r
- }\r
- \r
- set temp1 "${temp1}\n"\r
- set inclu [osutils:am:__INCLUDES__ $lpkgs]\r
- regsub -all -- {__INCLUDES__} "$temp1" "$inclu" temp2\r
- if { $pkgs != {} } {\r
- set libadd [osutils:am:__LIBADD__ $pkgs $final]\r
- } else {\r
- set libadd ""\r
- }\r
- set source [osutils:am:__SOURCES__ $CXXList]\r
- regsub -all -- {__SOURCES__} "$temp2" "$source" temp3\r
- regsub -all -- {__EXTERNINC__} "$temp3" "$externinc" MakeFile_am\r
- foreach entity $CXXList {\r
- set MakeFile_am "$MakeFile_am ${entity}_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"\r
- }\r
- foreach entity $CXXList {\r
- set MakeFile_am "$MakeFile_am ${entity}_LDADD = $libadd $externlib \n"\r
- }\r
- wokUtils:FILES:StringToFile "$MakeFile_am" [set fmam [file join $dir Makefile.am]]\r
-\r
- catch { unset temp0 temp1 temp2 temp3 temp4 temp5}\r
-\r
- # set tmplat [osutils:in:readtemplatex]\r
- \r
- # regsub -all -- {__XQTNAM__} "$tmplat" "$tkloc" temp0\r
- # if { $close != {} } {\r
- #set dpncies [osutils:in:__DEPENDENCIES__ $close]\r
- # } else {\r
- #set dpncies ""\r
- # }\r
- # regsub -all -- {__DEPENDENCIES__} "$temp0" "$dpncies" temp1\r
-\r
- # set objects [osutils:in:__OBJECTS__ $lobj]\r
- # regsub -all -- {__OBJECTS__} "$temp1" "$objects" temp2\r
- # #set temp2 $temp1\r
- # set amdep [osutils:in:__AMPDEP__ $lobj]\r
- # regsub -all -- {__AMPDEP__} "$temp2" "$amdep" temp3\r
- #set temp3 $temp2\r
- # set amdeptrue [osutils:in:__AMDEPTRUE__ $lobj]\r
- # regsub -all -- {__AMDEPTRUE__} "$temp3" "$amdeptrue" temp4\r
- #set temp4 $temp3\r
-;# so easy.. \r
- # regsub -all -- {__MAKEFILEIN__} "$temp4" "$MakeFile_am" MakeFile_in\r
-\r
- #wokUtils:FILES:StringToFile "$MakeFile_in" [set fmin [file join $dir Makefile.in]]\r
- return [list $fmam]\r
- #return [list $fmam $fmin]\r
- }\r
-}\r
-\r
-;#\r
-;# ((((((((((((( Formats in Makefile.am )))))))))))))\r
-;#\r
-;# List extensions of files compilable in automake\r
-;#\r
-proc osutils:am:compilable { } {\r
- return [list .c .cxx .cpp]\r
-}\r
-;#\r
-;# Used to replace the string __VPATH__ in Makefile.am\r
-;# l is the list of the units in a toolkit.\r
-;#\r
-proc osutils:am:__VPATH__ { l } {\r
- set fmt "@top_srcdir@/drv/%s : @top_srcdir@/src/%s:"\r
- return [wokUtils:EASY:FmtString2 $fmt $l 0 osutils:am:__VPATH__lastoccur]\r
-}\r
-;#\r
-;# remove ":" from last item of dependencies list in target VPATH of Makefile.am\r
-;#\r
-proc osutils:am:__VPATH__lastoccur { str } {\r
- if { [regsub {:$} $str "" u] != 0 } {\r
- return $u\r
- }\r
-}\r
-proc osutils:am:PkCXXOption ppk {\r
- set CXXCOMMON [lindex [wokparam -e %CMPLRS_CXX_Options [wokcd]] 0]\r
- set FoundFlag ""\r
- foreach pk $ppk {\r
- if {[lsearch [uinfo -f -T source [woklocate -u $pk]] ${pk}_CMPLRS.edl] != "-1"} {\r
- set CXXStr [lindex [wokparam -e %CMPLRS_CXX_Options [woklocate -u $pk]] 0]\r
- set LastIndex [expr {[string length $CXXCOMMON ] - 1}]\r
- if {[string equal $CXXCOMMON [string range $CXXStr 0 $LastIndex]]} {\r
- set CXXOption " "\r
- } else {\r
- set CXXOption [string range $CXXStr 0 [expr {[string last $CXXCOMMON $CXXStr] - 1}]]\r
- }\r
- if {$CXXOption != " " && $CXXOption != "" && $CXXOption != " " && $CXXOption != " "} {\r
- set FoundList [split $CXXOption " "]\r
- foreach elem $FoundList {\r
- if {$elem != ""} {\r
- if {[string first "-I" $elem] == "-1" } {\r
- if {[string first $elem $FoundFlag] == "-1"} {\r
- set FoundFlag "$FoundFlag $elem"\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- return $FoundFlag\r
-}\r
-\r
-proc osutils:am:PkCOption ppk {\r
- set CCOMMON [lindex [wokparam -e %CMPLRS_C_Options [wokcd]] 0]\r
- set FoundFlag ""\r
- foreach pk $ppk {\r
- if {[lsearch [uinfo -f -T source [woklocate -u $pk]] ${pk}_CMPLRS.edl] != "-1"} {\r
- set CStr [lindex [wokparam -e %CMPLRS_C_Options [woklocate -u $pk]] 0]\r
- set LastIndex [expr {[string length $CCOMMON ] - 1}]\r
- if {[string equal $CCOMMON [string range $CStr 0 $LastIndex]]} {\r
- set COption [string range $CStr $LastIndex end ]\r
- } else {\r
- set COption [string range $CStr 0 [expr {[string last $CCOMMON $CStr] - 1}]]\r
- }\r
- if {$COption != " " && $COption != "" && $COption != " " && $COption != " "} {\r
- set FoundList [split $COption " "]\r
- foreach elem $FoundList {\r
- if {$elem != ""} {\r
- if {[string first "-I" $elem] == "-1" } {\r
- if {[string first $elem $FoundFlag] == "-1"} {\r
- set FoundFlag "$FoundFlag $elem"\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- } \r
-return $FoundFlag\r
-}\r
-\r
-proc osutils:am:__CXXFLAG__ { l } {\r
- set fmt "%s"\r
- #puts "l is: $l"\r
- return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCXXOption $l]]\r
-}\r
-;#\r
-;# Used to replace the string __CFLAG__ in Makefile.am\r
-;# l is the list of all compilable files in a toolkit.\r
-;#\r
-proc osutils:am:__CFLAG__ { l } {\r
- set fmt "%s"\r
- return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCOption $l]]\r
-}\r
-\r
-;#\r
-;# Used to replace the string __INCLUDES__ in Makefile.am\r
-;# l is the list of packages in a toolkit.\r
-;#\r
-proc osutils:am:__INCLUDES__ { l } {\r
- set fmt "-I@top_srcdir@/drv/%s -I@top_srcdir@/src/%s"\r
- return [wokUtils:EASY:FmtString2 $fmt $l] \r
-}\r
-;#\r
-;# Used to replace the string __LIBADD__ in Makefile.am\r
-;# l is the toolkit closure list of a toolkit.\r
-;#\r
-proc osutils:am:__LIBADD__ { l {final 0} } {\r
- set fmt "../%s/lib%s.la"\r
- return [wokUtils:EASY:FmtString2 $fmt $l $final]\r
-}\r
-;#\r
-;# Used to replace the string __SOURCES__ in Makefile.am\r
-;# l is the list of all compilable files in a toolkit.\r
-;#\r
-proc osutils:am:__SOURCES__ { l } {\r
- set fmt "%s"\r
- return [wokUtils:EASY:FmtString1 $fmt $l]\r
-}\r
-;#\r
-;# ((((((((((((( Formats in Makefile.in )))))))))))))\r
-;#\r
-;#\r
-;# Used to replace the string __DEPENDENCIES__ in Makefile.in\r
-;# l is the toolkit closure list of a toolkit.\r
-;# \r
-proc osutils:in:__DEPENDENCIES__ { l } {\r
- set fmt1 "../%s/lib%s.la"\r
- set fmt2 "\t../%s/lib%s.la"\r
- return [wokUtils:EASY:FmtFmtString2 $fmt1 $fmt2 $l]\r
-}\r
-;#\r
-;# Used to replace the string __OBJECTS__ in Makefile.in\r
-;# l is the list of objects files in toolkit.\r
-;#\r
-proc osutils:in:__OBJECTS__ { l } {\r
- set fmt1 "%s.lo"\r
- set fmt2 "\t%s.lo"\r
- return [wokUtils:EASY:FmtFmtString1 $fmt1 $fmt2 $l]\r
-}\r
-;#\r
-;# Used to replace the string __AMDEP__ in Makefile.in\r
-;# l is the list of objects files in toolkit.\r
-;#\r
-proc osutils:in:__AMPDEP__ { l } {\r
- set fmt1 "\$(DEPDIR)/%s.Plo"\r
- set fmt2 "@AMDEP_TRUE@\t\$(DEPDIR)/%s.Plo"\r
- return [wokUtils:EASY:FmtFmtString1 $fmt1 $fmt2 $l]\r
-}\r
-;#\r
-;# Used to replace the string __AMDEPTRUE__ in Makefile.in\r
-;# l is the list of objects files in toolkit.\r
-;#\r
-proc osutils:in:__AMDEPTRUE__ { l } {\r
- set fmt "@AMDEP_TRUE@@_am_include@ @_am_quote@\$(DEPDIR)/%s.Plo@_am_quote@"\r
- return [wokUtils:EASY:FmtSimple1 $fmt $l]\r
-}\r
-\r
-\r
-;#############################################################\r
-;#\r
-proc TESTAM { {root} {ll {}} } {\r
-# source [woklocate -p OS:source:OS.tcl]\r
-# source [woklocate -p WOKTclLib:source:osutils.tcl]\r
- set lesmodules [OS -lm]\r
- if { $ll != {} } { set lesmodules $ll }\r
- foreach theModule $lesmodules {\r
- foreach unit [$theModule:toolkits] {\r
- puts " toolkit: $unit ==> [woklocate -p ${unit}:source:EXTERNLIB]"\r
- wokUtils:FILES:rmdir $root/$unit\r
- wokUtils:FILES:mkdir $root/$unit\r
- osutils:tk:mkam $root/$unit $unit\r
- }\r
- foreach unit [OS:executable $theModule] {\r
- wokUtils:FILES:rmdir $root/$unit\r
- wokUtils:FILES:mkdir $root/$unit\r
- osutils:tk:mkamx $root/$unit $unit\r
- }\r
- }\r
-}\r
+;#
+;# Open source Tcl utilities. This contains material to automatically create
+;# MS project or automake builders from the OpenCascade modules definition.
+;# This file requires:
+;# 1. Tcl utilities of Wok.
+;# 2. Wok commands and workbench environment.
+;#
+;# Author: yolanda_forbes@hotmail.com
+;#
+;# (((((((((((((((((((((((( MS PROJECT )))))))))))))))))))))))
+;#
+;# the full path of a MS project template file.
+;# Should be overwritten
+;#
+proc osutils:vc8_64:readtemplate { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc8_64]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:vc8_64:readtemplatex { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc8x_64]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:vc8:readtemplate { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc8]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:vc8:readtemplatex { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc8x]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:vc7:readtemplate { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc7]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:vc7:readtemplatex { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc7x]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:vc6:readtemplate { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc6 ]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:vc6:readtemplatex { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.vc6x]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:mak:readtemplate { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.mak ]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:mak:readtemplatex { } {
+ puts stderr "Info : readtemplate : Template for MS project from [set loc [woklocate -p WOKTclLib:source:template.makx]]"
+ return [wokUtils:FILES:FileToString $loc]
+}
+proc osutils:am:readtemplate { } {
+ puts stderr "Info : readtemplate : Template for Makefile.am from [set loc [woklocate -p WOKTclLib:source:template.mam]]"
+ return [wokUtils:FILES:FileToString $loc]
+
+}
+proc osutils:am:readtemplatex { } {
+ puts stderr "Info : readtemplatex : Template for Makefile.am from [set loc [woklocate -p WOKTclLib:source:template.mamx]]"
+ return [wokUtils:FILES:FileToString $loc]
+
+}
+proc osutils:in:readtemplate { } {
+ puts stderr "Info : readtemplate : Template for Makefile.in from [set loc [woklocate -p WOKTclLib:source:template.min]]"
+ return [wokUtils:FILES:FileToString $loc]
+
+}
+proc osutils:in:readtemplatex { } {
+ puts stderr "Info : readtemplatex : Template for Makefile.in from [set loc [woklocate -p WOKTclLib:source:template.minx]]"
+ return [wokUtils:FILES:FileToString $loc]
+
+}
+;#
+;#
+;#
+proc osutils:vc6proj:header { } {
+ append var \
+ "Microsoft Developer Studio Workspace File, Format Version 6.00" "\n" \
+ "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!" "\n" \
+ "\n" \
+ "###############################################################################" "\n" \
+ "\n"
+ return $var
+}
+proc osutils:vc7proj:header { } {
+ append var \
+ "Microsoft Visual Studio Solution File, Format Version 8.00\n"
+ return $var
+}
+proc osutils:vc8proj:header { } {
+ append var \
+ "Microsoft Visual Studio Solution File, Format Version 9.00\n" \
+ "# Visual Studio 2005\n"
+ return $var
+}
+proc osutils:vc8_64proj:header { } {
+ append var \
+ "Microsoft Visual Studio Solution File, Format Version 9.00\n" \
+ "# Visual Studio 2005\n"
+ return $var
+}
+;#
+;# the leaf of a workspace file
+;#
+proc osutils:vc6proj:projectleaf { TK } {
+ append var \
+ "Project: \"$TK\"=.\\$TK.dsp - Package Owner=<4>" "\n" \
+ "\n" \
+ "Package=<5>" "\n" \
+ "\{\{\{" "\n" \
+ "\}\}\}" "\n" \
+ "\n" \
+ "Package=<4>" "\n" \
+ "\{\{\{" "\n" \
+ "\}\}\}" "\n" \
+ "\n" \
+ "###############################################################################" "\n" \
+ "\n"
+ return $var
+}
+;#
+;# an item of a workspace file
+;#
+proc osutils:vc6proj:projectby2 { TK Dep_Name } {
+ append var \
+ "Project: \"$TK\"=.\\$TK.dsp - Package Owner=<4>" "\n" \
+ "\n" \
+ "Package=<5>" "\n" \
+ "\{\{\{" "\n" \
+ "\}\}\}" "\n" \
+ "\n" \
+ "Package=<4>" "\n" \
+ "\{\{\{" "\n"
+ if {[wokinfo -x $TK] != "0"} {
+ if {[uinfo -t $TK] == "toolkit"} {
+ set deplist [LibToLink $TK]
+ } else {
+ set deplist [LibToLinkX $TK $TK]
+ ;#puts $deplist
+ }
+ foreach deplib $deplist {
+ if {$deplib != $TK} {
+ append var " Begin Project Dependency" "\n" \
+ " Project_Dep_Name $deplib" "\n" \
+ " End Project Dependency" "\n"
+ }
+ }
+ }
+
+ append var "\}\}\}" "\n" \
+ "\n" \
+ "###############################################################################" "\n" \
+ "\n"
+ return $var
+}
+;#
+;#
+;#
+proc osutils:vc6proj:footer { } {
+ append var \
+ "Global:" "\n" \
+ "\n" \
+ "Package=<5>" "\n" \
+ "{{{" "\n" \
+ "}}}" "\n" \
+ "\n" \
+ "Package=<3>" "\n" \
+ "{{{" "\n" \
+ "}}}" "\n" \
+ "\n" \
+ "###############################################################################" "\n"
+ return $var
+}
+;#
+;# An item for compiling a c++ class
+;#
+proc osutils:vc6:fmtcpp { } {
+ return {# ADD CPP /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}
+}
+proc osutils:mak:fmtcpp { } {
+ return {CPP_SWITCHES=$(CPP_PROJ) /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}
+}
+;#
+;# An item for compiling a c++ main
+;#
+proc osutils:vc6:fmtcppx { } {
+ return {# ADD CPP /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}
+}
+proc osutils:vc7:fmtcpp { } {
+ return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"
+ PreprocessorDefinitions="__%s_DLL;"}
+}
+proc osutils:vc7:fmtcppx { } {
+ return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"
+ PreprocessorDefinitions="__%s_DLL;$(NoInherit)"}
+}
+proc osutils:vc8:fmtcpp { } {
+ return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"
+ PreprocessorDefinitions="__%s_DLL;"}
+}
+proc osutils:vc8:fmtcppx { } {
+ return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"
+ PreprocessorDefinitions="__%s_DLL;$(NoInherit)"}
+}
+proc osutils:vc8_64:fmtcpp { } {
+ return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"
+ PreprocessorDefinitions="__%s_DLL;"}
+}
+proc osutils:vc8_64:fmtcppx { } {
+ return {AdditionalIncludeDirectories="..\..\..\inc,..\..\..\drv\%s,..\..\..\src\%s"
+ PreprocessorDefinitions="__%s_DLL;$(NoInherit)"}
+}
+proc osutils:mak:fmtcppx { } {
+ return {CPP_SWITCHES=$(CPP_PROJ) /I ..\..\..\inc /I ..\..\..\drv\%s /I ..\..\..\src\%s /D "__%s_DLL"}
+}
+;#
+;# List extensions of files devoted to be eaten by cl.exe compiler.
+;#
+proc osutils:vc6:compilable { } {
+ return [list .c .cxx .cpp]
+}
+proc osutils:vc7:compilable { } {
+ return [list .c .cxx .cpp]
+}
+proc osutils:vc8:compilable { } {
+ return [list .c .cxx .cpp]
+}
+proc osutils:vc8_64:compilable { } {
+ return [list .c .cxx .cpp]
+}
+;#
+;# remove from listloc OpenCascade units indesirables on NT
+;#
+proc osutils:juststation {goaway listloc} {
+ set lret {}
+ foreach u $listloc {
+ if {
+ (
+ [woklocate -u $u] != ""
+ &&
+ [lsearch $goaway [wokinfo -n [woklocate -u $u]]] == -1
+ )
+ ||
+ (
+ [woklocate -u $u] == ""
+ &&
+ [lsearch $goaway [wokinfo -n $u]] == -1
+ )
+
+ } {
+ lappend lret $u
+ }
+ }
+ return $lret
+}
+
+proc osutils:justwnt { listloc } {
+ set goaway [list Xdps Xw ImageUtility WOKUnix]
+ return [osutils:juststation $goaway $listloc]
+}
+;#
+;# remove from listloc OpenCascade units indesirables on Unix
+;#
+proc osutils:justunix { listloc } {
+ set goaway [list WNT WOKNT]
+ return [osutils:juststation $goaway $listloc]
+}
+;#
+;# Define libraries to link
+proc LibToLink {tkit} {
+ if {[uinfo -t $tkit] == "toolkit"} {
+ set l {}
+ set LibList [woklocate -p [wokinfo -n $tkit]:stadmfile:[wokinfo -n $tkit]_lib_tks.Out]
+ if ![ catch { set id [ open $LibList r ] } status ] {
+ while {[gets $id x] >= 0 } {
+ if [regexp -- {(-E[^ ]*)} $x] {
+ set endnameid [expr { [string wordend $x 4] -1 }]
+ set fx [string range $x 3 $endnameid]
+ if {[uinfo -t [woklocate -u [file rootname $fx]]] == "toolkit"} {
+ lappend l $fx
+ }
+ }
+ #if [regexp -- {(-VE[^ ]*)} $x] {
+ # set startid [string first CSF $x]
+ # set endid [ expr { [string wordend $x $startid] -1 } ]
+ # set fx [string range $x $startid $endid]
+ # lappend l $fx
+ #}
+
+ }
+ close $id
+ } else {
+ puts $status
+ }
+ return $l
+ }
+}
+
+proc LibToLinkX {tkit name} {
+ if {[uinfo -t $tkit] == "executable"} {
+ set l {}
+ set LibList [woklocate -p [wokinfo -n $tkit]:stadmfile:[wokinfo -n $tkit]_exec_tks_${name}.Out]
+ if ![ catch { set id [ open $LibList r ] } status ] {
+ while {[gets $id x] >= 0 } {
+ if [regexp -- {(-E[^ ]*)} $x] {
+ if {[regexp -- {library} $x]} {
+ set endnameid [expr { [string wordend $x 4] -1 }]
+ set fx [string range $x 3 $endnameid]
+ lappend l $fx
+ }
+ }
+ #if [regexp -- {(-VE[^ ]*)} $x] {
+ # set startid [string first CSF $x]
+ # set endid [ expr { [string wordend $x $startid] -1 } ]
+ # set CSF_fx [string range $x $startid $endid]
+ # if { $CSF_fx != "-"} {
+ # puts $CSF_fx
+ # set fx [file tail [lindex [wokparam -v \%$CSF_fx $tkit] 0]]
+ # lappend l $fx
+ # }
+ #}
+
+ }
+ close $id
+ } else {
+ puts $status
+ }
+ return $l
+ }
+}
+
+
+;#
+;# ((((((((WOK toolkits manipulations))))))))
+;#
+;# close dependencies of ltk. (full wok pathes of toolkits)
+;# The CURRENT WOK LOCATION MUST contains ALL TOOLKITS required.
+;# (locate not performed.)
+proc osutils:tk:close { ltk } {
+ set result {}
+ set recurse {}
+ foreach dir $ltk {
+ #set ids [woklocate -p [wokinfo -n [wokinfo -u $dir]]:source:EXTERNLIB [wokinfo -w $dir]]
+ set ids [LibToLink $dir]
+ set eated [osutils:tk:eatpk $ids]
+ set result [concat $result $eated]
+ set ids [LibToLink $dir]
+ set result [concat $result $ids]
+ #puts "EXTERNLIB dir = $dir ids = $ids result = $result eated = $eated"
+ foreach file $eated {
+ set kds [woklocate -p [wokinfo -n [wokinfo -u $file]]:source:EXTERNLIB [wokinfo -w $file]]
+ if { [osutils:tk:eatpk $kds] != {} } {
+ lappend recurse $file
+ }
+ }
+ }
+ ;# if ![lempty $recurse] {
+ ;# set result [concat $result [osutils:tk:close $recurse]]
+ ;# }
+ if { $recurse != {} } {
+ set result [concat $result [osutils:tk:close $recurse]]
+ }
+ #puts $result
+ return $result
+}
+;#
+;# Topological sort of toolkits in tklm
+;#
+proc osutils:tk:sort { tklm } {
+ set tkby2 {}
+ foreach tkloc $tklm {
+ set lprg [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]
+ foreach tkx $lprg {
+ if { [lsearch $tklm $tkx] != -1 } {
+ lappend tkby2 [list $tkx $tkloc]
+ } else {
+ lappend tkby2 [list $tkloc {}]
+ }
+ }
+ }
+ set lret {}
+ foreach e [wokUtils:EASY:tsort $tkby2] {
+ if { $e != {} } {
+ lappend lret $e
+ }
+ }
+ return $lret
+}
+
+;#
+;# Returns liste of UD in a toolkit. tkloc is a full path wok.
+;#
+proc osutils:tk:units { tkloc {typed 0} } {
+ set l {}
+ set PACKAGES [woklocate -p [wokinfo -n [wokinfo -u $tkloc]]:source:PACKAGES [wokinfo -w $tkloc]]
+ foreach u [wokUtils:FILES:FileToList $PACKAGES] {
+ set fu [woklocate -u $u]
+ if { [set fu [woklocate -u $u]] != {} } {
+ if { $typed == 0 } {
+ lappend l $fu
+ }
+ if { $typed == 1 } {
+ lappend l [list [uinfo -c $fu] [wokinfo -n $fu]]
+ }
+ if { $typed == 2 } {
+ lappend l [list [uinfo -c $fu] $fu]
+ }
+ if { $typed == 3 } {
+ lappend l [list [uinfo -t $fu] [wokinfo -n $fu]]
+ }
+ if { $typed == 4 } {
+ lappend l [list [uinfo -t $fu] $fu]
+ }
+ } else {
+ puts stderr "Unit inconnue $u"
+ }
+ }
+ if { $l == {} } {
+ ;#puts stderr "Warning. No devunit included in $tkloc"
+ }
+ return $l
+}
+;#
+;# for a unit returns a map containing all its file in the current
+;# workbench
+;# local = 1 only local files
+;#
+proc osutils:tk:loadunit { loc map {local 0}} {
+ upvar $map TLOC
+ catch { unset TLOC }
+ if { $local == 1 } {
+ set lfiles [uinfo -Fpl $loc]
+ } else {
+ set lfiles [uinfo -Fp $loc]
+ }
+ foreach f $lfiles {
+ #puts $f
+ set t [lindex $f 0]
+ set p [lindex $f 2]
+ if [info exists TLOC($t)] {
+ set l $TLOC($t)
+ lappend l $p
+ set TLOC($t) $l
+ } else {
+ set TLOC($t) $p
+ }
+ }
+ return
+}
+;#
+;# Returns the list of all compilable files name in a toolkit, or devunit of any type
+;# Call unit filter on units name to accept or reject a unit
+;# Tfiles lists for each unit the type of file that can be compiled.
+;#
+proc osutils:tk:files { tkloc {l_compilable {} } {justail 1} {unitfilter {}} } {
+ set Tfiles(source,package) {source derivated privinclude pubinclude drvfile}
+ set Tfiles(source,nocdlpack) {source pubinclude drvfile}
+ set Tfiles(source,schema) {source derivated privinclude pubinclude drvfile}
+ set Tfiles(source,toolkit) {}
+ set Tfiles(source,executable) {source pubinclude drvfile}
+ set listloc [concat [osutils:tk:units [woklocate -u $tkloc]] [woklocate -u $tkloc]]
+ #puts " listloc = $listloc"
+ if { $l_compilable == {} } {
+ set l_comp [list .c .cxx .cpp]
+ } else {
+ set l_comp [$l_compilable]
+ }
+ if { $unitfilter == {} } {
+ set resultloc $listloc
+ } else {
+ set resultloc [$unitfilter $listloc]
+ }
+ set lret {}
+ foreach loc $resultloc {
+ set utyp [uinfo -t $loc]
+ if [array exists map] { unset map }
+ osutils:tk:loadunit $loc map
+ #puts " loc = $loc === > [array names map]"
+ set LType $Tfiles(source,${utyp})
+ foreach typ [array names map] {
+ if { [lsearch $LType $typ] == -1 } {
+ unset map($typ)
+ }
+ }
+ foreach type [array names map] {
+ #puts $type
+ foreach f $map($type) {
+ #puts $f
+ if { [lsearch $l_comp [file extension $f]] != -1 } {
+ if { $justail == 1 } {
+ if {$type == "source"} {
+ if {[lsearch $lret "@top_srcdir@/drv/[wokinfo -n $loc]/[file tail $f]"] == -1} {
+ lappend lret @top_srcdir@/src/[wokinfo -n $loc]/[file tail $f]
+ }
+ } elseif {$type == "derivated" || $type == "drvfile"} {
+ if {[lsearch $lret "@top_srcdir@/src/[wokinfo -n $loc]/[file tail $f]"] == -1} {
+ lappend lret @top_srcdir@/drv/[wokinfo -n $loc]/[file tail $f]
+ }
+ }
+ } else {
+ lappend lret $f
+ }
+ }
+ }
+ }
+ }
+ return $lret
+}
+;#
+;#
+;#
+proc osutils:tk:eatpk { EXTERNLIB } {
+ set l [wokUtils:FILES:FileToList $EXTERNLIB]
+ set lret {}
+ foreach str $l {
+ if ![regexp -- {(CSF_[^ ]*)} $str csf] {
+ lappend lret $str
+ }
+ }
+ return $lret
+}
+;#
+;# Return the list of name *CSF_ in a EXTERNLIB description of a toolkit
+;#
+proc osutils:tk:hascsf { EXTERNLIB } {
+ set l [wokUtils:FILES:FileToList $EXTERNLIB]
+ set lret {STLPort}
+ foreach str $l {
+ if [regexp -- {(CSF_[^ ]*)} $str csf] {
+ lappend lret $csf
+ }
+ }
+ return $lret
+}
+;#
+;# Create file tkloc.dsp for a shareable library (dll).
+;# in dir return the full path of the created file
+;#
+proc osutils:vc6 { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc6:readtemplate]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc6:fmtcpp]}
+ set fp [open [set fdsp [file join $dir ${tkloc}.dsp]] w]
+ fconfigure $fp -translation crlf
+ set l_compilable [osutils:vc6:compilable]
+ regsub -all -- {__TKNAM__} $tmplat $tkloc temp0
+ set tkused ""
+ foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {
+ append tkused "${tkx}.lib "
+ }
+ foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] $tkloc] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set felem [file tail [lindex [wokparam -v "%$element"] 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+
+ #puts "alternative [LibToLink $tkloc]"
+ puts "$tkloc requires $tkused"
+ regsub -all -- {__TKDEP__} $temp0 $tkused temp1
+ set files ""
+ ;#set listloc [concat [osutils:tk:units [woklocate -u $tkloc]] [woklocate -u $tkloc]]
+ set listloc [osutils:tk:units [woklocate -u $tkloc]]
+ set resultloc [osutils:justwnt $listloc]
+ ;#puts "result = $resultloc"
+ ;#set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justwnt]]
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ append files "# Begin Group \"${xlo}\"" "\n"
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ set fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]
+ set fxloparam "$fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]"
+ set needparam ""
+ foreach partopt $fxloparam {
+ if { "-I[lindex [wokparam -v %CSF_TCL_INCLUDE] 0]" != "$partopt "} {
+ if { "-I[lindex [wokparam -v %CSF_JAVA_INCLUDE] 0]" != "$partopt "} {
+ set needparam "$needparam $partopt"
+ }
+ }
+ }
+ foreach f $lsrc {
+ ;#puts " f = $f"
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "# Begin Source File" "\n"
+ append files "SOURCE=..\\..\\..\\" [wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]] "\n"
+ append files [format $fmtcpp $xlo $xlo $xlo] "$needparam" "\n"
+ append files "# End Source File" "\n"
+ } else {
+ puts "Warning : in dsp more than one occurences for [file tail $f]"
+ }
+ }
+ append files "# End Group" "\n"
+ }
+
+ regsub -all -- {__FILES__} $temp1 $files temp2
+ puts $fp $temp2
+ close $fp
+ return $fdsp
+}
+proc osutils:vc7 { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc7:readtemplate]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc7:fmtcpp]}
+ set fp [open [set fvcproj [file join $dir ${tkloc}.vcproj]] w]
+ fconfigure $fp -translation crlf
+ set l_compilable [osutils:vc7:compilable]
+ regsub -all -- {__TKNAM__} $tmplat $tkloc temp0
+ set tkused ""
+ foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {
+ append tkused "${tkx}.lib "
+ }
+ foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] $tkloc] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set felem [file tail [lindex [wokparam -v "%$element"] 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+
+ puts "$tkloc requires $tkused"
+ regsub -all -- {__TKDEP__} $temp0 $tkused temp1
+ set files ""
+ set listloc [osutils:tk:units [woklocate -u $tkloc]]
+ set resultloc [osutils:justwnt $listloc]
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ append files " <Filter\n"
+ append files " Name=\"${xlo}\"\n"
+ append files " Filter=\"\">\n"
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ set fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]
+ set fxloparam "$fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]"
+ set needparam ""
+ foreach partopt $fxloparam {
+ if { "-I[lindex [wokparam -v %CSF_TCL_INCLUDE] 0]" != "$partopt "} {
+ if { "-I[lindex [wokparam -v %CSF_JAVA_INCLUDE] 0]" != "$partopt "} {
+ set needparam "$needparam $partopt"
+ }
+ }
+ }
+ foreach f $lsrc {
+ #puts " f = $f"
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "\t\t\t\t<File\n"
+ append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Debug\|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ if {$needparam != ""} {
+ append files "\t\t\t\t\t\t\tAdditionalOptions=\""
+ foreach paramm $needparam {
+ append files "$paramm "
+ }
+ append files "\"\n"
+ }
+ append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Release\|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ if {$needparam != ""} {
+ append files "\t\t\t\t\t\t\tAdditionalOptions=\""
+ foreach paramm $needparam {
+ append files "$paramm "
+ }
+ append files "\"\n"
+ }
+ append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t</File>\n"
+ } else {
+ puts "Warning : in vcproj more than one occurences for [file tail $f]"
+ }
+ }
+ append files "\t\t\t</Filter>"
+ }
+
+ regsub -all -- {__FILES__} $temp1 $files temp2
+ puts $fp $temp2
+ close $fp
+ return $fvcproj
+}
+proc osutils:vc8 { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc8:readtemplate]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc8:fmtcpp]}
+ set fp [open [set fvcproj [file join $dir ${tkloc}.vcproj]] w]
+ fconfigure $fp -translation crlf
+ set l_compilable [osutils:vc8:compilable]
+ regsub -all -- {__TKNAM__} $tmplat $tkloc temp0
+ set tkused ""
+ foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {
+ append tkused "${tkx}.lib "
+ }
+ foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] $tkloc] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set felem [file tail [lindex [wokparam -v "%$element"] 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+
+ puts "$tkloc requires $tkused"
+ regsub -all -- {__TKDEP__} $temp0 $tkused temp1
+ set files ""
+ set listloc [osutils:tk:units [woklocate -u $tkloc]]
+ set resultloc [osutils:justwnt $listloc]
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ append files " <Filter\n"
+ append files " Name=\"${xlo}\"\n"
+ append files " Filter=\"\">\n"
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ set fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]
+ set fxloparam "$fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]"
+ set needparam ""
+ foreach partopt $fxloparam {
+ if { "-I[lindex [wokparam -v %CSF_TCL_INCLUDE] 0]" != "$partopt "} {
+ if { "-I[lindex [wokparam -v %CSF_JAVA_INCLUDE] 0]" != "$partopt "} {
+ set needparam "$needparam $partopt"
+ }
+ }
+ }
+ foreach f $lsrc {
+ #puts " f = $f"
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "\t\t\t\t<File\n"
+ append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Debug\|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ if {$needparam != ""} {
+ append files "\t\t\t\t\t\t\tAdditionalOptions=\""
+ foreach paramm $needparam {
+ append files "$paramm "
+ }
+ append files "\"\n"
+ }
+ append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Release\|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ if {$needparam != ""} {
+ append files "\t\t\t\t\t\t\tAdditionalOptions=\""
+ foreach paramm $needparam {
+ append files "$paramm "
+ }
+ append files "\"\n"
+ }
+ append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t</File>\n"
+ } else {
+ puts "Warning : in vcproj more than one occurences for [file tail $f]"
+ }
+ }
+ append files "\t\t\t</Filter>"
+ }
+
+ regsub -all -- {__FILES__} $temp1 $files temp2
+ puts $fp $temp2
+ close $fp
+ return $fvcproj
+}
+proc osutils:vc8_64 { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc8_64:readtemplate]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc8_64:fmtcpp]}
+ set fp [open [set fvcproj [file join $dir ${tkloc}.vcproj]] w]
+ fconfigure $fp -translation crlf
+ set l_compilable [osutils:vc8_64:compilable]
+ regsub -all -- {__TKNAM__} $tmplat $tkloc temp0
+ set tkused ""
+ foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {
+ append tkused "${tkx}.lib "
+ }
+ foreach tk [lappend [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] $tkloc] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set felem [file tail [lindex [wokparam -v "%$element"] 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+
+ puts "$tkloc requires $tkused"
+ regsub -all -- {__TKDEP__} $temp0 $tkused temp1
+ set files ""
+ set listloc [osutils:tk:units [woklocate -u $tkloc]]
+ set resultloc [osutils:justwnt $listloc]
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ append files " <Filter\n"
+ append files " Name=\"${xlo}\"\n"
+ append files " Filter=\"\">\n"
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ set fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]
+ set fxloparam "$fxloparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]"
+ set needparam ""
+ foreach partopt $fxloparam {
+ if { "-I[lindex [wokparam -v %CSF_TCL_INCLUDE] 0]" != "$partopt "} {
+ if { "-I[lindex [wokparam -v %CSF_JAVA_INCLUDE] 0]" != "$partopt "} {
+ set needparam "$needparam $partopt"
+ }
+ }
+ }
+ foreach f $lsrc {
+ #puts " f = $f"
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "\t\t\t\t<File\n"
+ append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Debug\|x64\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ if {$needparam != ""} {
+ append files "\t\t\t\t\t\t\tAdditionalOptions=\""
+ foreach paramm $needparam {
+ append files "$paramm "
+ }
+ append files "\"\n"
+ }
+ append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Release\|x64\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ if {$needparam != ""} {
+ append files "\t\t\t\t\t\t\tAdditionalOptions=\""
+ foreach paramm $needparam {
+ append files "$paramm "
+ }
+ append files "\"\n"
+ }
+ append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $xlo $xlo $xlo]\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t</File>\n"
+ } else {
+ puts "Warning : in vcproj more than one occurences for [file tail $f]"
+ }
+ }
+ append files "\t\t\t</Filter>"
+ }
+
+ regsub -all -- {__FILES__} $temp1 $files temp2
+ puts $fp $temp2
+ close $fp
+ return $fvcproj
+}
+;#
+;# Create file tkloc.dsp for a executable "console" application
+;# in dir return the full path of the created file
+;#
+proc osutils:vc6x { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc6:readtemplatex]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc6:fmtcppx]}
+ foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {
+ set tf [file rootname [file tail $f]]
+ set fp [open [set fdsp [file join $dir ${tf}.dsp]] w]
+ puts $fdsp
+ fconfigure $fp -translation crlf
+ set l_compilable [osutils:vc6:compilable]
+ regsub -all -- {__XQTNAM__} $tmplat $tf temp0
+ set tkused ""
+ puts [LibToLinkX [woklocate -u $tkloc] $tf]
+ foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {
+ if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {
+ append tkused "${tkx}.lib "
+ }
+# if {[lsearch [w_info -l] [woklocate -u $tkx]] == "-1"} {
+# append tkused "${tkx}.lib "
+# }
+ if {[woklocate -u $tkx] == "" } {
+ append tkused "${tkx}.lib "
+ }
+ }
+ foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokinfo -N [woklocate -u $tk]]]] {
+ if {[wokparam -t %$element] != 0} {
+ set elemlist [wokparam -v "%$element"]
+ set felem [file tail [lindex $elemlist 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ #puts "was found $element $felem"
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+ if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)"} {
+ set tkused [concat $tkused "\/dll"]
+ }
+ regsub -all -- {__COMPOPT__} $temp0 "\/MD" temp1
+ regsub -all -- {__COMPOPTD__} $temp1 "\/MDd" temp2
+ puts "$tf requires $tkused"
+ regsub -all -- {__TKDEP__} $temp2 $tkused temp3
+ set files ""
+ ;#set lsrc [osutils:tk:files $tkloc osutils:am:compilable 0]
+ ;#foreach f $lsrc {
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "# Begin Group \"" $tkloc "\" \n"
+ append files "# Begin Source File" "\n"
+ append files "SOURCE=..\\..\\..\\" [wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]] "\n"
+ append files [format $fmtcpp $tkloc $tkloc $tkloc] "\n"
+ append files "# End Source File" "\n"
+ append files "# End Group" "\n"
+ } else {
+ puts "Warning : in dsp more than one occurences for [file tail $f]"
+ }
+ ;#}
+
+ regsub -all -- {__FILES__} $temp3 $files temp4
+ puts $fp $temp4
+ close $fp
+ set fout [lappend fout $fdsp]
+ }
+ return $fout
+}
+proc osutils:vc7x { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc7:readtemplatex]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc7:fmtcppx]}
+ set fout {}
+ foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {
+ puts "1"
+ set tf [file rootname [file tail $f]]
+ set l_compilable [osutils:vc7:compilable]
+ regsub -all -- {__XQTNAM__} $tmplat $tf temp0
+ set tkused ""
+ foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {
+ if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {
+ append tkused "${tkx}.lib "
+ }
+ if {[lsearch [w_info -l] $tkx] == "-1"} {
+ append tkused "${tkx}.lib "
+ }
+ }
+ foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set elemlist [wokparam -v "%$element"]
+ set felem [file tail [lindex $elemlist 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ #puts "was found $element $felem"
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+ if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)"} {
+ set tkused [concat $tkused "\/dll"]
+ set binext 2
+ } else {
+ set binext 1
+ }
+ #puts "$tf requires $tkused"
+ regsub -all -- {__TKDEP__} $temp0 $tkused temp3
+ set files ""
+ ;#set lsrc [osutils:tk:files $tkloc osutils:am:compilable 0]
+ ;#foreach f $lsrc {
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "\t\t\t<Filter\n"
+ append files "\t\t\t\tName=\"$tkloc\"\n"
+ append files "\t\t\t\tFilter=\"\">\n"
+ append files "\t\t\t\t<File\n"
+ append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Debug|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"
+ append files "\t\t\t\t\t\t\tBasicRuntimeChecks=\"3\"\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Release|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t</File>\n"
+ append files "\t\t\t</Filter>\n"
+ } else {
+ puts "Warning : in dsp more than one occurences for [file tail $f]"
+ }
+ ;#}
+ #puts "$temp3 $files"
+ regsub -all -- {__FILES__} $temp3 $files temp4
+ regsub -all -- {__CONF__} $temp4 $binext temp5
+ set fp [open [set fdsp [file join $dir ${tf}.vcproj]] w]
+ fconfigure $fp -translation crlf
+
+ puts $fp $temp5
+ set fout [lappend fout $fdsp]
+ close $fp
+ }
+ return $fout
+}
+
+proc osutils:vc8x { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc8:readtemplatex]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc8:fmtcppx]}
+ set fout {}
+ foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {
+ puts "1"
+ set tf [file rootname [file tail $f]]
+ set l_compilable [osutils:vc8:compilable]
+ regsub -all -- {__XQTNAM__} $tmplat $tf temp0
+ set tkused ""
+ foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {
+ if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {
+ append tkused "${tkx}.lib "
+ }
+ if {[lsearch [w_info -l] $tkx] == "-1"} {
+ append tkused "${tkx}.lib "
+ }
+ }
+ foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set elemlist [wokparam -v "%$element"]
+ set felem [file tail [lindex $elemlist 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ #puts "was found $element $felem"
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+ if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)"} {
+ set tkused [concat $tkused "\/dll"]
+ set binext 2
+ } else {
+ set binext 1
+ }
+ #puts "$tf requires $tkused"
+ regsub -all -- {__TKDEP__} $temp0 $tkused temp3
+ set files ""
+ ;#set lsrc [osutils:tk:files $tkloc osutils:am:compilable 0]
+ ;#foreach f $lsrc {
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "\t\t\t<Filter\n"
+ append files "\t\t\t\tName=\"$tkloc\"\n"
+ append files "\t\t\t\tFilter=\"\">\n"
+ append files "\t\t\t\t<File\n"
+ append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Debug|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"
+ append files "\t\t\t\t\t\t\tBasicRuntimeChecks=\"3\"\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Release|Win32\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t</File>\n"
+ append files "\t\t\t</Filter>\n"
+ } else {
+ puts "Warning : in dsp more than one occurences for [file tail $f]"
+ }
+ ;#}
+ #puts "$temp3 $files"
+ regsub -all -- {__FILES__} $temp3 $files temp4
+ regsub -all -- {__CONF__} $temp4 $binext temp5
+ set fp [open [set fdsp [file join $dir ${tf}.vcproj]] w]
+ fconfigure $fp -translation crlf
+
+ puts $fp $temp5
+ set fout [lappend fout $fdsp]
+ close $fp
+ }
+ return $fout
+}
+
+proc osutils:vc8x_64 { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:vc8_64:readtemplatex]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:vc8_64:fmtcppx]}
+ set fout {}
+ foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {
+ puts "1"
+ set tf [file rootname [file tail $f]]
+ set l_compilable [osutils:vc8_64:compilable]
+ regsub -all -- {__XQTNAM__} $tmplat $tf temp0
+ set tkused ""
+ foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {
+ if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {
+ append tkused "${tkx}.lib "
+ }
+ if {[lsearch [w_info -l] $tkx] == "-1"} {
+ append tkused "${tkx}.lib "
+ }
+ }
+ foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set elemlist [wokparam -v "%$element"]
+ set felem [file tail [lindex $elemlist 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ #puts "was found $element $felem"
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+ if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)"} {
+ set tkused [concat $tkused "\/dll"]
+ set binext 2
+ } else {
+ set binext 1
+ }
+ #puts "$tf requires $tkused"
+ regsub -all -- {__TKDEP__} $temp0 $tkused temp3
+ set files ""
+ ;#set lsrc [osutils:tk:files $tkloc osutils:am:compilable 0]
+ ;#foreach f $lsrc {
+ if { ![info exists written([file tail $f])] } {
+ set written([file tail $f]) 1
+ append files "\t\t\t<Filter\n"
+ append files "\t\t\t\tName=\"$tkloc\"\n"
+ append files "\t\t\t\tFilter=\"\">\n"
+ append files "\t\t\t\t<File\n"
+ append files "\t\t\t\t\tRelativePath=\"..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $f 3]]\">\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Debug|x64\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ append files "\t\t\t\t\t\t\tOptimization=\"0\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"
+ append files "\t\t\t\t\t\t\tBasicRuntimeChecks=\"3\"\n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t\t<FileConfiguration\n"
+ append files "\t\t\t\t\t\tName=\"Release|x64\">\n"
+ append files "\t\t\t\t\t\t<Tool\n"
+ append files "\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n"
+ append files "\t\t\t\t\t\t\tOptimization=\"2\"\n"
+ append files "\t\t\t\t\t\t\t[format $fmtcpp $tkloc $tkloc $tkloc] \n"
+ append files "\t\t\t\t\t\t\tCompileAs=\"0\"/>\n"
+ append files "\t\t\t\t\t</FileConfiguration>\n"
+ append files "\t\t\t\t</File>\n"
+ append files "\t\t\t</Filter>\n"
+ } else {
+ puts "Warning : in dsp more than one occurences for [file tail $f]"
+ }
+ ;#}
+ #puts "$temp3 $files"
+ regsub -all -- {__FILES__} $temp3 $files temp4
+ regsub -all -- {__CONF__} $temp4 $binext temp5
+ set fp [open [set fdsp [file join $dir ${tf}.vcproj]] w]
+ fconfigure $fp -translation crlf
+
+ puts $fp $temp5
+ set fout [lappend fout $fdsp]
+ close $fp
+ }
+ return $fout
+}
+
+;#
+;# Create file tkloc.mak for a shareable library (dll).
+;# in dir return the full path of the created file
+;#
+proc osutils:mkmak { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ puts $tkloc
+ if { $tmplat == {} } {set tmplat [osutils:mak:readtemplate]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:mak:fmtcpp]}
+ set fp [open [set fdsp [file join $dir ${tkloc}.mak]] w]
+ fconfigure $fp -translation crlf
+ set l_compilable [osutils:vc6:compilable]
+ set tkused [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]
+ set listloc [osutils:tk:units [woklocate -u $tkloc]]
+ set resultloc [osutils:justwnt $listloc]
+ regsub -all -- {__TKNAM__} $tmplat $tkloc temp0
+ set area1 ""
+ append area1 "\!IF \"\$(RECURSE)\" == \"0\" \n"
+ append area1 "ALL : \"\$(OUTDIR)\\${tkloc}.dll\"\n"
+ append area1 "\!ELSE\n"
+ append area1 "ALL : "
+ if {$tkused != ""} {
+ foreach tkproj $tkused {
+ append area1 "\"$tkproj - Win32 Release\" "
+ }
+ }
+ append area1 " \"\$(OUTDIR)\\$tkloc.dll\"\n"
+ append area1 "\!ENDIF \n"
+ append area1 "\!IF \"\$(RECURSE)\" == \"1\"\n"
+ append area1 "CLEAN :"
+ if {$tkused != ""} {
+ foreach tkproj $tkused {
+ append area1 "\"$tkproj - Win32 ReleaseCLEAN\" "
+ }
+ }
+ append area1 "\n"
+ append area1 "\!ELSE\n"
+ append area1 "CLEAN :\n"
+ append area1 "\!ENDIF\n"
+ set tclused 0
+ set javaused 0
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ set fxlocxxparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]
+ set fxlocparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]
+ if {[lsearch [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_TCL_INCLUDE] 0] 0 end]"] != -1} {
+ set tclused 1
+ }
+ if {[lsearch [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_JavaHome]/include 0] 0 end]"] != -1} {
+ set javaused 1
+ }
+ if {[lsearch [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_TCL_INCLUDE] 0] 0 end]"] != -1} {
+ set tclused 1
+ }
+ if {[lsearch [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0] "-I[lrange [lindex [wokparam -v %CSF_JavaHome]/include 0] 0 end]"] != -1} {
+ set javaused 1
+ }
+
+ foreach srcfile $lsrc {
+ if { ![info exists written([file tail $srcfile])] } {
+ set written([file tail $srcfile]) 1
+ append area1 "\t-@erase \"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\"\n"
+ }
+ }
+ }
+ regsub -all -- {__FIELD1__} $temp0 $area1 temp1
+
+ set area2 "LINK32_FLAGS=-nologo -subsystem:windows -dll -incremental:no -machine:IX86 -libpath:\"\$(LIBDIR)\" -implib:\$(LIBDIR)\\$tkloc.lib -out:\$(OUTDIR)\\$tkloc.dll "
+ set libused ""
+ foreach tkx [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]] {
+ append libused "${tkx}.lib "
+ }
+ set ltk [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]
+ set ltk [lappend ltk $tkloc]
+ foreach tk $ltk {
+ foreach element [osutils:tk:hascsf [woklocate -p $tk:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set felem [file tail [lindex [wokparam -v "%$element"] 0]]
+ if {[lsearch $libused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ set libused [concat $libused $felem]
+ }
+ }
+ }
+ }
+ }
+ if {$tclused == 1} {
+ append area2 "-libpath:\"\$(TCLHOME)\\lib\" "
+ }
+
+ foreach tk $libused {
+ append area2 "$tk "
+ }
+ append area2 "\n"
+ append area2 "LINK32_OBJS= \\\n"
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ foreach srcfile $lsrc {
+ if { ![info exists written([file tail $srcfile])] } {
+ set written([file tail $srcfile]) 1
+ append area2 "\t\"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\" \\\n"
+ }
+ }
+ }
+
+ regsub -all -- {__FIELD2__} $temp1 $area2 temp2
+
+ set area3 ""
+ append area3 "\!IF \"\$(RECURSE)\" == \"0\" \n"
+ append area3 "ALL : \"\$(OUTDIR)\\${tkloc}.dll\"\n"
+ append area3 "\!ELSE\n"
+ append area3 "ALL : "
+ if {$tkused != ""} {
+ foreach tkproj $tkused {
+ append area3 "\"$tkproj - Win32 Debug\" "
+ }
+ }
+ append area3 " \"\$(OUTDIR)\\$tkloc.dll\"\n"
+ append area3 "\!ENDIF \n"
+ append area3 "\!IF \"\$(RECURSE)\" == \"1\"\n"
+ append area3 "CLEAN :"
+ if {$tkused != ""} {
+ foreach tkproj $tkused {
+ append area3 "\"$tkproj - Win32 DebugCLEAN\""
+ }
+ }
+ append area3 "\n"
+ append area3 "\!ELSE\n"
+ append area3 "CLEAN :\n"
+ append area3 "\!ENDIF\n"
+ if [array exists written] { unset written }
+
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+
+ foreach srcfile $lsrc {
+ if { ![info exists written([file tail $srcfile])] } {
+ set written([file tail $srcfile]) 1
+ append area3 "\t-@erase \"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\"\n"
+ }
+ }
+ }
+ regsub -all -- {__FIELD3__} $temp2 $area3 temp3
+
+ set area4 "LINK32_FLAGS=-nologo -subsystem:windows -dll -incremental:no -machine:IX86 -debug -libpath:\"\$(LIBDIR)\" -implib:\$(LIBDIR)\\$tkloc.lib -out:\$(OUTDIR)\\$tkloc.dll -pdb:\$(OUTDIR)\\$tkloc.pdb "
+ foreach tk $libused {
+ append area4 "$tk "
+ }
+ if {$tclused == 1} {
+ append area4 "-libpath:\"\$(TCLHOME)\\lib\" "
+ }
+
+ append area4 "\n"
+ append area4 "LINK32_OBJS= \\\n"
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ foreach srcfile $lsrc {
+ if { ![info exists written([file tail $srcfile])] } {
+ set written([file tail $srcfile]) 1
+ append area4 "\t\"\$(INTDIR)\\[wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]].obj\" \\\n"
+ }
+ }
+ }
+
+ regsub -all -- {__FIELD4__} $temp3 $area4 temp4
+
+ set area5 ""
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo [wokinfo -n $fxlo]
+ set lsrc [osutils:tk:files $xlo osutils:am:compilable 0]
+ set fxlocxxparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_CXX_Options] 0]] [split [lindex [wokparam -v %CMPLRS_CXX_Options $fxlo] 0]] ] 2]
+ set fxlocparam [lindex [intersect3 [split [lindex [wokparam -v %CMPLRS_C_Options] 0]] [split [lindex [wokparam -v %CMPLRS_C_Options $fxlo] 0]] ] 2]
+ if {$tclused == 1} {
+ set fxlocxxparam "-I\$(TCLHOME)\\include"
+ }
+ if {$javaused == 1} {
+ set fxlocxxparam "-I\$(JAVAHOME)\\include -I\$(JAVAHOME)\\include\\win32"
+ }
+ set fxloparam "$fxlocparam $fxlocxxparam"
+ #puts $fxloparam
+ foreach srcfile $lsrc {
+ if { ![info exists written([file tail $srcfile])] } {
+ set written([file tail $srcfile]) 1
+ set pkname [wokUtils:EASY:bs1 [file root [wokUtils:FILES:wtail $srcfile 1]]]
+
+ append area5 "SOURCE=..\\..\\..\\[wokUtils:EASY:bs1 [wokUtils:FILES:wtail $srcfile 3]]\n"
+ append area5 "\!IF \"\$(CFG)\" == \"$tkloc - Win32 Release\"\n"
+ append area5 "CPP_SWITCHES=\/nologo \/MD \/W3 \/GX \/O2 $fxloparam \/I \"..\\..\\..\\inc\" \/I \"..\\..\\..\\drv\\$xlo\" \/I \"..\\..\\..\\src\\$xlo\" \/D \"WIN32\" \/D \"NDEBUG\" \/D \"_WINDOWS\" \/D \"WNT\" \/D \"No_Exception\" \/D \"__${xlo}_DLL\" \/Fo\"\$(INTDIR)\\\\\\\" \/Fd\"\$(INTDIR)\\\\\\\" \/FD \/D \"CSFDB\" \/c\n"
+ append area5 "\"\$(INTDIR)\\$pkname.obj\" : \$(SOURCE) \"\$(INTDIR)\"\n"
+ append area5 "\t\t\$(CPP) \$(CPP_SWITCHES) \$(SOURCE)\n"
+ append area5 "\n"
+ append area5 "\!ELSEIF \"\$(CFG)\" == \"$tkloc - Win32 Debug\"\n"
+ append area5 "CPP_SWITCHES=\/nologo \/MDd \/W3 \/GX \/Zi \/Od $fxloparam \/I \"..\\..\\..\\inc\" \/I \"..\\..\\..\\drv\\$xlo\" \/I \"..\\..\\..\\src\\$xlo\" \/D \"WIN32\" \/D \"DEB\" \/D \"_DEBUG\" \/D \"_WINDOWS\" \/D \"WNT\" \/D \"CSFDB\" \/D \"__${xlo}_DLL\" \/Fo\"\$(INTDIR)\\\\\\\" \/Fd\"\$(INTDIR)\\\\\\\" \/FD \/c \n"
+ append area5 "\"\$(INTDIR)\\$pkname.obj\" : \$(SOURCE) \"\$(INTDIR)\"\n"
+ append area5 "\t\t\$(CPP) \$(CPP_SWITCHES) \$(SOURCE)\n"
+ append area5 "\n"
+ append area5 "\!ENDIF \n"
+ }
+ }
+ }
+ regsub -all -- {__FIELD5__} $temp4 $area5 temp5
+
+ set area6 ""
+ foreach tk $tkused {
+ append area6 "\!IF \"\$(CFG)\" == \"$tkloc - Win32 Release\"\n"
+ append area6 "\"$tk - Win32 Release\" \: \n"
+ append area6 " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" \n"
+ append area6 "\"$tk - Win32 ReleaseCLEAN\" \: \n"
+ append area6 " \$(MAKE)\/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" RECURSE=1 CLEAN\n"
+ append area6 "\!ELSEIF \"\$(CFG)\" == \"$tkloc - Win32 Debug\"\n"
+ append area6 "\"$tk - Win32 Debug\" \: \n"
+ append area6 " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" \n"
+ append area6 "\"$tk - Win32 DebugCLEAN\" \: \n"
+ append area6 " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" RECURSE=1 CLEAN\n"
+ append area6 "\!ENDIF\n"
+ }
+ regsub -all -- {__FIELD6__} $temp5 $area6 temp6
+
+ if {$tclused == 1} {
+ set tclwarning "\!IFNDEF TCLHOME \n\!MESSAGE Compilation of this toolkit requires tcl. Set TCLHOME environment variable for proper compilation\n\!ENDIF"
+ } else {
+ set tclwarning ""
+ }
+ regsub -all -- {__TCLUSED__} $temp6 $tclwarning temp7
+
+ if {$javaused == 1} {
+ set javawarning "\!IFNDEF JAVAHOME \n\!MESSAGE Compilation of this toolkit requires java. Set JAVAHOME environment variable for proper compilation\n\!ENDIF"
+ } else {
+ set javawarning ""
+ }
+ regsub -all -- {__JAVAUSED__} $temp7 $javawarning temp8
+ puts $fp $temp8
+ close $fp
+ return $fdsp
+}
+
+proc osutils:mkmakx { dir tkloc {tmplat {} } {fmtcpp {} } } {
+ if { $tmplat == {} } {set tmplat [osutils:mak:readtemplatex]}
+ if { $fmtcpp == {} } {set fmtcpp [osutils:mak:fmtcppx]}
+ foreach f [osutils:tk:files $tkloc osutils:am:compilable 0] {
+ set tf [file rootname [file tail $f]]
+ set fp [open [set fdsp [file join $dir ${tf}.mak]] w]
+ puts $fdsp
+ set tclused 0
+ fconfigure $fp -translation crlf
+ set l_compilable [osutils:vc6:compilable]
+ regsub -all -- {__XQTNAM__} $tmplat $tf temp0
+ set tkused ""
+ puts [LibToLinkX [woklocate -u $tkloc] $tf]
+ foreach tkx [LibToLinkX [woklocate -u $tkloc] $tf] {
+ if {[uinfo -t [woklocate -u $tkx]] == "toolkit"} {
+ append tkused "${tkx}.lib "
+ }
+ if {[woklocate -u $tkx] == "" } {
+ append tkused "${tkx}.lib "
+ }
+ }
+ foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[wokparam -t %$element] != 0} {
+ set elemlist [wokparam -v "%$element"]
+ set felem [file tail [lindex $elemlist 0]]
+ if {[lsearch $tkused $felem] == "-1"} {
+ if {$felem != "\{\}"} {
+ #puts "was found $element $felem"
+ if {$element == "CSF_TclLibs"} { set tclused 1}
+ set tkused [concat $tkused $felem]
+ }
+ }
+ }
+ }
+ }
+
+ if {[wokparam -v %WOKSteps_exec_link [woklocate -u $tkloc]] == "#WOKStep_DLLink(exec.tks)" } {
+ set tkused [concat $tkused "\/dll"]
+ if {$tclused != 1} {
+ regsub -all -- {__COMPOPT__} $temp0 "\/MD" temp1
+ regsub -all -- {__COMPOPTD__} $temp1 "\/MDd" temp2
+ } else {
+ regsub -all -- {__COMPOPT__} $temp0 "\/MD \/I \"\$(TCLHOME)\\include\"" temp1
+ regsub -all -- {__COMPOPTD__} $temp1 "\/MDd \/I \"\$(TCLHOME)\\include\"" temp2
+ }
+ regsub -all -- {__XQTNAMEX__} $temp2 "$tf.dll" temp3
+ } else {
+ if {$tclused != 1} {
+ regsub -all -- {__COMPOPT__} $temp0 "\/MD" temp1
+ regsub -all -- {__COMPOPTD__} $temp1 "\/MDd" temp2
+ } else {
+ regsub -all -- {__COMPOPT__} $temp0 "\/MD \/I \"\$(TCLHOME)\\include\"" temp1
+ regsub -all -- {__COMPOPTD__} $temp1 "\/MDd \/I \"\$(TCLHOME)\\include\"" temp2
+ }
+ regsub -all -- {__XQTNAMEX__} $temp2 "$tf.exe" temp3
+ }
+ #puts "$tf requires $tkused"
+ if {$tclused == 1} {
+ append tkused " -libpath:\"\$(TCLHOME)\\lib\" "
+ }
+ regsub -all -- {__TKDEP__} $temp3 $tkused temp4
+ set files ""
+ set field1 ""
+ set field2 ""
+ set field3 ""
+ set field4 ""
+ foreach tk [LibToLinkX [woklocate -u $tkloc] $tf] {
+
+ append files "\!IF \"\$(CFG)\" == \"$tf - Win32 Release\"\n"
+ append files "\"$tk - Win32 Release\" \: \n"
+ append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" \n"
+ append files "\"$tk - Win32 ReleaseCLEAN\" \: \n"
+ append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Release\" RECURSE=1 CLEAN\n"
+ append files "\!ELSEIF \"\$(CFG)\" == \"$tf - Win32 Debug\"\n"
+ append files "\"$tk - Win32 Debug\" \: \n"
+ append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" \n"
+ append files "\"$tk - Win32 DebugCLEAN\" \: \n"
+ append files " \$(MAKE) \/NOLOGO \/\$(MAKEFLAGS) \/F .\\$tk.mak CFG=\"$tk - Win32 Debug\" RECURSE=1 CLEAN\n"
+ append files "\!ENDIF\n"
+
+ append field1 "\"$tk - Win32 Release\" "
+ append field2 "\"$tk - Win32 ReleaseCLEAN\" "
+ append field3 "\"$tk - Debug\" "
+ append field4 "\"$tk - Win32 DebugCLEAN\" "
+
+ }
+ regsub -all -- {__FILES__} $temp4 $files temp5
+ regsub -all -- {__FIELD1__} $temp5 $field1 temp6
+ regsub -all -- {__FIELD2__} $temp6 $field2 temp7
+ regsub -all -- {__FIELD3__} $temp7 $field3 temp8
+ regsub -all -- {__FIELD4__} $temp8 $field4 temp9
+ regsub -all -- {__XNAM__} $temp9 $tkloc temp10
+ puts $fp $temp10
+ close $fp
+ set fout [lappend fout $fdsp]
+ }
+ return $fout
+}
+
+
+;#
+;# (((((((((((((((((((((((( AUTOMAKE/ PROJECTs )))))))))))))))))))))))
+;#
+;# Create in dir the Makefile.am associated with toolkit tkloc.
+;# Returns the full path of the created file.
+;#
+proc osutils:tk:mkam { dir tkloc } {
+ set pkgs [woklocate -p ${tkloc}:PACKAGES]
+ if { $pkgs == {} } {
+ puts stderr "osutils:tk:mkam : Error. File PACKAGES not found for toolkit $tkloc."
+ return {}
+ }
+
+ set tmplat [osutils:am:readtemplate]
+ set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
+ set close [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]
+ set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justunix]]
+ set lobj [wokUtils:LIST:sanspoint $lsrc]
+
+ set lcsf [osutils:tk:hascsf [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]
+
+ set final 0
+ set externinc ""
+ set externlib ""
+ if { $lcsf != {} } {
+ set final 1
+ set fmtinc "\$(%s_INCLUDES) "
+ set fmtlib "\$(%s_LIB) "
+ set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
+ set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
+ }
+
+ regsub -all -- {__TKNAM__} "$tmplat" "$tkloc" temp0
+ set vpath [osutils:am:__VPATH__ $lpkgs]
+ regsub -all -- {__VPATH__} "$temp0" "$vpath" temp1
+ set inclu [osutils:am:__INCLUDES__ $lpkgs]
+ regsub -all -- {__INCLUDES__} "$temp1" "$inclu" temp2
+ if { $close != {} } {
+ set libadd [osutils:am:__LIBADD__ $close $final]
+ } else {
+ set libadd ""
+ }
+ regsub -all -- {__LIBADD__} "$temp2" "$libadd" temp3
+ set source [osutils:am:__SOURCES__ $lsrc]
+ regsub -all -- {__SOURCES__} "$temp3" "$source" temp4
+ regsub -all -- {__EXTERNINC__} "$temp4" "$externinc" temp5
+ set CXXFl [osutils:am:__CXXFLAG__ $lpkgs]
+ regsub -all -- {__CXXFLAG__} "$temp5" "$CXXFl" temp6
+ set CFl [osutils:am:__CFLAG__ $lpkgs]
+ regsub -all -- {__CFLAG__} "$temp6" "$CFl" temp7
+
+ regsub -all -- {__EXTERNLIB__} "$temp7" "$externlib" MakeFile_am
+
+ wokUtils:FILES:StringToFile "$MakeFile_am" [set fmam [file join $dir Makefile.am]]
+
+ catch { unset temp0 temp1 temp2 temp3 temp4 temp5 temp6 temp7}
+
+ #set tmplat [osutils:in:readtemplate]
+
+ #regsub -all -- {__TKNAM__} "$tmplat" "$tkloc" temp0
+ #if { $close != {} } {
+ #set dpncies [osutils:in:__DEPENDENCIES__ $close]
+ #} else {
+ #set dpncies ""
+ #}
+ #regsub -all -- {__DEPENDENCIES__} "$temp0" "$dpncies" temp1
+
+ #set objects [osutils:in:__OBJECTS__ $lobj]
+ #regsub -all -- {__OBJECTS__} "$temp1" "$objects" temp2
+ #set amdep [osutils:in:__AMPDEP__ $lobj]
+ #regsub -all -- {__AMPDEP__} "$temp2" "$amdep" temp3
+ #set amdeptrue [osutils:in:__AMDEPTRUE__ $lobj]
+ #regsub -all -- {__AMDEPTRUE__} "$temp3" "$amdeptrue" temp4
+;# so easy..
+ #regsub -all -- {__MAKEFILEIN__} "$temp4" "$MakeFile_am" MakeFile_in
+
+ #wokUtils:FILES:StringToFile "$MakeFile_in" [set fmin [file join $dir Makefile.in]]
+
+ return [list $fmam]
+ #return [list $fmam $fmin]
+}
+;#
+;# Create in dir the Makefile.am associated with toolkit tkloc.
+;# Returns the full path of the created file.
+;#
+proc osutils:tk:mkamx { dir tkloc } {
+ if { [lsearch [uinfo -f -T source [woklocate -u $tkloc]] ${tkloc}_WOKSteps.edl] != "-1"} {
+ set pkgs [woklocate -p ${tkloc}:EXTERNLIB]
+ if { $pkgs == {} } {
+ puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."
+ #return {}
+ }
+ set tmplat [osutils:am:readtemplatex]
+ set close [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]
+ set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justunix]]
+ set lobj [wokUtils:LIST:sanspoint $lsrc]
+ set CXXList {}
+ foreach SourceFile [uinfo -f -T source [woklocate -u $tkloc]] {
+ if {[file extension $SourceFile] == ".cxx"} {
+ lappend CXXList [file rootname $SourceFile]
+ }
+ }
+ set pkgs [LibToLinkX [woklocate -u $tkloc] [lindex $CXXList 0]]
+ set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
+ puts "pkgs $pkgs"
+ #set lcsf [osutils:tk:hascsf [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]
+
+ set lcsf {}
+ foreach tk $pkgs {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[lsearch $lcsf $element] == "-1"} {
+ set lcsf [concat $lcsf $element]
+ }
+ }
+ }
+ set final 0
+ set externinc ""
+ set externlib ""
+ if { $lcsf != {} } {
+ set final 1
+ set fmtinc "\$(%s_INCLUDES) "
+ set fmtlib "\$(%s_LIB) "
+ set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
+ set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
+ }
+ regsub -all -- {__XQTNAM__} "$tmplat" "$tkloc" temp0
+ set temp1 "$temp0 \nlib_LTLIBRARIES="
+ foreach entity $CXXList {
+ set temp1 "${temp1} lib${entity}.la"
+ }
+ set temp1 "${temp1}\n"
+ set inclu [osutils:am:__INCLUDES__ $lpkgs]
+ regsub -all -- {__INCLUDES__} "$temp1" "$inclu" temp2
+ if { $pkgs != {} } {
+ set libadd [osutils:am:__LIBADD__ $pkgs $final]
+ } else {
+ set libadd ""
+ }
+ regsub -all -- {__LIBADD__} "$temp2" "$libadd" temp3
+ set source [osutils:am:__SOURCES__ $CXXList]
+ regsub -all -- {__SOURCES__} "$temp3" "$source" temp4
+ regsub -all -- {__EXTERNINC__} "$temp4" "$externinc" MakeFile_am
+ foreach entity $CXXList {
+ set MakeFile_am "$MakeFile_am lib${entity}_la_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"
+ }
+ foreach entity $CXXList {
+ set MakeFile_am "$MakeFile_am lib${entity}_la_LIBADD = $libadd $externlib \n"
+ }
+ wokUtils:FILES:StringToFile "$MakeFile_am" [set fmam [file join $dir Makefile.am]]
+
+ catch { unset temp0 temp1 temp2 temp3 temp4 temp5}
+ return [list $fmam]
+
+ } else {
+ set pkgs [woklocate -p ${tkloc}:EXTERNLIB]
+ if { $pkgs == {} } {
+ puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."
+ #return {}
+ }
+ set tmplat [osutils:am:readtemplatex]
+ set close [wokUtils:LIST:Purge [osutils:tk:close [woklocate -u $tkloc]]]
+ set lsrc [lsort [osutils:tk:files $tkloc osutils:am:compilable 1 osutils:justunix]]
+ set lobj [wokUtils:LIST:sanspoint $lsrc]
+ set CXXList {}
+ foreach SourceFile [uinfo -f -T source [woklocate -u $tkloc]] {
+ if {[file extension $SourceFile] == ".cxx"} {
+ lappend CXXList [file rootname $SourceFile]
+ }
+ }
+ set pkgs [LibToLinkX [woklocate -u $tkloc] [lindex $CXXList 0]]
+ set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
+ set lcsf [osutils:tk:hascsf [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]
+
+ set lcsf {}
+ foreach tk $pkgs {
+ foreach element [osutils:tk:hascsf [woklocate -p ${tk}:source:EXTERNLIB [wokcd]]] {
+ if {[lsearch $lcsf $element] == "-1"} {
+ set lcsf [concat $lcsf $element]
+ }
+ }
+ }
+ set final 0
+ set externinc ""
+ set externlib ""
+ if { $lcsf != {} } {
+ set final 1
+ set fmtinc "\$(%s_INCLUDES) "
+ set fmtlib "\$(%s_LIB) "
+ set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
+ set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
+ }
+ regsub -all -- {__XQTNAM__} "$tmplat" "$tkloc" temp0
+ set temp1 "$temp0 \nbin_PROGRAMS="
+ foreach entity $CXXList {
+ set temp1 "${temp1} ${entity}"
+ }
+
+ set temp1 "${temp1}\n"
+ set inclu [osutils:am:__INCLUDES__ $lpkgs]
+ regsub -all -- {__INCLUDES__} "$temp1" "$inclu" temp2
+ if { $pkgs != {} } {
+ set libadd [osutils:am:__LIBADD__ $pkgs $final]
+ } else {
+ set libadd ""
+ }
+ set source [osutils:am:__SOURCES__ $CXXList]
+ regsub -all -- {__SOURCES__} "$temp2" "$source" temp3
+ regsub -all -- {__EXTERNINC__} "$temp3" "$externinc" MakeFile_am
+ foreach entity $CXXList {
+ set MakeFile_am "$MakeFile_am ${entity}_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"
+ }
+ foreach entity $CXXList {
+ set MakeFile_am "$MakeFile_am ${entity}_LDADD = $libadd $externlib \n"
+ }
+ wokUtils:FILES:StringToFile "$MakeFile_am" [set fmam [file join $dir Makefile.am]]
+
+ catch { unset temp0 temp1 temp2 temp3 temp4 temp5}
+
+ # set tmplat [osutils:in:readtemplatex]
+
+ # regsub -all -- {__XQTNAM__} "$tmplat" "$tkloc" temp0
+ # if { $close != {} } {
+ #set dpncies [osutils:in:__DEPENDENCIES__ $close]
+ # } else {
+ #set dpncies ""
+ # }
+ # regsub -all -- {__DEPENDENCIES__} "$temp0" "$dpncies" temp1
+
+ # set objects [osutils:in:__OBJECTS__ $lobj]
+ # regsub -all -- {__OBJECTS__} "$temp1" "$objects" temp2
+ # #set temp2 $temp1
+ # set amdep [osutils:in:__AMPDEP__ $lobj]
+ # regsub -all -- {__AMPDEP__} "$temp2" "$amdep" temp3
+ #set temp3 $temp2
+ # set amdeptrue [osutils:in:__AMDEPTRUE__ $lobj]
+ # regsub -all -- {__AMDEPTRUE__} "$temp3" "$amdeptrue" temp4
+ #set temp4 $temp3
+;# so easy..
+ # regsub -all -- {__MAKEFILEIN__} "$temp4" "$MakeFile_am" MakeFile_in
+
+ #wokUtils:FILES:StringToFile "$MakeFile_in" [set fmin [file join $dir Makefile.in]]
+ return [list $fmam]
+ #return [list $fmam $fmin]
+ }
+}
+
+;#
+;# ((((((((((((( Formats in Makefile.am )))))))))))))
+;#
+;# List extensions of files compilable in automake
+;#
+proc osutils:am:compilable { } {
+ return [list .c .cxx .cpp]
+}
+;#
+;# Used to replace the string __VPATH__ in Makefile.am
+;# l is the list of the units in a toolkit.
+;#
+proc osutils:am:__VPATH__ { l } {
+ set fmt "@top_srcdir@/drv/%s : @top_srcdir@/src/%s:"
+ return [wokUtils:EASY:FmtString2 $fmt $l 0 osutils:am:__VPATH__lastoccur]
+}
+;#
+;# remove ":" from last item of dependencies list in target VPATH of Makefile.am
+;#
+proc osutils:am:__VPATH__lastoccur { str } {
+ if { [regsub {:$} $str "" u] != 0 } {
+ return $u
+ }
+}
+proc osutils:am:PkCXXOption ppk {
+ set CXXCOMMON [lindex [wokparam -e %CMPLRS_CXX_Options [wokcd]] 0]
+ set FoundFlag ""
+ foreach pk $ppk {
+ if {[lsearch [uinfo -f -T source [woklocate -u $pk]] ${pk}_CMPLRS.edl] != "-1"} {
+ set CXXStr [lindex [wokparam -e %CMPLRS_CXX_Options [woklocate -u $pk]] 0]
+ set LastIndex [expr {[string length $CXXCOMMON ] - 1}]
+ if {[string equal $CXXCOMMON [string range $CXXStr 0 $LastIndex]]} {
+ set CXXOption " "
+ } else {
+ set CXXOption [string range $CXXStr 0 [expr {[string last $CXXCOMMON $CXXStr] - 1}]]
+ }
+ if {$CXXOption != " " && $CXXOption != "" && $CXXOption != " " && $CXXOption != " "} {
+ set FoundList [split $CXXOption " "]
+ foreach elem $FoundList {
+ if {$elem != ""} {
+ if {[string first "-I" $elem] == "-1" } {
+ if {[string first $elem $FoundFlag] == "-1"} {
+ set FoundFlag "$FoundFlag $elem"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return $FoundFlag
+}
+
+proc osutils:am:PkCOption ppk {
+ set CCOMMON [lindex [wokparam -e %CMPLRS_C_Options [wokcd]] 0]
+ set FoundFlag ""
+ foreach pk $ppk {
+ if {[lsearch [uinfo -f -T source [woklocate -u $pk]] ${pk}_CMPLRS.edl] != "-1"} {
+ set CStr [lindex [wokparam -e %CMPLRS_C_Options [woklocate -u $pk]] 0]
+ set LastIndex [expr {[string length $CCOMMON ] - 1}]
+ if {[string equal $CCOMMON [string range $CStr 0 $LastIndex]]} {
+ set COption [string range $CStr $LastIndex end ]
+ } else {
+ set COption [string range $CStr 0 [expr {[string last $CCOMMON $CStr] - 1}]]
+ }
+ if {$COption != " " && $COption != "" && $COption != " " && $COption != " "} {
+ set FoundList [split $COption " "]
+ foreach elem $FoundList {
+ if {$elem != ""} {
+ if {[string first "-I" $elem] == "-1" } {
+ if {[string first $elem $FoundFlag] == "-1"} {
+ set FoundFlag "$FoundFlag $elem"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+return $FoundFlag
+}
+
+proc osutils:am:__CXXFLAG__ { l } {
+ set fmt "%s"
+ #puts "l is: $l"
+ return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCXXOption $l]]
+}
+;#
+;# Used to replace the string __CFLAG__ in Makefile.am
+;# l is the list of all compilable files in a toolkit.
+;#
+proc osutils:am:__CFLAG__ { l } {
+ set fmt "%s"
+ return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCOption $l]]
+}
+
+;#
+;# Used to replace the string __INCLUDES__ in Makefile.am
+;# l is the list of packages in a toolkit.
+;#
+proc osutils:am:__INCLUDES__ { l } {
+ set fmt "-I@top_srcdir@/drv/%s -I@top_srcdir@/src/%s"
+ return [wokUtils:EASY:FmtString2 $fmt $l]
+}
+;#
+;# Used to replace the string __LIBADD__ in Makefile.am
+;# l is the toolkit closure list of a toolkit.
+;#
+proc osutils:am:__LIBADD__ { l {final 0} } {
+ set fmt "../%s/lib%s.la"
+ return [wokUtils:EASY:FmtString2 $fmt $l $final]
+}
+;#
+;# Used to replace the string __SOURCES__ in Makefile.am
+;# l is the list of all compilable files in a toolkit.
+;#
+proc osutils:am:__SOURCES__ { l } {
+ set fmt "%s"
+ return [wokUtils:EASY:FmtString1 $fmt $l]
+}
+;#
+;# ((((((((((((( Formats in Makefile.in )))))))))))))
+;#
+;#
+;# Used to replace the string __DEPENDENCIES__ in Makefile.in
+;# l is the toolkit closure list of a toolkit.
+;#
+proc osutils:in:__DEPENDENCIES__ { l } {
+ set fmt1 "../%s/lib%s.la"
+ set fmt2 "\t../%s/lib%s.la"
+ return [wokUtils:EASY:FmtFmtString2 $fmt1 $fmt2 $l]
+}
+;#
+;# Used to replace the string __OBJECTS__ in Makefile.in
+;# l is the list of objects files in toolkit.
+;#
+proc osutils:in:__OBJECTS__ { l } {
+ set fmt1 "%s.lo"
+ set fmt2 "\t%s.lo"
+ return [wokUtils:EASY:FmtFmtString1 $fmt1 $fmt2 $l]
+}
+;#
+;# Used to replace the string __AMDEP__ in Makefile.in
+;# l is the list of objects files in toolkit.
+;#
+proc osutils:in:__AMPDEP__ { l } {
+ set fmt1 "\$(DEPDIR)/%s.Plo"
+ set fmt2 "@AMDEP_TRUE@\t\$(DEPDIR)/%s.Plo"
+ return [wokUtils:EASY:FmtFmtString1 $fmt1 $fmt2 $l]
+}
+;#
+;# Used to replace the string __AMDEPTRUE__ in Makefile.in
+;# l is the list of objects files in toolkit.
+;#
+proc osutils:in:__AMDEPTRUE__ { l } {
+ set fmt "@AMDEP_TRUE@@_am_include@ @_am_quote@\$(DEPDIR)/%s.Plo@_am_quote@"
+ return [wokUtils:EASY:FmtSimple1 $fmt $l]
+}
+
+
+;#############################################################
+;#
+proc TESTAM { {root} {ll {}} } {
+# source [woklocate -p OS:source:OS.tcl]
+# source [woklocate -p WOKTclLib:source:osutils.tcl]
+ set lesmodules [OS -lm]
+ if { $ll != {} } { set lesmodules $ll }
+ foreach theModule $lesmodules {
+ foreach unit [$theModule:toolkits] {
+ puts " toolkit: $unit ==> [woklocate -p ${unit}:source:EXTERNLIB]"
+ wokUtils:FILES:rmdir $root/$unit
+ wokUtils:FILES:mkdir $root/$unit
+ osutils:tk:mkam $root/$unit $unit
+ }
+ foreach unit [OS:executable $theModule] {
+ wokUtils:FILES:rmdir $root/$unit
+ wokUtils:FILES:mkdir $root/$unit
+ osutils:tk:mkamx $root/$unit $unit
+ }
+ }
+}