#!/usr/bin/tclsh # -*- tcl -*- proc usage {} { puts "Usage: build \[-v\] \[clean\]" exit -1 } # use Makefile.template to generate a Makefile proc create_makefile {target relayfs} { if {[catch {open ../Makefile.template r} fd]} { puts "ERROR opening ../Makefile.template" exit -1 } if {[catch {open Makefile w} mfd]} { puts "ERROR creating Makefile" exit -1 } while {[gets $fd line] >= 0} { if {[regsub XXX $line $target newline]} { set line $newline } if {[regsub RELAYFS $line $relayfs newline]} { set line $newline } puts $mfd $line } close $fd close $mfd } proc build {{target ""}} { global clean verbose debug if {$target == ""} { set target [file tail [pwd]] } if {$clean} { puts "Cleaning $target" if {[catch {exec make clean >& compile.errors} res]} { [exec cat compile.errors] exit -1 } } else { puts "Building $target" if {$debug == ""} { if {[catch {exec make >& compile.errors} res]} { puts "\n------------ Compile error in $target -------------------\n" if {[catch {open compile.errors r} fd]} { puts "Compile failed for unknown reasons" exit -1 } while {[gets $fd line] >= 0} { puts $line } close $fd exit -1 } } else { if {[catch {exec make debug >& compile.errors} res]} { puts "\n------------ Compile error in $target -------------------\n" if {[catch {open compile.errors r} fd]} { puts "Compile failed for unknown reasons" exit -1 } while {[gets $fd line] >= 0} { puts $line } close $fd exit -1 } } if {![catch {open compile.errors r} fd]} { # search for warnings set bad 0 while {[gets $fd line] >= 0} { if {$verbose} { puts $line } else { if {[regexp {[^W]*([A-Za-z][A-Za-z0-9_]*)[^\"]*\"([^\"]*)} $line match warn var]} { if {$warn == "Warning"} { switch $var { _stp_ctrl_unregister - _stp_ctrl_register - relay_subbufs_consumed - _stp_ctrl_send - relay_open - relayfs_create_dir - relayfs_remove_dir - relay_flush - relay_switch_subbuf - relay_close {} default { if {$bad == 0} { puts "\n------------ Unexpected Warnings in $target -------------------\n" } puts $line set bad 1 } } } } } } close $fd } if {$bad} { exit -1 } } } set clean 0 set verbose 0 set debug "" foreach arg $argv { if {$arg == "clean"} { set clean 1 } elseif {$arg == "-v"} { set verbose 1 } elseif {$arg == "debug"} { set debug $arg } elseif {$arg != ""} { usage } } set relayfs "" if {![file exists /lib/modules/[exec uname -r]/build/include/linux/relayfs_fs.h]} { set relayfs {-I $(RT)/relayfs} } if {![catch {open targets r} tfd]} { while {[gets $tfd line] >= 0} { set target [lindex $line 0] create_makefile $target $relayfs build $target catch {exec /bin/rm Makefile} } close $tfd } else { if {![file exists Makefile]} { puts "Now in [pwd]" puts "ERROR: No targets file found and no Makefile either" exit -1 } build } puts "Done" catch {exec /bin/rm compile.errors} 'left'>FilesLines * Several bugfixes on power elementsThales13302017-01-0616-161/+216 | * import/export button removedThales13302017-01-061-0/+0 | * .gitignore file fixedThales13302017-01-065-16/+0 | * IDE files removed, .gitignore updatedThales13302017-01-06185-54642/+44 | * Merge pull request #5 from Thales1330/opt/element-parent-searchThales Lima Oliveira2017-01-05253-2758/+30406 |\ | | | | Opt element parent search | * Text bugs fixedThales13302017-01-05179-1013/+28142 | | | * Text element optimizated, but buggyThales13302017-01-0383-1500/+1478 | | | | | | | | Element/parent search buggy | * Fast data visualization implementedThales13302017-01-0268-179/+640 | | | * Parent/child optimization implementedThales13302016-12-2949-208/+288 |/ | | | And others bugfixes. * Merge pull request #4 from Thales1330/wip/copy-pasteThales13302016-12-2974-399/+1450 |\ | | | | Wip copy paste | * Text element paste bug correctedThales13302016-12-2946-1107/+987 | | | * Copy paste implementedThales Lima Oliveira2016-12-2973-1510/+1547 | | | | | | | | Some bugs on the text | * Bus line and transformer copy/paste implementedThales13302016-12-2853-216/+475 | | | | | | | | | | Next step is try to generalize. Some graphical implementations in this commit. | * Basic copy paste methods implementedThales13302016-12-1613-10/+885 |/ * Merge pull request #3 from Thales1330/wip/save-load-xmlThales13302016-12-1559-256/+6590 |\ | | | | Wip/save load xml | * File handling implementedThales13302016-12-1516-53/+584 | | | * Many elements open implementedThales13302016-12-1438-20/+324 | | | * Bus open implemented, capacitor buggyThales13302016-12-1310-6/+215 | | | * Save method implementedThales13302016-12-138-85/+364 | | | * Many elements save implementedThales13302016-12-1244-141/+620 | | | * Basic save methods implementedThales13302016-12-1023-141/+4673 |/ * Merge pull request #2 from Thales1330/wip/currentStateThales13302016-12-0957-388/+2032 |\ | | | | Wip currentstate | * Text implementedThales13302016-12-0913-42/+413 | | | * Several bus corretedThales13302016-12-0831-152/+649 | | | * Multiline text implementedThales13302016-12-0719-42/+129 | | | | | | | | text update still under implementation | * Text update under implementationThales13302016-12-0645-244/+933 | | * | Merge remote-tracking branch 'refs/remotes/origin/wip/currentState'Thales13302016-12-06