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