Build cleanup to support separate source and build directories.
[ksplice.git] / Makefile.in
blob9bfc9b4b5354bdbe6ba9f418b83470d4cfdb275c
1 srcdir = @srcdir@
2 VPATH = $(srcdir)
4 prefix = @prefix@
5 exec_prefix = @exec_prefix@
6 bindir = @bindir@
7 sbindir = @sbindir@
8 libexecdir = @libexecdir@
9 mandir = @mandir@
10 datadir = @datadir@
11 datarootdir = @datarootdir@
13 CC = @CC@
14 CFLAGS = @CFLAGS@
15 CPPFLAGS = @CPPFLAGS@
16 LDFLAGS = @LDFLAGS@
17 LIBS = @LIBS@
18 SED = @SED@
19 PACKAGE_VERSION = @PACKAGE_VERSION@
20 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
22 perl_primary = ksplice-create ksplice-view ksplice-apply ksplice-undo ksplice.pm
23 perl_man = $(patsubst %,%.8,$(perl_primary))
25 have_static := $(wildcard $(srcdir)/objmanip-static)
27 default: $(perl_primary) $(perl_man) objutils
28 @echo "Ready for 'make install'"
30 ifeq ($(strip $(have_static)),)
32 objutils: objdiff objmanip
34 install-objdiff install-objmanip: install-%: %
35 install -m755 -D $< $(DESTDIR)$(libexecdir)/ksplice-$*
37 else
39 objutils:
41 install-objdiff install-objmanip: install-%: %-static
42 install -m755 -D $< $(DESTDIR)$(libexecdir)/ksplice-$*
44 endif
46 $(perl_primary): %: %.in Makefile
47 $(SED) 's|PACKAGE_VERSION|$(PACKAGE_VERSION)|;s|PACKAGE_BUGREPORT|$(PACKAGE_BUGREPORT)|;s|KSPLICE_DATA_DIR|$(datadir)/ksplice|;s|KSPLICE_LIBEXEC_DIR|$(libexecdir)|' $< > $@
49 $(perl_man): %.8: %
50 pod2man --center="Ksplice" --release="Ksplice v$(PACKAGE_VERSION)" --section=8 $< $@
52 objdiff objmanip: %: %.c objcommon.c objcommon.h allcommon-user.o
53 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< $(srcdir)/objcommon.c allcommon-user.o $(LIBS) -o $@
55 allcommon-user.o: kmodsrc/allcommon.c kmodsrc/allcommon.h
56 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
58 install: default install-objmanip install-objdiff
59 install -m644 -D ksplice-create.8 $(DESTDIR)$(mandir)/man8/ksplice-create.8
60 install -m644 -D ksplice-apply.8 $(DESTDIR)$(mandir)/man8/ksplice-apply.8
61 install -m644 -D ksplice-undo.8 $(DESTDIR)$(mandir)/man8/ksplice-undo.8
62 install -m644 -D ksplice-view.8 $(DESTDIR)$(mandir)/man8/ksplice-view.8
63 install -m755 -D ksplice-create $(DESTDIR)$(bindir)/ksplice-create
64 install -m755 -D ksplice-view $(DESTDIR)$(bindir)/ksplice-view
65 install -m755 -D ksplice-apply $(DESTDIR)$(sbindir)/ksplice-apply
66 install -m755 -D ksplice-undo $(DESTDIR)$(sbindir)/ksplice-undo
67 install -m755 -D $(srcdir)/gendiff-reversed $(DESTDIR)$(libexecdir)/ksplice-gendiff-reversed
68 install -m644 -D ksplice.pm $(DESTDIR)$(datadir)/ksplice/ksplice.pm
69 install -m644 -D $(srcdir)/kmodsrc/helper.c $(DESTDIR)$(datadir)/ksplice/kmodsrc/helper.c
70 install -m644 -D $(srcdir)/kmodsrc/helper.h $(DESTDIR)$(datadir)/ksplice/kmodsrc/helper.h
71 install -m644 -D $(srcdir)/kmodsrc/primary.c $(DESTDIR)$(datadir)/ksplice/kmodsrc/primary.c
72 install -m644 -D $(srcdir)/kmodsrc/primary.h $(DESTDIR)$(datadir)/ksplice/kmodsrc/primary.h
73 install -m644 -D $(srcdir)/kmodsrc/modcommon.c $(DESTDIR)$(datadir)/ksplice/kmodsrc/modcommon.c
74 install -m644 -D $(srcdir)/kmodsrc/modcommon.h $(DESTDIR)$(datadir)/ksplice/kmodsrc/modcommon.h
75 install -m644 -D $(srcdir)/kmodsrc/allcommon.c $(DESTDIR)$(datadir)/ksplice/kmodsrc/allcommon.c
76 install -m644 -D $(srcdir)/kmodsrc/allcommon.h $(DESTDIR)$(datadir)/ksplice/kmodsrc/allcommon.h
77 install -m644 -D $(srcdir)/kmodsrc/jumps.h $(DESTDIR)$(datadir)/ksplice/kmodsrc/jumps.h
78 install -m644 -D $(srcdir)/kmodsrc/nops.h $(DESTDIR)$(datadir)/ksplice/kmodsrc/nops.h
79 install -m644 -D $(srcdir)/kmodsrc/Makefile $(DESTDIR)$(datadir)/ksplice/kmodsrc/Makefile
80 install -m644 -D $(srcdir)/kmodsrc/ld-script $(DESTDIR)$(datadir)/ksplice/kmodsrc/ld-script
82 clean:
83 rm -f $(perl_primary)
84 rm -f $(perl_man)
85 rm -f objdiff objmanip allcommon-user.o
87 distclean: clean
88 rm -f Makefile
89 rm -f objdiff-static objmanip-static
90 rm -f configure config.status config.log