Towards 1.4.
[ir-tcl-moved-to-github.git] / Makefile.in
1 # IR toolkit for tcl/tk
2 # (c) Index Data 1995-1999
3 # See the file LICENSE for details.
4 # $Id: Makefile.in,v 1.55 2001-12-03 00:31:06 adam Exp $
5 SHELL=/bin/sh
6
7 # IrTcl Version
8 VERSION=1.4
9
10 # Directory prefix with machine independent files (scripts, setup files, etc.)
11 prefix = @prefix@
12
13 # Directory prefix with machine dependent files (executables, libraries)
14 exec_prefix = @exec_prefix@
15
16 # RPM Root
17 BUILD=@build_root@
18
19 # Install directories
20 BINDIR=$(exec_prefix)/bin
21 LIBDIR=$(exec_prefix)/lib
22 MANDIR=$(prefix)/man
23 INCDIR=$(prefix)/include
24 IRTCLDIR=$(prefix)/lib/irtcl
25
26 CC=@CC@
27
28 # Tcl libraries and include files
29 TCLLIB=@TCLLIB@
30 TCLINC=@TCLINC@
31
32 # Tk & X11 libraries and include files
33 TKLIB=@TKLIB@
34 TKINC=@TKINC@
35
36 # Shared libraries definitions
37 SHLIB_CFLAGS = @SHLIB_CFLAGS@
38 SHLIB_LD = @SHLIB_LD@
39 SHLIB_SUFFIX = @SHLIB_SUFFIX@
40 SHLIB_VERSION = @SHLIB_VERSION@
41
42 # Where are Yaz libraries located?
43 YAZLIB=@YAZLIB@
44 # Where are Yaz header files located?
45 YAZINC=@YAZINC@
46 # If Yaz is compiled with mosi support uncomment and specify.
47 #OSILIB=../../xtimosi/src/libmosi.a ../../yaz/lib/librfc.a
48
49 # All include paths
50 INCLUDE=-I. $(YAZINC) $(TKINC) $(TCLINC) 
51
52 # All command line options except CFLAGS
53 DEFS=-DCCL2RPN=1 @DEFS@ -DIRTCLDIR=\"$(IRTCLDIR)\" \
54         $(INCLUDE) -DIR_TCL_VERSION=\"$(VERSION)\"
55
56 INSTALL = @INSTALL@
57 INSTALL_PROGRAM = @INSTALL_PROGRAM@
58 INSTALL_DATA = @INSTALL_DATA@
59
60 RANLIB = @RANLIB@
61
62 O=ir-tcl.o marc.o queue.o mem.o grs.o explain.o select.o
63
64 all: @ALL_SPEC@
65
66 ir-tk: libirtcl.a tkmain.o
67         $(CC) $(CFLAGS) tkmain.o -o ir-tk libirtcl.a $(YAZLIB) $(TKLIB) 
68
69 ir-tcl: libirtcl.a tclmain.o
70         $(CC) $(CFLAGS) tclmain.o -o ir-tcl libirtcl.a $(YAZLIB) $(TCLLIB) 
71
72 libirtcl.a: $(O)
73         rm -f libirtcl.a
74         ar qc libirtcl.a $(O)
75         $(RANLIB) libirtcl.a
76
77 @SHLIB_IRTCL@: $(O)
78         rm -f @SHLIB_IRTCL@
79         ${SHLIB_LD} -o @SHLIB_IRTCL@ $(O) $(YAZLIB)
80
81 WAISDIR=../freeWAIS-sf-2.0
82
83 wais-tcl: libirtcl.a wais-tcl.o waismain.o
84         $(CC) $(CFLAGS) wais-tcl.o waismain.o -o wais-tcl libirtcl.a \
85                 $(YAZLIB)  $(WAISDIR)/ir/libwais.a $(TCLLIB)
86
87 waismain.o: tclmain.c
88         $(CC) -c $(CFLAGS) -DUSE_WAIS=1 $(DEFS) tclmain.c -o waismain.o
89
90 wais-tcl.o: wais-tcl.c
91         $(CC) -c $(CFLAGS) -I$(WAISDIR)/ir $(DEFS) wais-tcl.c
92
93 install.man:
94         $(INSTALL) -d $(BUILD)$(MANDIR)/mann
95         @cd doc; if [ -d $(BUILD)$(MANDIR)/mann ]; then \
96                 for p in *.n; do \
97                         $(INSTALL_DATA) $$p $(BUILD)$(MANDIR)/mann; \
98                 done; \
99         fi
100
101 install: @ALL_SPEC@
102         $(INSTALL) -d $(BUILD)$(IRTCLDIR)/formats
103         $(INSTALL) -d $(BUILD)$(IRTCLDIR)/bitmaps
104         $(INSTALL) -d $(BUILD)$(IRTCLDIR)/doc
105         $(INSTALL) -d $(BUILD)$(BINDIR)
106         @if [ -f ir-tcl ]; then \
107                 $(INSTALL_PROGRAM) ir-tcl $(BUILD)$(BINDIR); \
108         fi
109         @if [ -f @SHLIB_IRTCL@ ]; then \
110                 $(INSTALL_PROGRAM) @SHLIB_IRTCL@ $(BUILD)$(IRTCLDIR); \
111         fi
112         $(INSTALL_DATA) libirtcl.a $(BUILD)$(LIBDIR)
113         $(INSTALL_DATA) ir-tcl.h $(BUILD)$(INCDIR)
114         @if [ -f ir-tk ]; then \
115                 $(INSTALL_PROGRAM) ir-tk $(BUILD)$(BINDIR); \
116         fi
117         @echo "#! $(BINDIR)/@IRCLIENT_SHELL@ -f" >head.bak; \
118         cat head.bak client.tcl| sed "s,^set libdir LIBDIR,set libdir $(IRTCLDIR)," >client.bak; \
119         $(INSTALL_PROGRAM) client.bak $(BUILD)$(BINDIR)/irclient; \
120         if [ -f $(BUILD)$(IRTCLDIR)/irtdb.tcl ]; then \
121                 echo "irtdb.tcl already exists"; \
122                 echo "Installing irtdb.tcl.n"; \
123                 cp irtdb.tcl irtdb.tcl.n; \
124                 $(INSTALL_DATA) irtdb.tcl.n $(BUILD)$(IRTCLDIR); \
125                 rm irtdb.tcl.n; \
126         else \
127                 echo "Installing irtdb.tcl"; \
128                 $(INSTALL_DATA) irtdb.tcl $(BUILD)$(IRTCLDIR); \
129         fi
130         @for f in *.tcl; do \
131                 $(INSTALL_DATA) $$f $(BUILD)$(IRTCLDIR); \
132         done
133         @for b in formats/*.tcl; do \
134                 if [ -f $$b ]; then \
135                         $(INSTALL_DATA) $$b $(BUILD)$(IRTCLDIR)/formats; \
136                 fi; \
137         done
138         @for b in bitmaps/*; do \
139                 if [ -f $$b ]; then \
140                         $(INSTALL_DATA) $$b $(BUILD)$(IRTCLDIR)/bitmaps; \
141                 fi; \
142         done
143         @for b in doc/*; do \
144                 if [ -f $$b ]; then \
145                         $(INSTALL_DATA) $$b $(BUILD)$(IRTCLDIR)/doc; \
146                 fi; \
147         done
148
149 clean:
150         rm -f *.[oa] ir-tk ir-tcl wais-tcl core 
151         rm -f *mon.out *.bak config.cache @SHLIB_IRTCL@
152
153 autoconf:
154         -rm config.cache
155         autoconf
156         configure
157
158 .c.o:
159         $(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $(DEFS) $<
160
161 $(O) tkmain.o tclmain.o wais-tcl.o waismain.o: ir-tcl.h ir-tclp.h