Added new option '-c' to specify configuration name in control block.
[yaz-moved-to-github.git] / Makefile
1 # Copyright (C) 1994, Index Data I/S 
2 # All rights reserved.
3 # Sebastian Hammer, Adam Dickmeiss
4 # $Id: Makefile,v 1.27 1995-11-17 11:08:57 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 #CC=
14 SHELL=/bin/sh
15 MAKE=make
16 SUBDIR=util odr asn $(RFC1006) ccl comstack retrieval client server makelib
17 # Add external libraries to the ELIBS macro
18 ELIBS=
19 CONTROL=RANLIB="ranlib" ELIBS="$(ELIBS)"
20
21 # Installation directories, etc.
22 #  Binaries
23 BINDIR=/usr/local/bin
24 #  Public libraries and header files
25 LIBDIR=/usr/local/lib
26 INCDIR=/usr/local/include
27 #  Misc tables, etc.
28 YAZDIR=/usr/local/yaz
29
30 all:
31         for i in $(SUBDIR); do cd $$i; if $(MAKE) $(CONTROL)\
32         CFLAGS="$(CFLAGS) $(CDEFS)" LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
33         then cd ..; else exit 1; fi; done
34
35 dep depend:
36         for i in $(SUBDIR); do cd $$i; if $(MAKE) depend; then cd ..; else exit 1; fi; done
37
38 clean:
39         for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
40         -rm lib/*.a
41
42 cleanup:
43         rm -f `find $(SUBDIR) -name "*.[oa]" -print`
44         rm -f `find $(SUBDIR) -name "core" -print`
45         rm -f `find $(SUBDIR) -name "errlist" -print`
46         rm -f `find $(SUBDIR) -name "a.out" -print`
47
48 distclean: clean cleandepend
49
50 cleandepend: 
51         for i in $(SUBDIR); do (cd $$i; \
52                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
53                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
54
55 taildepend:
56         for i in $(SUBDIR); do (cd $$i; \
57                 if sed 's/^if/#if/' <Makefile|sed 's/^include/#include/'| \
58                 sed 's/^endif/#endif/' | \
59                 sed 's/^depend: depend2/depend: depend1/g' | \
60                 sed '/^#Depend/q' >Makefile.tmp; then \
61                 mv -f Makefile.tmp Makefile; fi); done
62
63 gnudepend:
64         for i in $(SUBDIR); do (cd $$i; \
65                 if sed '/^#Depend/q' <Makefile| \
66                 sed 's/^#if/if/' |sed 's/^#include/include/'| \
67                 sed 's/^#endif/endif/' | \
68                 sed 's/^depend: depend1/depend: depend2/g' >Makefile.tmp;then \
69                 mv -f Makefile.tmp Makefile; fi); done
70
71 install: all install.misc install.lib install.bin
72
73 install.bin:
74         @if [ ! -d $(BINDIR) ]; then \
75                 echo "Making directory $(BINDIR)"; \
76                 mkdir $(BINDIR); \
77         fi
78         @echo "Installing client -> $(BINDIR)"; \
79         cp client/client $(BINDIR)/client; chmod 755 $(BINDIR)/client
80         @echo "Installing ztest -> $(BINDIR)"; \
81         cp server/ztest $(BINDIR)/ztest; chmod 755 $(BINDIR)/ztest
82
83 install.lib:
84         @if [ ! -d $(LIBDIR) ]; then \
85                 echo "Making directory $(LIBDIR)"; \
86                 mkdir $(LIBDIR); \
87         fi
88         @echo "Installing libyaz.a -> $(LIBDIR)"; \
89         cp lib/libyaz.a $(LIBDIR)/libyaz.a; \
90         chmod 644 $(LIBDIR)/libyaz.a
91         @if [ -f lib/librfc.a ]; then \
92                 echo "Installing librfc.a -> $(LIBDIR)"; \
93                 cp lib/librfc.a $(LIBDIR)/librfc.a; \
94                 chmod 644 $(LIBDIR)/librfc.a; \
95         fi
96         @if [ ! -d $(INCDIR) ]; then \
97                 echo "Making directory $(INCDIR)"; \
98                 mkdir $(INCDIR); \
99         fi
100         @cd include; for f in *.h; do \
101                 echo "Installing $$f -> $(INCDIR)"; \
102                 cp $$f $(INCDIR)/$$f; chmod 644 $(INCDIR)/$$f; \
103         done
104
105 install.misc:
106         @if [ ! -d $(YAZDIR) ]; then \
107                 echo "Making directory $(YAZDIR)"; \
108                 mkdir $(YAZDIR); \
109         fi
110         @cd tab; for f in *; do \
111                 if [ -f $$f ]; then \
112                         echo "Installing $$f -> $(YAZDIR)"; \
113                         cp $$f $(YAZDIR)/$$f; chmod 644 $(YAZDIR)/$$f; \
114                 fi; \
115         done
116
117 wc:
118         wc `find . -name '*.[ch]'`
119