Minor changes for project.
[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.4 1998-09-28 12:44:47 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 lib
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
66 oclean:
67         for i in $(SUBDIR); do (cd $$i; rm -f *.o); done
68         mv lib/libyaz.a .; rm -f lib/*.a; mv libyaz.a lib
69         cd client; strip client
70         cd server; strip ztest
71
72 cleanup:
73         rm -f `find $(SUBDIR) -name "*.[oa]" -print`
74         rm -f `find $(SUBDIR) -name "core" -print`
75         rm -f `find $(SUBDIR) -name "errlist" -print`
76         rm -f `find $(SUBDIR) -name "a.out" -print`
77
78 distclean: clean cleandepend
79
80 cleandepend: 
81         for i in $(SUBDIR); do (cd $$i; \
82                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
83                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
84
85 install: all install.misc install.lib install.bin
86
87 install.bin:
88         @if [ ! -d $(BINDIR) ]; then \
89                 echo "Making directory $(BINDIR)"; \
90                 mkdir $(BINDIR); \
91         fi
92         @echo "Installing client -> $(BINDIR)"; \
93         cp client/client $(BINDIR)/client; chmod 755 $(BINDIR)/client
94         @echo "Installing ztest -> $(BINDIR)"; \
95         cp server/ztest $(BINDIR)/ztest; chmod 755 $(BINDIR)/ztest
96
97 install.lib:
98         @if [ ! -d $(LIBDIR) ]; then \
99                 echo "Making directory $(LIBDIR)"; \
100                 mkdir $(LIBDIR); \
101         fi
102         @echo "Installing libyaz.a -> $(LIBDIR)"; \
103         cp lib/libyaz.a $(LIBDIR)/libyaz.a; \
104         chmod 644 $(LIBDIR)/libyaz.a
105         @if [ -f lib/librfc.a ]; then \
106                 echo "Installing librfc.a -> $(LIBDIR)"; \
107                 cp lib/librfc.a $(LIBDIR)/librfc.a; \
108                 chmod 644 $(LIBDIR)/librfc.a; \
109         fi
110         @if [ ! -d $(INCDIR) ]; then \
111                 echo "Making directory $(INCDIR)"; \
112                 mkdir $(INCDIR); \
113         fi
114         @cd include; for f in *.h; do \
115                 echo "Installing $$f -> $(INCDIR)"; \
116                 cp $$f $(INCDIR)/$$f; chmod 644 $(INCDIR)/$$f; \
117         done
118
119 install.misc:
120         @if [ ! -d $(YAZDIR) ]; then \
121                 echo "Making directory $(YAZDIR)"; \
122                 mkdir $(YAZDIR); \
123         fi
124         @cd tab; for f in *; do \
125                 if [ -f $$f ]; then \
126                         echo "Installing $$f -> $(YAZDIR)"; \
127                         cp $$f $(YAZDIR)/$$f; chmod 644 $(YAZDIR)/$$f; \
128                 fi; \
129         done
130
131 wc:
132         wc `find . -name '*.[ch]'`
133