Imported Upstream version 2.5.1
[debian/amanda] / tape-src / Makefile.am
1 # Makefile for Amanda tape library.
2
3 INCLUDES =      -I$(top_builddir)/common-src \
4                 -I$(top_srcdir)/common-src
5
6 LINT=@AMLINT@
7 LINTFLAGS=@AMLINTFLAGS@
8
9 lib_LTLIBRARIES =       libamtape.la
10 LIB_EXTENSION = la
11
12 sbin_PROGRAMS=          ammt amdd amtapetype
13
14 libamtape_la_SOURCES =  output-file.c \
15                         output-null.c \
16                         output-rait.c \
17                         output-tape.c \
18                         tapeio.c
19
20 libamtape_la_LDFLAGS =  -release $(VERSION)
21
22 ###
23 # Because libamanda includes routines (e.g. regex) provided by some system
24 # libraries, and because of the way libtool sets up the command line, we
25 # need to list libamanda twice here, first to override the system library
26 # routines, and second to pick up any references in the other libraries.
27 ###
28
29 LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
30         libamtape.$(LIB_EXTENSION) \
31         ../common-src/libamanda.$(LIB_EXTENSION)
32
33 # used for testing only
34
35 TEST_PROGS =            amtapeio
36
37 EXTRA_PROGRAMS =        $(TEST_PROGS)
38
39 CLEANFILES = *.test.c
40
41 amtapetype_SOURCES = tapetype.c
42
43 noinst_HEADERS =        \
44                         output-file.h \
45                         output-null.h \
46                         output-rait.h \
47                         output-tape.h \
48                         tapeio.h
49
50 install-exec-hook:
51         @list="$(sbin_PROGRAMS) $(sbin_SCRIPTS)"; \
52         for p in $$list; do \
53                 pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
54                 echo chown $(BINARY_OWNER) $$pa; \
55                 chown $(BINARY_OWNER) $$pa; \
56                 echo chgrp $(SETUID_GROUP) $$pa; \
57                 chgrp $(SETUID_GROUP) $$pa; \
58         done
59         @list="$(libexec_PROGRAMS) $(libexec_SCRIPTS)"; \
60         for p in $$list; do \
61                 pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
62                 echo chown $(BINARY_OWNER) $$pa; \
63                 chown $(BINARY_OWNER) $$pa; \
64                 echo chgrp $(SETUID_GROUP) $$pa; \
65                 chgrp $(SETUID_GROUP) $$pa; \
66         done
67
68 amtapeio_SOURCES = amtapeio.test.c
69 amtapeio_LDADD =        ../common-src/libamanda.$(LIB_EXTENSION) \
70                         libamtape.$(LIB_EXTENSION) \
71                         ../common-src/libamanda.$(LIB_EXTENSION)
72
73 amtapeio.test.c: $(srcdir)/tapeio.c
74         echo '#define TEST' >$@
75         echo '#include "$<"' >>$@
76
77 %.test.c: $(srcdir)/%.c
78         echo '#define TEST' >$@
79         echo '#include "$<"' >>$@
80
81 tapetype:
82         @echo "Use amtapetype instead"
83
84 lint:
85         @ for p in $(sbin_PROGRAMS); do                                         \
86                 if [ $$p = "amtapetype" ]; then                                 \
87                         s="$(amtapetype_SOURCES)";                              \
88                 else                                                            \
89                         s=$$p.c;                                                \
90                 fi;                                                             \
91                 f="$$s $(libamandad_la_SOURCES)";                               \
92                 f="$$f "`(cd ../common-src; make listlibsrc 2>&1 > /dev/null)`; \
93                 (cd ../common-src; make listlibsrc);                            \
94                 f="$$f "`cat ../common-src/listlibsrc.output`;                  \
95                 echo $(LINT) $$f;                                               \
96                 $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I../config        \
97                     $(INCLUDES) $$f;                                            \
98                 if [ $$? -ne 0 ]; then                                          \
99                     exit 1;                                                     \
100                 fi;                                                             \
101         done;                                                                   \
102         exit 0
103
104 listlibsrc:
105         @ for p in $(libamtape_la_SOURCES); do  \
106                 listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
107         done;                                                   \
108         echo $$listlibsrcs > listlibsrc.output