+superminfsdir = $(libdir)/guestfs/supermin.d
+
+# These are the resulting output files from the whole process:
+# VMLINUZ kernel for the full appliance
+# INITRAMFSIMG initramfs (ie. root fs) for the full appliance
+# For details of the supermin appliance, read the README file.
+fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
+if SUPERMIN
+fs_DATA += kmod.whitelist
+superminfs_DATA = \
+ supermin.d/base.img \
+ supermin.d/daemon.img \
+ supermin.d/hostfiles
+endif
+
+# Don't change these names - they must be the same as in '*.sh' scripts.
+INITRAMFSIMG = initramfs.$(host_cpu).img
+VMLINUZ = vmlinuz.$(host_cpu)
+
+# This is for building the normal appliance:
+$(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
+
+$(top_builddir)/initramfs/fakeroot.log: make.sh kmod.whitelist packagelist
+ mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak 2>/dev/null; :
+ mv $(VMLINUZ) $(VMLINUZ).bak 2>/dev/null; :
+ if ! bash make.sh; then rm -f $@; exit 1; fi
+
+# This used to be a configure-generated file (as is update.sh still).
+# However config.status always touches the destination file, which
+# means the appliance got rebuilt too often.
+make.sh: make.sh.in
+ cd $(top_builddir) && \
+ ./config.status --file=appliance/$@-t:appliance/$<
+ chmod +x $@-t
+ mv $@-t $@
+
+$(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd init update.sh
+ rm -f $@
+ bash update.sh
+ touch $@