84c9b06c3a77d4fe50c8a2bb21e1294eded8b5cd
[debian/amanda] / server-src / Makefile.am
1 # Makefile for Amanda server programs.
2
3 ###
4 # Yes, I really mean ../common-src.  The genversion.h file ends up getting
5 # built there rather than into the source tree.
6 ###
7
8 INCLUDES =              -I$(top_srcdir)/common-src \
9                         -I../common-src \
10                         -I$(top_srcdir)/tape-src
11
12 lib_LTLIBRARIES =       libamserver.la
13 LIB_EXTENSION = la
14
15 sbin_PROGRAMS =         amadmin         amcheck         amflush         \
16                         amgetconf       amlabel         amtape          \
17                         amreport
18
19 libexec_PROGRAMS =      amindexd        amlogroll       amtrmidx        \
20                         amtrmlog        driver          dumper          \
21                         planner         taper           amcleanupdisk
22
23 sbin_SCRIPTS =          amcheckdb       amcleanup       amdump          \
24                         amoverview      amrmtape        amtoc           \
25                         amverify        amverifyrun     amstatus
26
27 libamserver_la_SOURCES= amindex.c       changer.c                       \
28                         conffile.c      diskfile.c      driverio.c      \
29                         holding.c       infofile.c      logfile.c       \
30                         tapefile.c      find.c          server_util.c
31
32 libamserver_la_LDFLAGS= -release $(VERSION)
33
34 ###
35 # Because libamanda includes routines (e.g. regex) provided by some system
36 # libraries, and because of the way libtool sets up the command line, we
37 # need to list libamanda twice here, first to override the system library
38 # routines, and second to pick up any references in the other libraries.
39 ###
40
41 LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
42         libamserver.$(LIB_EXTENSION) \
43         ../tape-src/libamtape.$(LIB_EXTENSION) \
44         ../common-src/libamanda.$(LIB_EXTENSION)
45
46 SUFFIXES =              .sh .pl
47
48 .pl:
49                         cat $< > $@
50                         chmod a+x $@
51                         -test -z "$(PERL)" || $(PERL) -c $@
52
53 .sh:
54                         cat $< > $@
55                         chmod a+x $@
56
57 # there are used for testing only:
58 TEST_PROGS = diskfile conffile infofile
59
60 EXTRA_PROGRAMS = $(TEST_PROGS)
61
62 EXTRA_DIST = dumper-krb4.c
63
64 CLEANFILES = *.test.c
65
66 amindexd_SOURCES =      amindexd.c                                      \
67                         disk_history.c                  disk_history.h  \
68                         list_dir.c                      list_dir.h
69
70 amreport_SOURCES =      reporter.c
71
72 amgetconf_SOURCES =     getconf.c
73
74 noinst_HEADERS =        amindex.h       changer.h                       \
75                         conffile.h      diskfile.h      driverio.h      \
76                         holding.h       infofile.h      logfile.h       \
77                         tapefile.h      find.h          server_util.h
78
79 install-exec-hook:
80         @list="$(sbin_PROGRAMS) $(sbin_SCRIPTS)"; \
81         for p in $$list; do \
82                 pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
83                 echo chown $(BINARY_OWNER) $$pa; \
84                 chown $(BINARY_OWNER) $$pa; \
85                 echo chgrp $(SETUID_GROUP) $$pa; \
86                 chgrp $(SETUID_GROUP) $$pa; \
87         done
88         @list="$(libexec_PROGRAMS) $(libexec_SCRIPTS)"; \
89         for p in $$list; do \
90                 pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
91                 echo chown $(BINARY_OWNER) $$pa; \
92                 chown $(BINARY_OWNER) $$pa; \
93                 echo chgrp $(SETUID_GROUP) $$pa; \
94                 chgrp $(SETUID_GROUP) $$pa; \
95         done
96         @list="amcheck"; \
97         for p in $$list; do \
98                 if echo "$(sbin_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
99                         pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
100                         echo chown root $$pa; \
101                         chown root $$pa; \
102                         echo chmod u+s,o-rwx $$pa; \
103                         chmod u+s,o-rwx $$pa; \
104                 else true; \
105                 fi; \
106         done
107         @list="dumper planner"; \
108         for p in $$list; do \
109                 if echo "$(libexec_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
110                         pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
111                         echo chown root $$pa; \
112                         chown root $$pa; \
113                         echo chmod u+s,o-rwx $$pa; \
114                         chmod u+s,o-rwx $$pa; \
115                 else true; \
116                 fi; \
117         done
118
119 diskfile_SOURCES = diskfile.test.c
120 conffile_SOURCES = conffile.test.c
121 infofile_SOURCES = infofile.test.c
122
123 %.test.c: $(srcdir)/%.c
124         echo '#define TEST' >$@
125         echo '#include "$<"' >>$@