supermin: Add special case for libgcc_s-*.so.N
[libguestfs.git] / images / Makefile.am
1 # libguestfs test images
2 # Copyright (C) 2009 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 include $(top_srcdir)/subdir-rules.mk
19
20 # Old RHEL 5 autoconf doesn't have builddir.
21 builddir ?= $(top_builddir)/images
22
23 EXTRA_DIST = \
24         helloworld.tar \
25         helloworld.tar.gz \
26         mbr-ext2-empty.img.gz \
27         empty known-1 known-2 known-3 known-4 known-5 \
28         bin-i586-dynamic \
29         bin-sparc-dynamic \
30         bin-win32.exe \
31         bin-win64.exe \
32         bin-x86_64-dynamic \
33         lib-i586.so \
34         lib-sparc.so \
35         lib-win32.dll \
36         lib-win64.dll \
37         lib-x86_64.so \
38         test-grep.txt
39
40 noinst_DATA = test.iso
41
42 CLEANFILES = \
43         test.iso test.sqsh \
44         100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
45         initrd
46
47 images_files_src = \
48         $(srcdir)/helloworld.tar \
49         $(srcdir)/helloworld.tar.gz \
50         $(srcdir)/empty \
51         $(srcdir)/known-1 \
52         $(srcdir)/known-2 \
53         $(srcdir)/known-3 \
54         $(srcdir)/known-4 \
55         $(srcdir)/known-5 \
56         $(srcdir)/bin-i586-dynamic \
57         $(srcdir)/bin-sparc-dynamic \
58         $(srcdir)/bin-win32.exe \
59         $(srcdir)/bin-win64.exe \
60         $(srcdir)/bin-x86_64-dynamic \
61         $(srcdir)/lib-i586.so \
62         $(srcdir)/lib-sparc.so \
63         $(srcdir)/lib-win32.dll \
64         $(srcdir)/lib-win64.dll \
65         $(srcdir)/lib-x86_64.so \
66         $(srcdir)/test-grep.txt
67
68 images_files_build = \
69         $(builddir)/100kallzeroes \
70         $(builddir)/100kallnewlines \
71         $(builddir)/100kallspaces \
72         $(builddir)/100krandom \
73         $(builddir)/10klines \
74         $(builddir)/initrd \
75         $(builddir)/initrd-x86_64.img \
76         $(builddir)/initrd-x86_64.img.gz \
77         $(builddir)/test-grep.txt.gz
78
79 images_files = $(images_files_src) $(images_files_build)
80
81 test.iso: $(images_files)
82         rm -f $@ $@-t
83         mkdir -p directory
84         $(MKISOFS) -J -r -graft-points \
85           -o $@-t \
86           $(images_files) /directory=directory
87         rmdir directory
88         mv $@-t $@
89
90 $(builddir)/100kallzeroes:
91         rm -f $@ $@-t
92         dd if=/dev/zero of=$@-t bs=1024 count=100
93         mv $@-t $@
94
95 $(builddir)/100kallnewlines: $(builddir)/100kallzeroes
96         rm -f $@ $@-t
97         tr '\0' '\n' < $< > $@-t
98         mv $@-t $@
99
100 $(builddir)/100kallspaces: $(builddir)/100kallzeroes
101         rm -f $@ $@-t
102         tr '\0' ' ' < $< > $@-t
103         mv $@-t $@
104
105 $(builddir)/100krandom:
106         rm -f $@ $@-t
107         dd if=/dev/urandom of=$@-t bs=1024 count=100
108         mv $@-t $@
109
110 $(builddir)/10klines:
111         rm -f $@ $@-t
112         i=0; \
113         while [ $$i -lt 10000 ]; do \
114           echo "$${i}abcdefghijklmnopqrstuvwxyz"; \
115           i=$$(($$i+1)); \
116         done > $@-t
117         mv $@-t $@
118
119 $(builddir)/initrd: empty known-1 known-2 known-3 known-4 known-5
120         rm -f $@ $@-t
121         for f in $^; do echo $$f; done | cpio -o -H newc | gzip --best > $@-t
122         mv $@-t $@
123
124 # Create a dummy initrd with a single file called 'bin/nash' which
125 # is used to test the Sys::Guestfs::Lib::file_architecture function.
126 $(builddir)/initrd-x86_64.img: bin-x86_64-dynamic
127         rm -rf bin $@ $@-t
128         mkdir bin
129         cp $< bin/nash
130         echo bin/nash | cpio -o -H newc > $@-t
131         mv $@-t $@
132         rm -rf bin $@-t
133
134 $(builddir)/initrd-x86_64.img.gz: initrd-x86_64.img
135         rm -f $@ $@-t
136         gzip --best -c $< > $@-t
137         mv $@-t $@
138
139 $(builddir)/test-grep.txt.gz: test-grep.txt
140         rm -f $@ $@-t
141         gzip --best -c $< > $@-t
142         mv $@-t $@