6 CFLAGS
=${CFLAGS:- -ansi -Wall -Wextra -g -O2}
9 RANLIB
=${RANLIB:-ranlib}
11 JIM_CFLAGS
="-D_GNU_SOURCE -Wall -I. -g -O2 -fno-unwind-tables -fno-asynchronous-unwind-tables"
19 echo "$1" |
sed 's/\(.*\)\.[^\.]*$/\1/'
23 # Do some configure-style checks needed for the SHA-1 code
25 for check
in $CHECKS; do
26 $CC -o $check $check.c
30 echo -n "Checking for word type... "
31 WORDTYPE
="$(build/checks/wordsize)"
34 echo "ERROR: Unable to determine word type"
39 if [ -f config.h
]; then
43 echo "typedef $WORDTYPE WORD;" >> config.h
45 JIM_CSRC
="_load-static-exts.c jim-subcmd.c jim-interactive.c jim-format.c
46 jim.c utf8.c jimregexp.c jim-aio.c jim-array.c jim-clock.c
47 jim-exec.c jim-file.c jim-namespace.c jim-pack.c jim-package.c
48 jim-posix.c jim-readdir.c jim-regexp.c jim-signal.c
49 jim-tclprefix.c _binary.c _glob.c _nshelper.c _oo.c _stdlib.c
52 JIM_TCLSRC
="binary.tcl glob.tcl nshelper.tcl oo.tcl stdlib.tcl
53 tclcompat.tcl tree.tcl initjimsh.tcl"
55 JIM_STATIC_EXTS
="aio array clock exec file namespace pack
56 package posix readdir regexp signal tclprefix
57 binary glob nshelper oo stdlib tclcompat tree"
59 # Build the bootstrap JimTcl interpreter
61 $CC -o ..
/jimsh0 jimsh0.c
2>/dev
/null
)
63 # Build the real JimTcl interpreter and library
65 echo '#define JIM_EMBEDDED' > _load-static-exts.c
;
66 echo "./jimsh0 make-load-static-exts.tcl $JIM_STATIC_EXTS >> _load-static-exts.c";
67 .
/jimsh0 make-load-static-exts.tcl
$JIM_STATIC_EXTS >> _load-static-exts.c
69 for tclfile
in $JIM_TCLSRC; do
70 echo '#define JIM_EMBEDDED' > _$
(rootname
$tclfile).c
;
71 echo "./jimsh0 make-c-ext.tcl $tclfile >> _$(rootname $tclfile).c"
72 .
/jimsh0 make-c-ext.tcl
$tclfile >> _$
(rootname
$tclfile).c
;
76 for cfile
in $JIM_CSRC; do
77 JIM_OBJS
="$JIM_OBJS $(rootname $cfile).o";
78 run
$CC $JIM_CFLAGS -o $
(rootname
$cfile).o
-c $cfile;
81 run
$AR cr libjim.a
$JIM_OBJS;
86 run
$CC -o sqlite3.o
-c jimtcl
/sqlite
3/sqlite3.c \
87 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 \
88 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT3 \
89 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_OMIT_INCRBLOB
92 C_SRC
="tmake.c tm_crypto.c tm_target.c tm_update.c tm_core_cmds.c tm_ext_cmds.c"
94 MAKE_C_EXT
="jimtcl/jimsh jimtcl/make-c-ext.tcl tm_ext_cmds.tcl"
95 echo "$MAKE_C_EXT > tm_ext_cmds.c"
96 echo "#define JIM_EMBEDDED" > tm_ext_cmds.c
97 $MAKE_C_EXT >> tm_ext_cmds.c
100 TM_MACHINE_ARCH
=$
(uname
-m)
102 run
$CC -o tmk
$CFLAGS -Ijimtcl -Ijimtcl/sqlite3 \
103 -DTM_OPSYS="\"$TM_OPSYS\"" -DTM_MACHINE_ARCH="\"$TM_MACHINE_ARCH\"" \
104 $C_SRC jimtcl
/libjim.a sqlite3.o
-lm