fcda7e671d55e1b2265b5222bb7740f909ba48cd
[yaz-moved-to-github.git] / Makefile.in
1 # Copyright (C) 1995-1998, Index Data 
2 # All rights reserved.
3 # Sebastian Hammer, Adam Dickmeiss
4 # $Id: Makefile.in,v 1.2 1998-08-25 16:19:37 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=@DEFS@ @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=@CC@
29 CPP=@CPP@
30 SHELL=/bin/sh
31 MAKE=make
32 SUBDIR=$(MOD) util odr $(RFC1006) ccl comstack retrieval client server ztest makelib
33 # Add external libraries to the LIBS macro
34 LIBS=@LIBS@
35
36 RANLIB=@RANLIB@
37
38 # Installation directories, etc.
39 #  Binaries
40 prefix=@prefix@
41 exec_prefix=@exec_prefix@
42
43 BINDIR=$(exec_prefix)/bin
44 #  Public libraries and header files
45 LIBDIR=$(exec_prefix)/lib
46 INCDIR=$(prefix)/include
47 #  Misc tables, etc.
48 YAZDIR=$(prefix)/lib/yaz
49
50 all:
51         for i in $(SUBDIR); do cd $$i; if $(MAKE) CC="$(CC)" \
52                 RANLIB="$(RANLIB)" LIBS="$(LIBS)" \
53                 INCLUDE="$(INCLUDE)" CFLAGS="$(CFLAGS)" \
54                 CDEFS="$(CDEFS)" \
55                 LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
56                 then cd ..; else exit 1; fi; done
57
58 dep depend:
59         for i in $(SUBDIR); do cd $$i; if $(MAKE) CPP="$(CPP)" \
60                 INCLUDE="$(INCLUDE)" CDEFS="$(CDEFS)" depend;\
61                  then cd ..; else exit 1; fi; done
62
63 clean:
64         for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
65         -rm lib/*.a
66
67 oclean:
68         for i in $(SUBDIR); do (cd $$i; rm -f *.o); done
69         mv lib/libyaz.a .; rm -f lib/*.a; mv libyaz.a lib
70         cd client; strip client
71         cd server; strip ztest
72
73 cleanup:
74         rm -f `find $(SUBDIR) -name "*.[oa]" -print`
75         rm -f `find $(SUBDIR) -name "core" -print`
76         rm -f `find $(SUBDIR) -name "errlist" -print`
77         rm -f `find $(SUBDIR) -name "a.out" -print`
78
79 distclean: clean cleandepend
80
81 cleandepend: 
82         for i in $(SUBDIR); do (cd $$i; \
83                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
84                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
85
86 install: all install.misc install.lib install.bin
87
88 install.bin:
89         @if [ ! -d $(BINDIR) ]; then \
90                 echo "Making directory $(BINDIR)"; \
91                 mkdir $(BINDIR); \
92         fi
93         @echo "Installing client -> $(BINDIR)"; \
94         cp client/client $(BINDIR)/client; chmod 755 $(BINDIR)/client
95         @echo "Installing ztest -> $(BINDIR)"; \
96         cp server/ztest $(BINDIR)/ztest; chmod 755 $(BINDIR)/ztest
97
98 install.lib:
99         @if [ ! -d $(LIBDIR) ]; then \
100                 echo "Making directory $(LIBDIR)"; \
101                 mkdir $(LIBDIR); \
102         fi
103         @echo "Installing libyaz.a -> $(LIBDIR)"; \
104         cp lib/libyaz.a $(LIBDIR)/libyaz.a; \
105         chmod 644 $(LIBDIR)/libyaz.a
106         @if [ -f lib/librfc.a ]; then \
107                 echo "Installing librfc.a -> $(LIBDIR)"; \
108                 cp lib/librfc.a $(LIBDIR)/librfc.a; \
109                 chmod 644 $(LIBDIR)/librfc.a; \
110         fi
111         @if [ ! -d $(INCDIR) ]; then \
112                 echo "Making directory $(INCDIR)"; \
113                 mkdir $(INCDIR); \
114         fi
115         @cd include; for f in *.h; do \
116                 echo "Installing $$f -> $(INCDIR)"; \
117                 cp $$f $(INCDIR)/$$f; chmod 644 $(INCDIR)/$$f; \
118         done
119
120 install.misc:
121         @if [ ! -d $(YAZDIR) ]; then \
122                 echo "Making directory $(YAZDIR)"; \
123                 mkdir $(YAZDIR); \
124         fi
125         @cd tab; for f in *; do \
126                 if [ -f $$f ]; then \
127                         echo "Installing $$f -> $(YAZDIR)"; \
128                         cp $$f $(YAZDIR)/$$f; chmod 644 $(YAZDIR)/$$f; \
129                 fi; \
130         done
131
132 wc:
133         wc `find . -name '*.[ch]'`
134