2 param CFLAGS "-g -O2 -ansi -Wall -Wextra"
4 param JIM_CFLAGS [options { -D_GNU_SOURCE
10 -fno-asynchronous-unwind-tables
13 param JIM_STATIC_EXTS [list aio array clock exec file namespace pack \
14 package posix readdir regexp signal tclprefix \
15 binary glob nshelper oo stdlib tclcompat tree \
18 param SQLITE_CFLAGS [options { -DSQLITE_OMIT_LOAD_EXTENSION=1
20 -DSQLITE_DEFAULT_FILE_FORMAT=4
22 -DSQLITE_ENABLE_LOCKING_STYLE=0
23 -DSQLITE_OMIT_INCRBLOB
27 param MAKE_C_EXT "make-c-ext.tcl"
28 param MAKE_LOAD_STATIC_EXTS "make-load-static-exts.tcl"
36 proc tclgen {script tclfile cfile} {
40 if {![file exists $TCL]} {
47 if {![file exists $script]} {
48 set cmd "jimtcl/$script"
51 exec -flags @ echo "#define JIM_EMBEDDED" > $cfile
52 exec $tcl $cmd {*}$tclfile >> $cfile
57 set JIM_CSRC {_load-static-exts.c jim-subcmd.c jim-interactive.c jim-format.c
58 jim.c utf8.c jimregexp.c jim-aio.c jim-array.c jim-clock.c
59 jim-exec.c jim-file.c jim-namespace.c jim-pack.c jim-package.c
60 jim-posix.c jim-readdir.c jim-regexp.c jim-signal.c
61 jim-tclprefix.c _binary.c _glob.c _nshelper.c _oo.c _stdlib.c
64 set JIM_TCLSRC {binary.tcl glob.tcl nshelper.tcl oo.tcl stdlib.tcl
65 tclcompat.tcl tree.tcl initjimsh.tcl}
67 set JIMSH_SRC {jimsh.c _initjimsh.c}
69 if {[defined NO_BUILD_JIMTCL]} {
72 rule jim_bootstrap {[in-dir jimtcl/autosetup jimsh0.c]} {
74 cc -o jimtcl/jimsh0 $INPUTS 2>/dev/null
77 rule jim_exts {jim_bootstrap [in-dir jimtcl $JIM_TCLSRC]} {
78 global JIM_TCLSRC MAKE_C_EXT
81 foreach tclfile $JIM_TCLSRC {
82 tclgen $MAKE_C_EXT $tclfile _[replace-ext $tclfile .tcl .c]
87 rule _load-static-exts.c {jim_exts} {
88 global MAKE_LOAD_STATIC_EXTS JIM_STATIC_EXTS
91 tclgen $MAKE_LOAD_STATIC_EXTS $JIM_STATIC_EXTS _load-static-exts.c
95 rule jim_lib {jim_exts _load-static-exts.c [in-dir jimtcl $JIM_CSRC]} {
96 global JIM_CSRC JIM_CFLAGS
99 foreach cfile $JIM_CSRC {
100 cc {*}$JIM_CFLAGS -o [replace-ext $cfile .c .o] -c $cfile
103 exec ar cr libjim.a {*}[replace-ext $JIM_CSRC .c .o]
109 rule jimsh {jim_lib [in-dir jimtcl $JIMSH_SRC]} {
110 global JIMSH_SRC JIM_CFLAGS
113 cc {*}$JIM_CFLAGS -o $TARGET {*}$JIMSH_SRC libjim.a -lm
120 rule sqlite3.o {[in-dir jimtcl/sqlite3 sqlite3.c]} {
121 global CC SQLITE_CFLAGS
122 cc -o $TARGET -c $INPUTS {*}$SQLITE_CFLAGS
126 set H_SRC "tmake.h tm_crypto.h tm_target.h tm_update.h tm_core_cmds.h tm_ext_cmds.h"
127 set C_SRC "tmake.c tm_crypto.c tm_target.c tm_update.c tm_core_cmds.c tm_ext_cmds.c"
129 rule tm_ext_cmds.c {tm_ext_cmds.tcl} {
131 tclgen $MAKE_C_EXT $INPUTS $TARGET
134 rule tmk {jim sqlite3.o $C_SRC $H_SRC} {
137 set OPSYS [tcl::exec uname -s]
138 set ARCH [tcl::exec uname -m]
140 cc {*}$CFLAGS -o $TARGET -Ijimtcl -Ijimtcl/sqlite3 \
141 -DTM_OPSYS="$OPSYS" -DTM_MACHINE_ARCH="$ARCH" \
142 {*}$C_SRC jimtcl/libjim.a sqlite3.o -lm
147 # ----------------------------------------------------------------------------
148 set DOCS {jimtcl/Tcl_shipped.html doc/refman.md}
150 rule doc-html {$DOCS template.html} {
151 file copy -force jimtcl/Tcl_shipped.html doc/Jim_Tcl.html
152 exec pandoc -S -s --toc --template=./doc/template.html \
153 -f markdown_github -t html -o doc/refman.html doc/refman.md
157 exec pandoc -f html -t latex -o doc/Jim_Tcl.pdf jimtcl/Tcl_shipped.html
158 exec pandoc -S -s --toc \
159 -f markdown_github -t latex -o doc/refman.pdf doc/refman.md
162 rule doc-all {doc-html doc-pdf}
164 #-----------------------------------------------------------------------------