Makefile.in: add LIBS handling
[jimtcl.git] / Makefile.in
blob6d45b1541321516dd62e0b27436a07c049a41956
1 # Tools
2 CC = @CCACHE@ @CC@
3 CXX = @CCACHE@ @CXX@
4 RANLIB = @RANLIB@
5 AR = @AR@
6 STRIP = @STRIP@
8 # Configuration
10 SH_CFLAGS ?= @SH_CFLAGS@
11 SH_LDFLAGS ?= @SH_LDFLAGS@
12 @if SH_SOPREFIX
13 SH_LDFLAGS += @SH_SOPREFIX@libjim@LIBSOEXT@
14 @endif
15 SHOBJ_CFLAGS ?= @SHOBJ_CFLAGS@
16 @if JIM_STATICLIB
17 SHOBJ_LDFLAGS ?= @SHOBJ_LDFLAGS@
18 @else
19 SHOBJ_LDFLAGS ?= @SHOBJ_LDFLAGS_R@
20 @endif
21 CFLAGS = @CFLAGS@ @CCOPTS@
22 CXXFLAGS = @CXXFLAGS@ @CXXOPTS@
23 LDFLAGS = @LDFLAGS@
24 LDLIBS += @LDLIBS@
25 LIBS += @LIBS@
26 exec_prefix ?= @exec_prefix@
27 prefix ?= @prefix@
29 CC += -D_GNU_SOURCE -Wall $(OPTIM) -I.
30 CXX += -D_GNU_SOURCE -Wall $(OPTIM) -I.
31 @if srcdir != .
32 CFLAGS += -I@srcdir@
33 CXXFLAGS += -I@srcdir@
34 VPATH := @srcdir@
35 @endif
37 @if JIM_STATICLIB
38 LIBJIM := libjim.a
39 @else
40 LIBJIM := libjim@LIBSOEXT@
41 SH_LIBJIM := $(LIBJIM)
42 CC += $(SH_CFLAGS)
43 CXX += $(SH_CFLAGS)
44 DEF_LD_PATH := @LD_LIBRARY_PATH@="@builddir@:$(@LD_LIBRARY_PATH@)"
45 @endif
47 @if HAVE_CXX_EXTENSIONS
48 JIMSH_CC := $(CXX) $(CXXFLAGS)
49 @else
50 JIMSH_CC := $(CC) $(CFLAGS)
51 @endif
53 OBJS := _load-static-exts.o jim-subcmd.o jim-interactive.o jim-format.o jim.o utf8.o jimregexp.o \
54 @EXTRA_OBJS@ @C_EXT_OBJS@ @TCL_EXT_OBJS@
56 JIMSH := jimsh@EXEEXT@
58 @if JIM_INSTALL
59 INSTALL_DATA_DIR ?= mkdir -p
60 INSTALL_DATA ?= cp
61 INSTALL_PROGRAM ?= cp
62 @endif
64 all: $(JIMSH) @C_EXT_SHOBJS@
66 # Create C extensions from pure Tcl extensions
67 .SUFFIXES: .tcl
68 .tcl.o:
69 @tclsh@ @srcdir@/make-c-ext.tcl $< >_$*.c
70 $(CC) $(CFLAGS) -c -o $@ _$*.c
72 docs: Tcl.html
74 @if JIM_DOCS
75 install-docs: docs
76 $(INSTALL_DATA_DIR) $(DESTDIR)$(prefix)/doc/jim
77 $(INSTALL_DATA) Tcl.html $(DESTDIR)$(prefix)/doc/jim
78 @else
79 install-docs:
80 @endif
82 $(JIMSH): $(LIBJIM) jimsh.o initjimsh.o
83 $(JIMSH_CC) @SH_LINKFLAGS@ $(LDFLAGS) -o $@ jimsh.o initjimsh.o $(LIBJIM) $(LDLIBS) $(LIBS)
85 @if JIM_INSTALL
86 install: all @TCL_EXTS@ install-exec install-docs
87 $(INSTALL_DATA_DIR) $(DESTDIR)@libdir@/jim
88 $(INSTALL_DATA) $(LIBJIM) $(DESTDIR)@libdir@
89 $(INSTALL_DATA) @srcdir@/README.extensions @C_EXT_SHOBJS@ $(DESTDIR)@libdir@/jim
90 for i in @TCL_EXTS@; do $(INSTALL_DATA) @srcdir@/$$i $(DESTDIR)@libdir@/jim; done
91 $(INSTALL_DATA_DIR) $(DESTDIR)@includedir@
92 $(INSTALL_DATA) @srcdir@/jim.h @srcdir@/jim-eventloop.h @srcdir@/jim-signal.h \
93 @srcdir@/jim-subcmd.h @srcdir@/jim-win32compat.h $(DESTDIR)@includedir@
94 $(INSTALL_DATA) jim-config.h $(DESTDIR)@includedir@
95 $(INSTALL_DATA_DIR) $(DESTDIR)@bindir@
96 $(INSTALL_DATA) build-jim-ext $(DESTDIR)@bindir@
98 install-exec: all
99 $(INSTALL_DATA_DIR) $(DESTDIR)@bindir@
100 $(INSTALL_PROGRAM) $(JIMSH) $(DESTDIR)@bindir@
102 uninstall:
103 rm -f $(DESTDIR)@bindir@/$(JIMSH)
104 rm -f $(DESTDIR)@bindir@/build-jim-ext
105 rm -f $(DESTDIR)@libdir@/$(LIBJIM)
106 for i in README.extensions @C_EXT_SHOBJS@ @TCL_EXTS@; do rm -f $(DESTDIR)@libdir@/jim/$$i; done
107 rm -f $(DESTDIR)@includedir@/jim*.h
108 rm -f $(DESTDIR)@datadir@/doc/jim/Tcl.html
109 @else
110 install install-exec: all
111 uninstall:
112 @endif
114 test check: $(JIMSH)
115 cd @srcdir@/tests; $(DEF_LD_PATH) $(MAKE) jimsh=@builddir@/jimsh
117 $(OBJS): Makefile $(wildcard *.h)
119 @if JIM_UTF8
120 # Generate the unicode case mapping
121 utf8.o: _unicode_mapping.c
123 _unicode_mapping.c: @srcdir@/UnicodeData.txt @srcdir@/parse-unidata.tcl
124 @tclsh@ @srcdir@/parse-unidata.tcl @srcdir@/UnicodeData.txt >$@ || ( rm $@; exit 1)
125 @endif
127 _load-static-exts.c: @srcdir@/make-load-static-exts.tcl Makefile
128 @tclsh@ @srcdir@/make-load-static-exts.tcl @STATIC_EXTS@ >$@ || ( rm $@; exit 1)
130 @if JIM_STATICLIB
131 $(LIBJIM): $(OBJS)
132 $(AR) cr $@ $(OBJS)
133 $(RANLIB) $@
134 @else
135 $(LIBJIM): $(OBJS)
136 $(CC) $(CFLAGS) $(LDFLAGS) $(SH_LDFLAGS) -o $@ $(OBJS) $(LDLIBS) $(LIBS)
137 @endif
139 # Note that $> $^ is for compatibility with both GNU make and BSD make
140 readdir.so: jim-readdir.c
141 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-readdir.o $> $^
142 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-readdir.o $(SH_LIBJIM)
144 array.so: jim-array.c
145 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-array.o $> $^
146 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-array.o $(SH_LIBJIM)
148 clock.so: jim-clock.c
149 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-clock.o $> $^
150 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-clock.o $(SH_LIBJIM)
152 file.so: jim-file.c
153 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-file.o $> $^
154 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-file.o $(SH_LIBJIM)
156 posix.so: jim-posix.c
157 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-posix.o $> $^
158 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-posix.o $(SH_LIBJIM)
160 regexp.so: jim-regexp.c
161 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-regexp.o $> $^
162 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-regexp.o $(SH_LIBJIM)
164 syslog.so: jim-syslog.c
165 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-syslog.o $> $^
166 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-syslog.o $(SH_LIBJIM)
168 readline.so: jim-readline.c
169 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-readline.o $> $^
170 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-readline.o $(SH_LIBJIM) @LDLIBS_readline@
172 pack.so: jim-pack.c
173 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-pack.o $> $^
174 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-pack.o $(SH_LIBJIM) @LDLIBS_pack@
176 tclprefix.so: jim-tclprefix.c
177 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-tclprefix.o $> $^
178 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-tclprefix.o $(SH_LIBJIM) @LDLIBS_tclprefix@
180 sqlite3.so: jim-sqlite3.c
181 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-sqlite3.o $> $^
182 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-sqlite3.o $(SH_LIBJIM) @LDLIBS_sqlite3@
184 win32.so: jim-win32.c
185 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-win32.o $> $^
186 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-win32.o $(SH_LIBJIM) @LDLIBS_win32@
188 mk.so: jim-mk.cpp
189 $(CXX) $(CXXFLAGS) $(SHOBJ_CFLAGS) -c -o jim-mk.o $> $^
190 $(CXX) $(CXXFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-mk.o $(SH_LIBJIM) @LDLIBS_mk@
192 sdl.so: jim-sdl.c
193 $(CC) $(CFLAGS) $(SHOBJ_CFLAGS) -c -o jim-sdl.o $> $^
194 $(CC) $(CFLAGS) $(LDFLAGS) $(SHOBJ_LDFLAGS) -o $@ jim-sdl.o $(SH_LIBJIM) @LDLIBS_sdl@
196 Tcl.html: jim_tcl.txt
197 @tclsh@ @srcdir@/make-index $> $^ | asciidoc -o $@ -d manpage - || cp @srcdir@/Tcl_shipped.html Tcl.html
199 clean:
200 rm -f *.o *.so *.dll *.exe lib*.a $(JIMSH) $(LIBJIM) Tcl.html _*.c
202 distclean: clean
203 rm -f jimautoconf.h jim-config.h Makefile config.log autosetup/jimsh0@EXEEXT@ build-jim-ext
205 ship: Tcl.html
206 cp $< Tcl_shipped.html
208 # automake compatibility. do nothing for all these targets
209 EMPTY_AUTOMAKE_TARGETS := dvi pdf ps info html tags ctags mostlyclean maintainer-clean check installcheck installdirs \
210 install-pdf install-ps install-info install-html -install-dvi uninstall install-data
211 .PHONY: $(EMPTY_AUTOMAKE_TARGETS)
212 $(EMPTY_AUTOMAKE_TARGETS):
214 # automake compatibility - install sources from the current dir to $(distdir)
215 distdir_full := $(shell cd $(distdir); pwd)
216 distdir:
217 cd "@srcdir@"; git ls-files | cpio -pdmu $(distdir_full)
219 reconfig:
220 CC='@CC@' @AUTOREMAKE@