aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 22a03eefaf3cbe732f6563d47f2c62c2ff49198b (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Tools
CC = @CC@
CROSS ?= @CROSS@
RANLIB ?= $(CROSS)ranlib
AR ?= $(CROSS)ar

# Configuration

jim_libtype := @JIM_LIBTYPE@
SH_CFLAGS ?= @SH_CFLAGS@
SH_LDFLAGS ?= @SH_LDFLAGS@
SHOBJ_CFLAGS ?= @SHOBJ_CFLAGS@
SHOBJ_LDFLAGS ?= @SHOBJ_LDFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LDLIBS += @LIBS@
exec_prefix ?= @exec_prefix@
prefix ?= @prefix@
DESTDIR ?= $(prefix)

# Set an initial, default library and auto_path
CPPFLAGS += -DTCL_LIBRARY=\"@TCL_LIBRARY@\"

CPPFLAGS += -DTCL_PLATFORM_OS=\"@PLATFORM_OS@\" -DTCL_PLATFORM_PLATFORM=\"@PLATFORM_PLATFORM@\"
CPPFLAGS += -DJIM_REFERENCES -D_GNU_SOURCE

CPPFLAGS += -Wall $(OPTIM) -I@SRCDIR@ -I. @EXTRA_CFLAGS@
VPATH := @SRCDIR@

ifeq ($(jim_libtype),static)
	LIBJIM := libjim.a
else
	LIBJIM := libjim.so
	SH_LIBJIM := $(LIBJIM)
	CPPFLAGS += $(SH_CFLAGS)
endif

.EXPORT_ALL_VARIABLES:

OBJS := jim-subcmd.o jim-interactive.o jim-format.o jim.o utf8.o jimregexp.o @EXTRA_OBJS@

JIMSH := jimsh@EXEEXT@

EXTENSION_OBJS := $(patsubst %,jim-%.o,@JIM_EXTENSIONS@)
EXTENSION_MODS := $(patsubst %,%.so,@JIM_MOD_EXTENSIONS@)
EXTENSION_TCL := $(patsubst %,%.tcl,@JIM_TCL_EXTENSIONS@)

.PRECIOUS: jim-%.c

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

OBJS += jim-load-static-exts.o

all: $(JIMSH) $(EXTENSION_MODS)

docs: Tcl.html

$(JIMSH): $(LIBJIM) jimsh.o
	$(CC) $(CFLAGS) @LINKFLAGS@ $(LDFLAGS) -o $@ jimsh.o $(LIBJIM) $(LDLIBS) -lm

install: all docs $(EXTENSION_TCL)
	install -d $(DESTDIR)/bin
	install $(JIMSH) $(DESTDIR)/bin
	install -d $(DESTDIR)/lib/jim
	install $(LIBJIM) $(DESTDIR)/lib
	install README.extensions $(EXTENSION_MODS) $(EXTENSION_TCL) $(DESTDIR)/lib/jim
	install -d $(DESTDIR)/include
	install @SRCDIR@/jim.h @SRCDIR@/jim-eventloop.h @SRCDIR@/jim-nvp.h @SRCDIR@/jim-signal.h \
		@SRCDIR@/jim-subcmd.h @SRCDIR@/jim-win32compat.h $(DESTDIR)/include
	install jim-config.h $(DESTDIR)/include
	install -d $(DESTDIR)/doc/jim
	install Tcl.html $(DESTDIR)/doc/jim

test:
	$(MAKE) jimsh=$(shell pwd)/jimsh -C tests

$(OBJS) $(EXTENSION_OBJS): Makefile

# Generate the unicode case mapping
utf8.o: unicode_mapping.c

unicode_mapping.c: @SRCDIR@/UnicodeData.txt @SRCDIR@/parse-unidata.tcl
	tclsh @SRCDIR@/parse-unidata.tcl @SRCDIR@/UnicodeData.txt >$@

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

%.so: jim-%.c
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SHOBJ_CFLAGS) -c -o $*.o $^
	$(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ $*.o $(SH_LIBJIM) $(LDLIBS)

Tcl.html: jim_tcl.txt
	tclsh @SRCDIR@/make-index $^ | asciidoc -o $@ -d manpage - || cp @SRCDIR@/Tcl_shipped.html Tcl.html

clean:
	rm -f *.o *.so lib*.a $(JIMSH) Tcl.html unicode_mapping.c
	if [ -f .clean ]; then rm -f `cat .clean` .clean; fi

distclean: clean
	rm -f jimautoconf.h jim-config.h Makefile config.status config.log
	rm -rf autom4te.cache

ship: Tcl.html
	cp Tcl.html Tcl_shipped.html
	autoconf && autoheader

# automake compatibility. do nothing for all these targets
EMPTY_AUTOMAKE_TARGETS := dvi pdf ps info html tags ctags mostlyclean maintainer-clean check installcheck installdirs \
 install-pdf install-ps install-info install-html -install-dvi uninstall install-exec install-data distdir
.PHONY: $(EMPTY_AUTOMAKE_TARGETS)
$(EMPTY_AUTOMAKE_TARGETS):