febootstrap-supermin-helper: Replace objcopy call for embedding init binary
[febootstrap.git] / helper / Makefile.am
1 # febootstrap Makefile.am
2 # (C) Copyright 2010 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 #
18 # Written by Richard W.M. Jones <rjones@redhat.com>
19
20 bin_PROGRAMS = \
21         febootstrap-supermin-helper
22
23 febootstrap_supermin_helper_SOURCES = \
24         helper.h \
25         appliance.c \
26         checksum.c \
27         cpio.c \
28         ext2.c \
29         ext2cpio.c \
30         ext2initrd.c \
31         ext2internal.h \
32         kernel.c \
33         main.c \
34         utils.c
35 febootstrap_supermin_helper_CFLAGS = -Wall -I../lib
36 febootstrap_supermin_helper_LDADD = \
37         ext2init.o -lext2fs -lcom_err $(LTLIBINTL) -L../lib -lgnu
38
39 # init "script" used by ext2 initrd.
40 noinst_PROGRAMS = init
41 init_SOURCES = init.c
42 init_CFLAGS = -static
43 init_LDFLAGS = -static
44
45 # http://www.doof.me.uk/2010/05/07/cute-objcopy-hack/
46 ELF_DEFAULT_ARCH = $(shell $(srcdir)/elf-default-arch | gawk '{ print $$1 }')
47 DEFAULT_ARCH = $(shell $(srcdir)/elf-default-arch | gawk '{ print $$2 }')
48
49 CLEANFILES = ext2init.S
50
51 ext2init.o: ext2init.S
52         $(CC) -o $@ -c $<
53
54 ext2init.S: init
55         strip --strip-all $<
56         @file $< | grep -isq static || \
57           (echo "*** error: init is not staticly linked"; exit 1)
58         ./bin2s.pl $< $@
59
60 man_MANS = \
61         febootstrap-supermin-helper.8
62
63 if HAVE_PERLDOC
64
65 febootstrap-supermin-helper.8: febootstrap-supermin-helper.pod
66         pod2man \
67           --section 8 \
68           -c "Virtualization Support" \
69           --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
70           $< > $@
71
72 noinst_DATA = \
73         $(top_builddir)/html/febootstrap-supermin-helper.8.html
74
75 $(top_builddir)/html/febootstrap-supermin-helper.8.html: febootstrap-supermin-helper.pod
76         mkdir -p $(top_builddir)/html
77         cd $(top_builddir) && pod2html \
78           --css 'pod.css' \
79           --htmldir html \
80           --outfile html/febootstrap-supermin-helper.8.html \
81           helper/febootstrap-supermin-helper.pod
82
83 endif
84
85 EXTRA_DIST = \
86         febootstrap-supermin-helper.8 \
87         febootstrap-supermin-helper.pod \
88         bin2s.pl