Imported Upstream version 3.1.0
[debian/amanda] / recover-src / Makefile.am
index 042feba69cd943d5a8dd4fa89e9aaa967013ad06..d5859b78fb5d59c377de3b001289790a7b1f63fd 100644 (file)
@@ -1,15 +1,22 @@
 # Makefile for Amanda file recovery programs.
 
-INCLUDES =             -I$(top_srcdir)/common-src -I$(top_srcdir)/client-src \
-                       -I$(top_srcdir)/tape-src
+include $(top_srcdir)/config/automake/vars.am
+include $(top_srcdir)/config/automake/installperms.am
+include $(top_srcdir)/config/automake/precompile.am
 
-LIB_EXTENSION = la
+INCLUDES =     -I$(top_builddir)/common-src \
+               -I$(top_srcdir)/common-src   \
+               -I$(top_srcdir)/client-src   \
+               -I$(top_srcdir)/amandad-src   \
+               -I$(top_srcdir)/gnulib
 
-sbin_PROGRAMS =                amrecover
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
 
-if WANT_RUNTIME_PSEUDO_RELOC
-AM_LDFLAGS = -Wl,-enable-runtime-pseudo-reloc
-endif
+sbin_PROGRAMS =                amrecover
 
 ###
 # Because libamanda includes routines (e.g. regex) provided by some system
@@ -18,33 +25,47 @@ endif
 # routines, and second to pick up any references in the other libraries.
 ###
 
-LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
+LDADD = ../common-src/libamanda.la \
        @LEXLIB@ \
-       ../client-src/libamclient.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       $(READLINE_LIBS)
+       $(READLINE_LIBS) \
+       ../client-src/libamclient.la \
+       ../common-src/libamanda.la
 
-amrecover_SOURCES =    amrecover.c                                     \
+amrecover_CSRC =       amrecover.c                                     \
                        display_commands.c              extract_list.c  \
-                       help.c                          set_commands.c  \
-                       uparse.y                        uscan.l
+                       help.c                          set_commands.c
+
+amrecover_SOURCES =    $(amrecover_CSRC)       uparse.y        uscan.l
 
 noinst_HEADERS =       amrecover.h uparse.h
 
 AM_YFLAGS =            -d
 
-install-exec-hook:
-       @list="$(sbin_PROGRAMS)"; \
-       for p in $$list; do \
-               pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
-               echo chown $(BINARY_OWNER) $$pa; \
-               chown $(BINARY_OWNER) $$pa; \
-               echo chgrp $(SETUID_GROUP) $$pa; \
-               chgrp $(SETUID_GROUP) $$pa; \
-               echo chmod o-rwx $$pa; \
-               chmod o-rwx $$pa; \
-       done
-
 # so that uscan.c is never generated before uparse.h
 # otherwise we might have makedepend problems
-$(srcdir)/uscan.c: $(srcdir)/uparse.h
+uscan.c: uparse.h
+
+# these two commands are specially defined to omit $(AMANDA_WARNING_CFLAGS)
+# since we don't want warnings for generated code
+uscan.$(OBJEXT): uscan.c ../common-src/amanda.h uparse.h
+       $(CC) $(CFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -c $<
+
+uparse.$(OBJEXT): uparse.c ../common-src/amanda.h amrecover.h
+       $(CC) $(CFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -c $<
+
+INSTALLPERMS_exec = \
+       dest=$(sbindir) chown=amanda chmod=0750 $(sbin_PROGRAMS)
+
+lint:
+       @f="$(amrecover_CSRC)";                                                 \
+       (cd ../common-src; make listlibsrc);                                    \
+       f="$$f "`cat ../common-src/listlibsrc.output`;                          \
+       (cd ../server-src; make listlibsrc);                                    \
+       f="$$f "`cat ../server-src/listlibsrc.output`;                          \
+       echo $(LINT) $$f;                                                       \
+       $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $$f;\
+       if [ $$? -ne 0 ]; then                                                  \
+           exit 1;                                                             \
+       fi;                                                                     \
+        exit 0
+