Imported Upstream version 2.5.1
[debian/amanda] / client-src / Makefile.am
1 # Makefile for Amanda client programs.
2
3 INCLUDES =      -I$(top_builddir)/common-src \
4                 -I$(top_srcdir)/common-src \
5                 -I$(top_srcdir)/amandad-src
6
7 LINT=@AMLINT@
8 LINTFLAGS=@AMLINTFLAGS@
9
10 lib_LTLIBRARIES =       libamclient.la
11 LIB_EXTENSION = la
12
13 libexec_PROGRAMS =      noop calcsize killpgrp rundump runtar selfcheck sendbackup sendsize versionsuffix
14
15 sbin_SCRIPTS =          @CLIENT_SCRIPTS_OPT@
16
17 libexec_SCRIPTS =       patch-system
18
19 if WANT_SAMBA
20 samba_sources = findpass.c
21 endif
22
23 if WANT_RUNTIME_PSEUDO_RELOC
24 AM_LDFLAGS = -Wl,-enable-runtime-pseudo-reloc
25 endif
26
27 libamclient_la_SOURCES= amandates.c             getfsent.c      \
28                         unctime.c               client_util.c   \
29                         clientconf.c            $(samba_sources)
30
31 libamclient_la_LDFLAGS = -release $(VERSION)
32
33 ###
34 # Because libamanda includes routines (e.g. regex) provided by some system
35 # libraries, and because of the way libtool sets up the command line, we
36 # need to list libamanda twice here, first to override the system library
37 # routines, and second to pick up any references in the other libraries.
38 ###
39
40 LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
41         libamclient.$(LIB_EXTENSION) \
42         ../amandad-src/libamandad.$(LIB_EXTENSION) \
43         ../common-src/libamanda.$(LIB_EXTENSION)
44
45 SUFFIXES =              .sh .pl
46
47 .pl:
48                         cat $< > $@
49                         chmod a+x $@
50                         -test -z "$(PERL)" || $(PERL) -c $@
51
52 .sh:
53                         cat $< > $@
54                         chmod a+x $@
55
56 # these are used for testing only:
57 TEST_PROGS = getfsent
58
59 EXTRA_PROGRAMS =        $(TEST_PROGS)
60
61 CLEANFILES = *.test.c patch-system
62
63 EXTRA_SCRIPTS =         amhpfixdevs             amsinixfixdevs
64
65 DISTCLEANFILES =        $(EXTRA_SCRIPTS)
66
67 EXTRA_DIST =            amhpfixdevs.sh          amsinixfixdevs.sh
68
69 sendbackup_SOURCES =    sendbackup.c            sendbackup.h      \
70                         sendbackup-dump.c       sendbackup-gnutar.c
71
72 noinst_HEADERS  =       amandates.h     getfsent.h      \
73                         findpass.h      client_util.h   \
74                         clientconf.h
75
76 install-exec-hook:
77         @list="$(sbin_SCRIPTS)"; \
78         for p in $$list; do \
79                 pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
80                 echo chown $(BINARY_OWNER) $$pa; \
81                 chown $(BINARY_OWNER) $$pa; \
82                 echo chgrp $(SETUID_GROUP) $$pa; \
83                 chgrp $(SETUID_GROUP) $$pa; \
84         done
85         @list="$(libexec_PROGRAMS) $(libexec_SCRIPTS)"; \
86         for p in $$list; do \
87                 pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
88                 echo chown $(BINARY_OWNER) $$pa; \
89                 chown $(BINARY_OWNER) $$pa; \
90                 echo chgrp $(SETUID_GROUP) $$pa; \
91                 chgrp $(SETUID_GROUP) $$pa; \
92         done
93 if WANT_SETUID_CLIENT
94         @list="calcsize killpgrp rundump runtar"; \
95         for p in $$list; do \
96                 if echo "$(libexec_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
97                         pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
98                         echo chown root $$pa; \
99                         chown root $$pa; \
100                         echo chmod u+s,o-rwx $$pa; \
101                         chmod u+s,o-rwx $$pa; \
102                 else true; \
103                 fi; \
104         done
105 endif
106
107 lint:
108         @ for p in $(libexec_PROGRAMS); do                                      \
109                 f="$$p.c $(libamclient_la_SOURCES)";                            \
110                 (cd ../common-src; make listlibsrc);                            \
111                 f="$$f "`cat ../common-src/listlibsrc.output`;                  \
112                 echo $(LINT) $$f;                                               \
113                 $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I../config        \
114                     $(INCLUDES) $$f;                                            \
115                 if [ $$? -ne 0 ]; then                                          \
116                     exit 1;                                                     \
117                 fi;                                                             \
118         done;                                                                   \
119         exit 0
120
121 getfsent_SOURCES = getfsent.test.c
122
123 %.test.c: $(srcdir)/%.c
124         echo '#define TEST' >$@
125         echo '#include "$<"' >>$@