aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 39644528003fdcc59174e96d2477dd69397b3431 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
RANLIB ?= ranlib
SIZE ?= size

# Configuration

jim_nofork := @JIM_NOFORK@
jim_libtype := @JIM_LIBTYPE@
SH_CFLAGS ?= @SH_CFLAGS@ 
SH_LDFLAGS ?= @SH_LDFLAGS@ 

# Defines the extensions to include
EXTENSIONS := @JIM_EXTENSIONS@

# Set an initial, default library and auto_path
CFLAGS += -DTCL_LIBRARY=\"/lib/tcl6\"

CFLAGS += -DJIM_TCL_COMPAT -DJIM_REFERENCES

CFLAGS += -Wall -g -Os $(OPTIM) -I@SRCDIR@ @EXTRA_CFLAGS@
VPATH := @SRCDIR@

ifdef jim_nofork
	CFLAGS += -DNO_FORK
endif
ifeq ($(jim_libtype),static)
	# Emulate tinytcl
	LIBJIM := libtcl6.a
else
	#LIBJIM := libjim_shared.so
	LIBJIM := libtcl6.so
	#CFLAGS += -fPIC
	CFLAGS += $(SH_CFLAGS)
endif

.EXPORT_ALL_VARIABLES:

OBJS := jim-subcmd.o jim-interactive.o jim.o

SDKHDRS := jim.h jim-subcmd.h

EXTENSIONS_OBJS := $(patsubst %,jim-%.o,$(EXTENSIONS))

.PRECIOUS: jim-%.c

# Create C extensions from pure Tcl extensions
jim-%.c: %.tcl
	echo $@ >>.clean
	sh @SRCDIR@/make-c-ext.sh $@ $<

OBJS += load_extensions.o

TARGETS += $(LIBJIM) jimsh

all: $(TARGETS)
	if [ -d doc ]; then $(MAKE) -C doc all; fi

jimsh: $(LIBJIM) jimsh.o
	$(CC) $(LDFLAGS) -o $@ jimsh.o $(LIBJIM) $(LDLIBS) @LIBDL@ -lm
	$(SIZE) $@

ifeq ($(jim_libtype),static)
$(LIBJIM): $(OBJS) $(EXTENSIONS_OBJS)
	$(AR) cr $@ $^
	$(RANLIB) $@
else
$(LIBJIM): $(OBJS) $(EXTENSIONS_OBJS)
	$(CC) $(LDFLAGS) $(SH_LDFLAGS) -o $@ $^
endif

load_extensions.c: @SRCDIR@/make-jim-load-extensions.sh
	sh @SRCDIR@/make-jim-load-extensions.sh $@ $(EXTENSIONS)

install:

clean:
	rm -f *.o lib*.a $(TARGETS) load_extensions.c
	if [ -f .clean ]; then rm -f `cat .clean` .clean; fi