Fixed un-initialised var in f_rpnCapabilities.
[yaz-moved-to-github.git] / Makefile
1 # Copyright (C) 1995-1998, Index Data I/S 
2 # All rights reserved.
3 # Sebastian Hammer, Adam Dickmeiss
4 # $Id: Makefile,v 1.40 1998-06-02 10:23:07 adam Exp $
5
6 # Uncomment the lines below to enable mOSI communcation.
7 #ODEFS=-DUSE_XTIMOSI
8 #RFC1006=rfc1006
9 #LIBMOSI=../../xtimosi/src/libmosi.a ../lib/librfc.a
10 #XMOSI=xmosi.o
11
12 CDEFS=$(ODEFS) 
13
14 # Standard include path and original protocol encoders.
15 INCLUDE=-I. -I../include
16 MOD=asn
17
18 # Uncomment the two lines below if you want to try the ASN.1 compiler
19 # (yc) for YAZ. Download yc separately and untar it along with YAZ:
20 #  gunzip -c yaz.tar.gz | tar xvf -
21 #  gunzip -c yc.tar.gz | tar xvf -
22 #  cd yaz
23 #  ln -s ../yc/z39.50 
24 # You must run 'make depend' before 'make'.
25 #INCLUDE=-I../z39.50 -I. -I../include
26 #MOD=z39.50
27
28 #CC=
29 SHELL=/bin/sh
30 MAKE=make
31 SUBDIR=$(MOD) util odr $(RFC1006) ccl comstack retrieval client server ztest makelib
32 # Add external libraries to the ELIBS macro
33 ELIBS=
34 # For Solaris use:
35 #ELIBS=-lnsl -lsocket
36
37 CONTROL=RANLIB="ranlib" ELIBS="$(ELIBS)"
38
39 # Installation directories, etc.
40 #  Binaries
41 BINDIR=/usr/local/bin
42 #  Public libraries and header files
43 LIBDIR=/usr/local/lib
44 INCDIR=/usr/local/include
45 #  Misc tables, etc.
46 YAZDIR=/usr/local/lib/yaz
47
48 all:
49         for i in $(SUBDIR); do cd $$i; if $(MAKE) $(CONTROL) \
50         INCLUDE="$(INCLUDE)" CFLAGS="$(CFLAGS)" CDEFS="$(CDEFS)" LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
51         then cd ..; else exit 1; fi; done
52
53 dep depend:
54         for i in $(SUBDIR); do cd $$i; if $(MAKE) INCLUDE="$(INCLUDE)" CDEFS="$(CDEFS)" depend;\
55                  then cd ..; else exit 1; fi; done
56
57 clean:
58         for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
59         -rm lib/*.a
60
61 oclean:
62         for i in $(SUBDIR); do (cd $$i; rm -f *.o); done
63         mv lib/libyaz.a .; rm -f lib/*.a; mv libyaz.a lib
64         cd client; strip client
65         cd server; strip ztest
66
67 cleanup:
68         rm -f `find $(SUBDIR) -name "*.[oa]" -print`
69         rm -f `find $(SUBDIR) -name "core" -print`
70         rm -f `find $(SUBDIR) -name "errlist" -print`
71         rm -f `find $(SUBDIR) -name "a.out" -print`
72
73 distclean: clean cleandepend
74
75 cleandepend: 
76         for i in $(SUBDIR); do (cd $$i; \
77                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
78                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
79
80 taildepend:
81         for i in $(SUBDIR); do (cd $$i; \
82                 if sed 's/^if/#if/' <Makefile|sed 's/^include/#include/'| \
83                 sed 's/^endif/#endif/' | \
84                 sed 's/^depend: depend2/depend: depend1/g' | \
85                 sed '/^#Depend/q' >Makefile.tmp; then \
86                 mv -f Makefile.tmp Makefile; fi); done
87
88 gnudepend:
89         for i in $(SUBDIR); do (cd $$i; \
90                 if sed '/^#Depend/q' <Makefile| \
91                 sed 's/^#if/if/' |sed 's/^#include/include/'| \
92                 sed 's/^#endif/endif/' | \
93                 sed 's/^depend: depend1/depend: depend2/g' >Makefile.tmp;then \
94                 mv -f Makefile.tmp Makefile; fi); done
95
96 install: all install.misc install.lib install.bin
97
98 install.bin:
99         @if [ ! -d $(BINDIR) ]; then \
100                 echo "Making directory $(BINDIR)"; \
101                 mkdir $(BINDIR); \
102         fi
103         @echo "Installing client -> $(BINDIR)"; \
104         cp client/client $(BINDIR)/client; chmod 755 $(BINDIR)/client
105         @echo "Installing ztest -> $(BINDIR)"; \
106         cp server/ztest $(BINDIR)/ztest; chmod 755 $(BINDIR)/ztest
107
108 install.lib:
109         @if [ ! -d $(LIBDIR) ]; then \
110                 echo "Making directory $(LIBDIR)"; \
111                 mkdir $(LIBDIR); \
112         fi
113         @echo "Installing libyaz.a -> $(LIBDIR)"; \
114         cp lib/libyaz.a $(LIBDIR)/libyaz.a; \
115         chmod 644 $(LIBDIR)/libyaz.a
116         @if [ -f lib/librfc.a ]; then \
117                 echo "Installing librfc.a -> $(LIBDIR)"; \
118                 cp lib/librfc.a $(LIBDIR)/librfc.a; \
119                 chmod 644 $(LIBDIR)/librfc.a; \
120         fi
121         @if [ ! -d $(INCDIR) ]; then \
122                 echo "Making directory $(INCDIR)"; \
123                 mkdir $(INCDIR); \
124         fi
125         @cd include; for f in *.h; do \
126                 echo "Installing $$f -> $(INCDIR)"; \
127                 cp $$f $(INCDIR)/$$f; chmod 644 $(INCDIR)/$$f; \
128         done
129
130 install.misc:
131         @if [ ! -d $(YAZDIR) ]; then \
132                 echo "Making directory $(YAZDIR)"; \
133                 mkdir $(YAZDIR); \
134         fi
135         @cd tab; for f in *; do \
136                 if [ -f $$f ]; then \
137                         echo "Installing $$f -> $(YAZDIR)"; \
138                         cp $$f $(YAZDIR)/$$f; chmod 644 $(YAZDIR)/$$f; \
139                 fi; \
140         done
141
142 wc:
143         wc `find . -name '*.[ch]'`
144