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