aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 208e7eaf0aca177c269864f346cf3f9d0539c243 (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
122
123
124
125
126
127
128
129
130
131
132
133
# Tools
CC = @CCACHE@ @CC@
RANLIB = @RANLIB@
AR = @AR@
STRIP = @STRIP@

# Configuration

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@

CC += -D_GNU_SOURCE -Wall $(OPTIM) -I.
@if srcdir != .
CFLAGS += -I@srcdir@
VPATH := @srcdir@
@endif

@if JIM_STATICLIB
LIBJIM := libjim.a
@else
LIBJIM := libjim.so
SH_LIBJIM := $(LIBJIM)
CC += $(SH_CFLAGS)
DEF_LD_PATH := @LD_LIBRARY_PATH@=`pwd` 
@endif

OBJS := _load-static-exts.o jim-subcmd.o jim-interactive.o jim-format.o jim.o utf8.o jimregexp.o \
    @EXTRA_OBJS@ @C_EXT_OBJS@ @TCL_EXT_OBJS@

JIMSH := jimsh@EXEEXT@

all: $(JIMSH) @C_EXT_SHOBJS@

# Create C extensions from pure Tcl extensions
.SUFFIXES: .tcl
.tcl.o:
	@tclsh@ @srcdir@/make-c-ext.tcl $< >_$*.c || ( rm _$*.c; exit 1)
	$(CC) $(CFLAGS) -c -o $@ _$*.c || ( rm _$*.c; exit 1)
	@rm -f _$*.c

docs: Tcl.html

$(JIMSH): $(LIBJIM) jimsh.o initjimsh.o
	$(CC) $(CFLAGS) @SH_LINKFLAGS@ $(LDFLAGS) -o $@ jimsh.o initjimsh.o $(LIBJIM) $(LDLIBS)

@if JIM_INSTALL
install: all docs @TCL_EXTS@ install-exec
	mkdir -p $(DESTDIR)$(prefix)/lib/jim
	cp $(LIBJIM) $(DESTDIR)$(prefix)/lib
	cp @srcdir@/README.extensions @C_EXT_SHOBJS@ @TCL_EXTS@ $(DESTDIR)$(prefix)/lib/jim
	mkdir -p $(DESTDIR)$(prefix)/include
	cp @srcdir@/jim.h @srcdir@/jim-eventloop.h @srcdir@/jim-nvp.h @srcdir@/jim-signal.h \
		@srcdir@/jim-subcmd.h @srcdir@/jim-win32compat.h $(DESTDIR)$(prefix)/include
	cp jim-config.h $(DESTDIR)$(prefix)/include
	mkdir -p $(DESTDIR)$(prefix)/doc/jim
	cp Tcl.html $(DESTDIR)$(prefix)/doc/jim

install-exec: all
	mkdir -p $(DESTDIR)$(prefix)/bin
	cp $(JIMSH) $(DESTDIR)$(prefix)/bin

uninstall:
	rm -f $(DESTDIR)$(prefix)/bin/$(JIMSH)
	rm -f $(DESTDIR)$(prefix)/lib/$(LIBJIM)
	for i in README.extensions @C_EXT_SHOBJS@ @TCL_EXTS@; do rm -f $(DESTDIR)$(prefix)/lib/jim/$$i; done
	rm -f $(DESTDIR)$(prefix)/include/jim*.h
	rm -f $(DESTDIR)$(prefix)/doc/jim/Tcl.html
@else
install install-exec uninstall:
@endif

test: $(JIMSH)
	$(DEF_LD_PATH) $(MAKE) -C @srcdir@/tests jimsh=`pwd`/jimsh

$(OBJS): Makefile

@if JIM_UTF8
# 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 >$@ || ( rm $@; exit 1)
@endif

_load-static-exts.c: @srcdir@/make-load-static-exts.tcl Makefile
	@tclsh@ @srcdir@/make-load-static-exts.tcl @STATIC_EXTS@ >$@ || ( rm $@; exit 1)

@if JIM_STATICLIB
$(LIBJIM): $(OBJS)
	$(AR) cr $@ $(OBJS)
	$(RANLIB) $@
@else
$(LIBJIM): $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) $(SH_LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
@endif

# XXX: This won't work for BSD make
%.so: jim-%.c
	$(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o $*.o jim-$*.c
	$(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ $*.o $(SH_LIBJIM) $(LDLIBS)

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

clean:
	rm -f *.o *.so lib*.a $(JIMSH) Tcl.html _*.c

distclean: clean
	rm -f jimautoconf.h jim-config.h Makefile config.log autosetup/jimsh0@EXEEXT@

ship: Tcl.html
	cp Tcl.html Tcl_shipped.html

# 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-data
.PHONY: $(EMPTY_AUTOMAKE_TARGETS)
$(EMPTY_AUTOMAKE_TARGETS):

# automake compatibility - install sources from the current dir to $(distdir)
distdir_full := $(shell cd $(distdir); pwd)
distdir:
	cd "@srcdir@"; git ls-files | cpio -pdmu $(distdir_full)

reconfig:
	CC='@CC@' @AUTOREMAKE@