f191b33aa69f85199f3b5703607ea175a3b0537e
[yaz-moved-to-github.git] / Makefile.in
1 # Copyright (C) 1995-1999, Index Data 
2 # All rights reserved.
3 # Sebastian Hammer, Adam Dickmeiss
4 # $Id: Makefile.in,v 1.11 1999-06-08 13:11:55 adam Exp $
5
6 # Uncomment the lines below to enable mOSI communcation.
7 #CDEFS=-DUSE_XTIMOSI
8 #RFC1006=rfc1006
9 #LIBMOSI=../../xtimosi/src/libmosi.a ../lib/librfc.a
10 #XMOSI=xmosi.o
11
12 CDEFS=@DEFS@
13
14 # Standard include path and original protocol encoders.
15 INCLUDE=-I. -I../z39.50 -I../include
16
17 # The Module below is either asn (the original de/en-coders)
18 # or z39.50 (the compiled de/en-coders).
19 MOD=@ASNMODULE@
20
21 CC=@CC@
22 CPP=@CPP@
23 SHELL=/bin/sh
24 MAKE=make
25 SUBDIR=util odr $(MOD) zutil $(RFC1006) ccl comstack client server ztest retrieval lib
26 # Add external libraries to the LIBS macro
27 LIBS=@LIBS@
28
29 RANLIB=@RANLIB@
30
31 # Installation directories, etc.
32 #  Binaries
33 prefix=@prefix@
34 exec_prefix=@exec_prefix@
35
36 BINDIR=$(exec_prefix)/bin
37 #  Public libraries and header files
38 LIBDIR=$(exec_prefix)/lib
39 INCDIR=$(prefix)/include
40 #  Misc tables, etc.
41 YAZDIR=$(prefix)/lib/yaz
42
43 all:
44         for i in $(SUBDIR); do cd $$i; if $(MAKE) CC="$(CC)" \
45                 RANLIB="$(RANLIB)" LIBS="$(LIBS)" \
46                 INCLUDE="$(INCLUDE)" CFLAGS="$(CFLAGS)" \
47                 CDEFS="$(CDEFS)" \
48                 LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
49                 then cd ..; else exit 1; fi; done
50
51 dep depend:
52         for i in $(SUBDIR); do cd $$i; if $(MAKE) CPP="$(CPP)" \
53                 INCLUDE="$(INCLUDE)" CDEFS="$(CDEFS)" depend; \
54                 then cd ..; else exit 1; fi; done
55
56 clean:
57         for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
58
59 oclean:
60         for i in $(SUBDIR); do (cd $$i; rm -f *.o); done
61         mv lib/libyaz.a .; rm -f lib/*.a; mv libyaz.a lib
62         cd client; strip client
63         cd ztest; strip ztest
64
65 cleanup:
66         rm -f `find $(SUBDIR) -name "*.[oa]" -print`
67         rm -f `find $(SUBDIR) -name "core" -print`
68         rm -f `find $(SUBDIR) -name "errlist" -print`
69         rm -f `find $(SUBDIR) -name "a.out" -print`
70
71 distclean: clean cleandepend
72
73 cleandepend: 
74         for i in $(SUBDIR); do (cd $$i; \
75                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
76                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
77
78 install: all install.misc install.lib install.bin
79
80 install.bin:
81         @if [ ! -d $(BINDIR) ]; then \
82                 echo "Making directory $(BINDIR)"; \
83                 mkdir $(BINDIR); \
84         fi
85         @echo "Installing client -> $(BINDIR)"; \
86         cp client/client $(BINDIR)/client; chmod 755 $(BINDIR)/client
87         @echo "Installing ztest -> $(BINDIR)"; \
88         cp ztest/ztest $(BINDIR)/ztest; chmod 755 $(BINDIR)/ztest
89
90 install.lib:
91         @if [ ! -d $(LIBDIR) ]; then \
92                 echo "Making directory $(LIBDIR)"; \
93                 mkdir $(LIBDIR); \
94         fi
95         @echo "Installing libyaz.a -> $(LIBDIR)"; \
96         cp lib/libyaz.a $(LIBDIR)/libyaz.a; \
97         chmod 644 $(LIBDIR)/libyaz.a
98         @if [ -f lib/librfc.a ]; then \
99                 echo "Installing librfc.a -> $(LIBDIR)"; \
100                 cp lib/librfc.a $(LIBDIR)/librfc.a; \
101                 chmod 644 $(LIBDIR)/librfc.a; \
102         fi
103         @if [ ! -d $(INCDIR) ]; then \
104                 echo "Making directory $(INCDIR)"; \
105                 mkdir $(INCDIR); \
106         fi
107         @cd include; for f in *.h; do \
108                 echo "Installing $$f -> $(INCDIR)"; \
109                 cp $$f $(INCDIR)/$$f; chmod 644 $(INCDIR)/$$f; \
110         done
111
112 install.misc:
113         @if [ ! -d $(YAZDIR) ]; then \
114                 echo "Making directory $(YAZDIR)"; \
115                 mkdir $(YAZDIR); \
116         fi
117         @cd tab; for f in *; do \
118                 if [ -f $$f ]; then \
119                         echo "Installing $$f -> $(YAZDIR)"; \
120                         cp $$f $(YAZDIR)/$$f; chmod 644 $(YAZDIR)/$$f; \
121                 fi; \
122         done
123
124 wc:
125         wc `find . -name '*.[ch]'`
126