a7f5b9147675ddecddaf0c4bc6273b8c5306d631
[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
6 lib_LTLIBRARIES =       libamclient.la
7 LIB_EXTENSION = la
8
9 libexec_PROGRAMS =      amandad noop calcsize killpgrp rundump runtar selfcheck sendbackup sendsize versionsuffix
10
11 sbin_SCRIPTS =          @CLIENT_SCRIPTS_OPT@
12
13 libexec_SCRIPTS =       patch-system
14
15 if WANT_SAMBA
16 samba_sources = findpass.c
17 endif
18
19 if WANT_RUNTIME_PSEUDO_RELOC
20 AM_LDFLAGS = -Wl,-enable-runtime-pseudo-reloc
21 endif
22
23 libamclient_la_SOURCES= amandates.c             getfsent.c      \
24                         unctime.c               client_util.c   \
25                         $(samba_sources)
26
27 libamclient_la_LDFLAGS = -release $(VERSION)
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         libamclient.$(LIB_EXTENSION)
38 if WANT_SERVER
39 LDADD += ../tape-src/libamtape.$(LIB_EXTENSION)
40 endif
41 LDADD += ../common-src/libamanda.$(LIB_EXTENSION)
42
43 SUFFIXES =              .sh .pl
44
45 .pl:
46                         cat $< > $@
47                         chmod a+x $@
48                         -test -z "$(PERL)" || $(PERL) -c $@
49
50 .sh:
51                         cat $< > $@
52                         chmod a+x $@
53
54 # these are used for testing only:
55 TEST_PROGS = getfsent
56
57 EXTRA_PROGRAMS =        $(TEST_PROGS)
58
59 CLEANFILES = *.test.c patch-system
60
61 EXTRA_SCRIPTS =         amhpfixdevs             amsinixfixdevs
62
63 DISTCLEANFILES =        $(EXTRA_SCRIPTS)
64
65 EXTRA_DIST =            amhpfixdevs.sh          amsinixfixdevs.sh
66
67 sendbackup_SOURCES =    sendbackup.c            sendbackup.h    \
68                         sendbackup-dump.c       sendbackup-gnutar.c
69
70 noinst_HEADERS  =       amandad.h       amandates.h     getfsent.h      \
71                         findpass.h      client_util.h
72
73 install-exec-hook:
74         @list="$(sbin_SCRIPTS)"; \
75         for p in $$list; do \
76                 pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
77                 echo chown $(BINARY_OWNER) $$pa; \
78                 chown $(BINARY_OWNER) $$pa; \
79                 echo chgrp $(SETUID_GROUP) $$pa; \
80                 chgrp $(SETUID_GROUP) $$pa; \
81         done
82         @list="$(libexec_PROGRAMS) $(libexec_SCRIPTS)"; \
83         for p in $$list; do \
84                 pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
85                 echo chown $(BINARY_OWNER) $$pa; \
86                 chown $(BINARY_OWNER) $$pa; \
87                 echo chgrp $(SETUID_GROUP) $$pa; \
88                 chgrp $(SETUID_GROUP) $$pa; \
89         done
90 if WANT_SETUID_CLIENT
91         @list="calcsize killpgrp rundump runtar"; \
92         for p in $$list; do \
93                 if echo "$(libexec_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
94                         pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
95                         echo chown root $$pa; \
96                         chown root $$pa; \
97                         echo chmod u+s,o-rwx $$pa; \
98                         chmod u+s,o-rwx $$pa; \
99                 else true; \
100                 fi; \
101         done
102 endif
103
104 getfsent_SOURCES = getfsent.test.c
105
106 %.test.c: $(srcdir)/%.c
107         echo '#define TEST' >$@
108         echo '#include "$<"' >>$@