Skip to content

Commit 927f866

Browse files
committed
variables: demonstrate migration path from make to tcl
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 6ba875c commit 927f866

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

flow/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,15 @@ else
153153
$(error [ERROR][FLOW] Platform '$(PLATFORM)' not found.)
154154
endif
155155

156-
include $(PLATFORM_DIR)/config.mk
156+
# The plan is to migrate all variables to .tcl so that
157+
# ORFS is no longer dependent on make.
158+
ifneq ($(wildcard $(PLATFORM_DIR)/config.tcl),)
159+
# import variables defined in config.tcl to the make environment.
160+
$(foreach line,$(shell tclsh $(SCRIPTS_DIR)/env.tcl $(PLATFORM_DIR)/config.tcl),$(eval $(line)))
161+
endif
162+
ifneq ($(wildcard $(PLATFORM_DIR)/config.mk),)
163+
include $(PLATFORM_DIR)/config.mk
164+
endif
157165

158166
# __SPACE__ is a workaround for whitespace hell in "foreach"; there
159167
# is no way to escape space in defaults.py and get "foreach" to work.

flow/platforms/asap7/config.mk

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
export PLATFORM = asap7
2-
export PROCESS = 7
3-
41
ifeq ($(LIB_MODEL),)
52
export LIB_MODEL = NLDM
63
endif

flow/platforms/asap7/config.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ---------------------------------------------------------
2+
# IR Drop
3+
# ---------------------------------------------------------
4+
5+
set ::env(PLATFORM) asap7
6+
set ::env(PROCESS) 7

flow/scripts/env.tcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Print out make variables that have changed so that
2+
# make can set them up.
3+
set envfile [lindex $argv 0]
4+
set env_vars [array get ::env]
5+
source $envfile
6+
7+
foreach {var val} [array get ::env] {
8+
if {![dict exists $env_vars $var] || [dict get $env_vars $var] ne $val} {
9+
puts "export $var:=$val"
10+
}
11+
}

0 commit comments

Comments
 (0)