# $Progeny: Makefile,v 1.176 2002/04/23 22:32:42 branden Exp $

SHELL=	/bin/sh -e
# XXX: make this configurable at some point

prefix?=	/usr
exec_prefix?=	${prefix}
bindir?=	${exec_prefix}/bin
mandir?=	${datadir}/man
datadir?=	${prefix}/share

ifndef OPTIONS_FILE_SOURCED

# for install-pgi rule (package building) only; otherwise this is set in the options file
ARCH=	$(shell dpkg --print-architecture)
ETC_DIR=/etc/pgi/custom
PGI_DIR=${prefix}/share/pgi

all:
	@echo "You must source $(ETC_DIR)/options in your shell before proceeding." >&2
	@echo "If you are not using the pgi-build command, you probably should be." >&2
	@exit 1
else

ifdef INSTALLER_ONLY
ARCHIVE=
else
ARCHIVE=archive
endif

ifdef DEBIAN_DEBOOTSTRAP
DEBOOTSTRAP_BUILD_DIR=
DEBOOTSTRAP_INSTALL_DIR=
DEBOOTSTRAP_RULE=
else
DEBOOTSTRAP_SOURCE_DIR=debootstrap
DEBOOTSTRAP_BUILD_DIR=${TDIR}/debootstrap-source
DEBOOTSTRAP_INSTALL_DIR=${TDIR}/debootstrap
DEBOOTSTRAP_RULE=${TDIR}/debootstrap-stamp
export DEBOOTSTRAP_INSTALL_DIR
endif

SUBDIR=		stage0 stage1 images/${ARCH} ${ARCHIVE}

all: ${DEBOOTSTRAP_RULE} _all_recursive

_all_recursive:
	@for dir in ${SUBDIR}; do					\
		${MAKE} -C $$dir "_THISDIR_=$${dir}/";			\
	done

# Run make clean in all subdirs with a Makefile
clean distclean:
	@for dir in ${SUBDIR}; do					\
		${MAKE} -C $$dir "_THISDIR_=$${dir}/" $@;		\
	done
ifdef DEBOOTSTRAP_SOURCE_DIR
	rm -rf ${DEBOOTSTRAP_BUILD_DIR} ${DEBOOTSTRAP_INSTALL_DIR}
	rm -f ${DEBOOTSTRAP_RULE}
endif

ifdef DEBOOTSTRAP_SOURCE_DIR
# The dependency on debootstrap's Makefile is to help make determine whether or
# not the debootstrap build directory needs to be updated.
${DEBOOTSTRAP_RULE}: ${DEBOOTSTRAP_SOURCE_DIR}/Makefile
	-rm -r ${DEBOOTSTRAP_BUILD_DIR} 2> /dev/null
	cp -a ${DEBOOTSTRAP_SOURCE_DIR} ${DEBOOTSTRAP_BUILD_DIR}
	${MAKE} -C ${DEBOOTSTRAP_BUILD_DIR}
	${MAKE} -C ${DEBOOTSTRAP_BUILD_DIR} DESTDIR=${DEBOOTSTRAP_INSTALL_DIR} install
	touch $@
endif

endif	# ifndef OPTIONS_FILE_SOURCED

###############################################################################
# Install build files (mainly for Debian packaging)

install-pgi:
	install -m 755 -d $(DESTDIR)$(PGI_DIR)
	if ! head -1 debian/changelog | cut -d\( -f2 | cut -d\) -f1 > \
	$(DESTDIR)$(PGI_DIR)/pgi_version; then \
		echo "ERROR: unable to determine PGI version from debian/changelog!"; \
		exit 1; \
	fi

	cd doc && ${MAKE}
	install -m 755 -d $(DESTDIR)$(datadir)/doc/pgi
	install -m 644 README $(DESTDIR)$(datadir)/doc/pgi
	install -m 644 doc/guide.html $(DESTDIR)$(datadir)/doc/pgi
	install -m 644 doc/guide.txt $(DESTDIR)$(datadir)/doc/pgi
	install -m 644 doc/usermanual.html $(DESTDIR)$(datadir)/doc/pgi
	install -m 644 doc/usermanual.txt $(DESTDIR)$(datadir)/doc/pgi
	install -m 755 -d $(DESTDIR)$(mandir)/man1
	install -m 644 doc/pgi-build.1 $(DESTDIR)$(mandir)/man1
	install -m 755 -d $(DESTDIR)$(ETC_DIR)
	install -m 755 -d $(DESTDIR)$(bindir)
	install -m 755 -d $(DESTDIR)$(PGI_DIR)
	install -m 644 Makefile $(DESTDIR)$(PGI_DIR)
	install -d $(DESTDIR)$(ETC_DIR)
	install -m 644 options $(DESTDIR)$(ETC_DIR)
	install -m 755 pgi-build $(DESTDIR)$(bindir)
	install -m 644 busybox.h $(DESTDIR)$(PGI_DIR)/busybox.h
	install -m 755 busybox.mkll $(DESTDIR)$(PGI_DIR)/busybox.mkll
	install -m 755 busybox.sh $(DESTDIR)$(PGI_DIR)/busybox.sh

#	archive dir
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/potato
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/potato/alpha
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/potato/arm
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/potato/i386
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/potato/m68k
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/potato/powerpc
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/potato/sparc
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/slink
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/slink/alpha
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/slink/arm
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/slink/i386
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/slink/m68k
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/slink/powerpc
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/slink/sparc
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/sparc-etc
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/slink
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/potato
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/slink
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/woody
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/

	install -m 644 archive/Makefile $(DESTDIR)$(PGI_DIR)/archive/Makefile
	install -m 644 archive/debian-cd/Makefile $(DESTDIR)$(PGI_DIR)/archive/debian-cd/Makefile
	install -m 644 archive/debian-cd/README $(DESTDIR)$(PGI_DIR)/archive/debian-cd/README
	install -m 644 archive/debian-cd/README.devel $(DESTDIR)$(PGI_DIR)/archive/debian-cd/README.devel
	install -m 755 archive/debian-cd/build.sh $(DESTDIR)$(PGI_DIR)/archive/debian-cd/build.sh
	install -m 755 archive/debian-cd/build_all.sh $(DESTDIR)$(PGI_DIR)/archive/debian-cd/build_all.sh
	install -m 644 archive/debian-cd/changelog $(DESTDIR)$(PGI_DIR)/archive/debian-cd/changelog
	install -m 644 archive/debian-cd/copyright $(DESTDIR)$(PGI_DIR)/archive/debian-cd/copyright
	install -m 644 archive/debian-cd/tasks/Debian_potato $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/Debian_potato
	install -m 644 archive/debian-cd/tasks/Debian_sid $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/Debian_sid
	install -m 644 archive/debian-cd/tasks/Debian_woody $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/Debian_woody
	install -m 644 archive/debian-cd/tasks/README $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/README
	install -m 644 archive/debian-cd/tasks/base-woody $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/base-woody
	install -m 644 archive/debian-cd/tasks/empty $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/empty
	install -m 644 archive/debian-cd/tasks/exclude-potato $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/exclude-potato
	install -m 644 archive/debian-cd/tasks/exclude-src-potato $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/exclude-src-potato
	install -m 644 archive/debian-cd/tasks/forcd1 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/forcd1
	install -m 644 archive/debian-cd/tasks/interesting-fromcd23 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/interesting-fromcd23
	install -m 644 archive/debian-cd/tasks/interesting-redhat $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/interesting-redhat
	install -m 644 archive/debian-cd/tasks/interesting-tasks-potato $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/interesting-tasks-potato
	install -m 644 archive/debian-cd/tasks/kernel-related-potato $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/kernel-related-potato
	install -m 644 archive/debian-cd/tasks/linuxexpoamsterdam2001 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/linuxexpoamsterdam2001
	install -m 644 archive/debian-cd/tasks/linuxtag2000 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/linuxtag2000
	install -m 644 archive/debian-cd/tasks/popularity-contest $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/popularity-contest
	install -m 644 archive/debian-cd/tasks/popularity-contest-potato $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/popularity-contest-potato
	install -m 644 archive/debian-cd/tasks/popularity-contest-woody $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/popularity-contest-woody
	install -m 644 archive/debian-cd/tasks/task-woody $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/task-woody
	install -m 644 archive/debian-cd/tasks/unexclude-CD2-potato $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/unexclude-CD2-potato
	install -m 644 archive/debian-cd/tasks/xservers-XFree3 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tasks/xservers-XFree3
	install -m 755 archive/debian-cd/tools/add-bin-doc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/add-bin-doc
	install -m 755 archive/debian-cd/tools/add_dirs $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/add_dirs
	install -m 755 archive/debian-cd/tools/add_files $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/add_files
	install -m 755 archive/debian-cd/tools/add_packages $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/add_packages
	install -m 755 archive/debian-cd/tools/add_secured $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/add_secured
	install -m 755 archive/debian-cd/tools/apt-selection $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/apt-selection
	install -m 755 archive/debian-cd/tools/boot/potato/boot-alpha $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-alpha
	install -m 755 archive/debian-cd/tools/boot/potato/boot-arm $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-arm
	install -m 755 archive/debian-cd/tools/boot/potato/boot-i386 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-i386
	install -m 644 archive/debian-cd/tools/boot/potato/boot-i386.calc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-i386.calc
	install -m 755 archive/debian-cd/tools/boot/potato/boot-m68k $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-m68k
	install -m 644 archive/debian-cd/tools/boot/potato/boot-m68k.calc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-m68k.calc
	install -m 755 archive/debian-cd/tools/boot/potato/boot-powerpc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-powerpc
	install -m 644 archive/debian-cd/tools/boot/potato/boot-powerpc.calc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-powerpc.calc
	install -m 755 archive/debian-cd/tools/boot/potato/boot-sparc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-sparc
	install -m 644 archive/debian-cd/tools/boot/potato/boot-sparc.calc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/boot-sparc.calc
	install -m 755 archive/debian-cd/tools/boot/potato/post-boot-alpha $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/post-boot-alpha
	install -m 755 archive/debian-cd/tools/boot/potato/post-boot-powerpc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/post-boot-powerpc
	install -m 644 archive/debian-cd/tools/boot/potato/sparc-etc/boot-msg.txt $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/sparc-etc/boot-msg.txt
	install -m 644 archive/debian-cd/tools/boot/potato/sparc-etc/debian.txt $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/sparc-etc/debian.txt
	install -m 644 archive/debian-cd/tools/boot/potato/sparc-etc/silo.conf $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/potato/sparc-etc/silo.conf
	install -m 755 archive/debian-cd/tools/boot/woody/boot-alpha $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-alpha
	install -m 755 archive/debian-cd/tools/boot/woody/boot-arm $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-arm
	install -m 755 archive/debian-cd/tools/boot/woody/boot-hppa $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-hppa
	install -m 755 archive/debian-cd/tools/boot/woody/boot-i386 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-i386
	install -m 755 archive/debian-cd/tools/boot/woody/boot-ia64 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-ia64
	install -m 755 archive/debian-cd/tools/boot/woody/boot-m68k $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-m68k
	install -m 755 archive/debian-cd/tools/boot/woody/boot-powerpc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-powerpc
	install -m 755 archive/debian-cd/tools/boot/woody/boot-s390 $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-s390
	install -m 755 archive/debian-cd/tools/boot/woody/boot-sparc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/boot-sparc
	install -m 755 archive/debian-cd/tools/boot/woody/post-boot-alpha $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/post-boot-alpha
	install -m 755 archive/debian-cd/tools/boot/woody/post-boot-hppa $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/post-boot-hppa
	install -m 755 archive/debian-cd/tools/boot/woody/post-boot-powerpc $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/boot/woody/post-boot-powerpc
	install -m 755 archive/debian-cd/tools/cds2src $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/cds2src
	install -m 755 archive/debian-cd/tools/link.pl $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/link.pl
	install -m 755 archive/debian-cd/tools/list2cds $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/list2cds
	install -m 755 archive/debian-cd/tools/master2tasks $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/master2tasks
	install -m 755 archive/debian-cd/tools/mirror_check $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/mirror_check
	install -m 755 archive/debian-cd/tools/pi-makelist $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/pi-makelist
	install -m 755 archive/debian-cd/tools/potato/installtools.sh $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/potato/installtools.sh
	install -m 755 archive/debian-cd/tools/potato/upgrade.sh $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/potato/upgrade.sh
	install -m 755 archive/debian-cd/tools/scanpackages $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/scanpackages
	install -m 755 archive/debian-cd/tools/scansources $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/scansources
	install -m 755 archive/debian-cd/tools/set_mkisofs_opts $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/set_mkisofs_opts
	install -m 755 archive/debian-cd/tools/strip-nonUS-bin $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/strip-nonUS-bin
	install -m 755 archive/debian-cd/tools/woody/installtools.sh $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/woody/installtools.sh
	install -m 755 archive/debian-cd/tools/woody/upgrade.sh $(DESTDIR)$(PGI_DIR)/archive/debian-cd/tools/woody/upgrade.sh
	install -m 755 archive/debian-cd/update-cd $(DESTDIR)$(PGI_DIR)/archive/debian-cd/update-cd

#	debootstrap directory
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/debootstrap
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/debootstrap/debian
	install -m 644 debootstrap/slink $(DESTDIR)$(PGI_DIR)/debootstrap/slink
	install -m 644 debootstrap/pkgdetails.c $(DESTDIR)$(PGI_DIR)/debootstrap/pkgdetails.c
	install -m 644 debootstrap/Makefile $(DESTDIR)$(PGI_DIR)/debootstrap/Makefile
	install -m 644 debootstrap/potato $(DESTDIR)$(PGI_DIR)/debootstrap/potato
	install -m 755 debootstrap/debootstrap $(DESTDIR)$(PGI_DIR)/debootstrap/debootstrap
	install -m 644 debootstrap/debootstrap.8 $(DESTDIR)$(PGI_DIR)/debootstrap/debootstrap.8
	install -m 644 debootstrap/functions $(DESTDIR)$(PGI_DIR)/debootstrap/functions
	install -m 644 debootstrap/woody $(DESTDIR)$(PGI_DIR)/debootstrap/woody
	install -m 644 debootstrap/debian/dirs $(DESTDIR)$(PGI_DIR)/debootstrap/debian/dirs
	install -m 644 debootstrap/debian/README.Debian $(DESTDIR)$(PGI_DIR)/debootstrap/debian/README.Debian
	install -m 644 debootstrap/debian/copyright $(DESTDIR)$(PGI_DIR)/debootstrap/debian/copyright
	install -m 644 debootstrap/debian/control $(DESTDIR)$(PGI_DIR)/debootstrap/debian/control
	install -m 755 debootstrap/debian/rules $(DESTDIR)$(PGI_DIR)/debootstrap/debian/rules
	install -m 644 debootstrap/debian/changelog $(DESTDIR)$(PGI_DIR)/debootstrap/debian/changelog

#	images directory
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/images
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/images/i386
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/images/ia64
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/images/powerpc
	install -m 644 images/i386/Makefile $(DESTDIR)$(PGI_DIR)/images/i386
	install -m 644 images/i386/syslinux.cfg $(DESTDIR)$(PGI_DIR)/images/i386
	install -m 644 images/i386/syslinux.screen01.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen02.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen03.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen04.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen05.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen06.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen07.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen08.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen09.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/i386/syslinux.screen10.txt.in $(DESTDIR)$(ETC_DIR)
	install -m 644 images/ia64/Makefile $(DESTDIR)$(PGI_DIR)/images/ia64
	install -m 644 images/ia64/elilo.conf $(DESTDIR)$(PGI_DIR)/images/ia64
	install -m 644 images/powerpc/Makefile $(DESTDIR)$(PGI_DIR)/images/powerpc
	install -m 644 images/powerpc/hfs.map $(DESTDIR)$(PGI_DIR)/images/powerpc
	install -m 644 images/powerpc/ofboot.b $(DESTDIR)$(PGI_DIR)/images/powerpc
	install -m 644 images/powerpc/yaboot.conf $(DESTDIR)$(PGI_DIR)/images/powerpc

#	stage0 directory
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/stage0
	install -m 644 stage0/Makefile $(DESTDIR)$(PGI_DIR)/stage0
	install -m 644 stage0/configure-network $(DESTDIR)$(PGI_DIR)/stage0
	install -m 644 stage0/envsh $(DESTDIR)$(PGI_DIR)/stage0
	install -m 644 stage0/initrd-reboot.c $(DESTDIR)$(PGI_DIR)/stage0
	install -m 644 stage0/stage0.sh $(DESTDIR)$(PGI_DIR)/stage0
	install -m 644 stage0/linuxrc.system $(DESTDIR)$(PGI_DIR)/stage0
	install -m 755 stage0/mkinitrd $(DESTDIR)$(PGI_DIR)/stage0

#	stage1 directory
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/Makefile $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/stage1.sh $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/arrow.xpm $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/check.xpm $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/count-packages $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/internal.extra_packages $(DESTDIR)/$(PGI_DIR)/stage1
	install -m 644 stage1/extra_packages $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/preinst.sh $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/postinst.sh $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/shellspawn.c $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/installer-druid $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/installer.glade.in $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/xinitrc $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/list-devices.py $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/logoicon.xpm $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/package_list $(DESTDIR)$(ETC_DIR)/package_list
	install -m 644 stage1/sources.list.dist $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/installer-x.sh $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/installer-text.sh $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/syslog-install.conf $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/theme.jl $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/Makefile $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/XF86Config.template $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/installer-tasks.txt $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/internal.devices.list $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/internal.dirs.list $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/internal.files.list $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/live.devices.list $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/live.dirs.list $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/live.files.list $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/pgilogs2disk $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/root_window.png $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/root_window.xbm $(DESTDIR)$(ETC_DIR)
	install -m 644 stage1/setup-base-text.py $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/setup-bootloader-text.py $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/setup-finalize-text.py $(DESTDIR)$(PGI_DIR)/stage1
	install -m 644 stage1/get-message.py $(DESTDIR)$(PGI_DIR)/stage1

	if [ -d stage1/$(ARCH) ]; then \
	  install -m 755 -d $(DESTDIR)$(PGI_DIR)/stage1/$(ARCH) ; \
	  install -m 644 stage1/$(ARCH)/*.list $(DESTDIR)$(PGI_DIR)/stage1/$(ARCH) ; \
	  install -m 644 stage1/$(ARCH)/extra_packages $(DESTDIR)$(PGI_DIR)/stage1/$(ARCH) ; \
	fi

#	python directory
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/__init__.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/auto_partition_base.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/auto_partition-i386.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/auto_partition-ia64.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/auto_partition-powerpc.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/base.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/bootloader-i386.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/bootloader-ia64.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/bootloader-powerpc.py $(DESTDIR)$(PGI_DIR)/python/pgi
	install -m 644 python/pgi/common.py $(DESTDIR)$(PGI_DIR)/python/pgi

#	tools directory
	install -m 755 -d $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/README $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/so-deps.sh $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/detectmodules.sh $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/mklibs.bash $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/mklibs.py $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/modtofile.sh $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/packagetofile.sh $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/pgi-calc-deps.py $(DESTDIR)$(PGI_DIR)/tools
	install -m 644 tools/reducemodules.py $(DESTDIR)$(PGI_DIR)/tools

#	examples
	cp -a $(DESTDIR)$(ETC_DIR) $(DESTDIR)/etc/pgi/base-config
	install -m 755 examples/base-config/S99unconfigured $(DESTDIR)/etc/pgi/base-config
	install -m 644 examples/base-config/live.files.list $(DESTDIR)/etc/pgi/base-config
	install -m 644 examples/base-config/postinst.sh $(DESTDIR)/etc/pgi/base-config

	cp -a $(DESTDIR)$(ETC_DIR) $(DESTDIR)/etc/pgi/configlets
	install -m 644 examples/configlets/fvwm2rc $(DESTDIR)/etc/pgi/configlets
	install -m 755 examples/configlets/S99unconfigured $(DESTDIR)/etc/pgi/configlets
	install -m 755 examples/configlets/xinitrc $(DESTDIR)/etc/pgi/configlets
	install -m 644 examples/configlets/extra_packages $(DESTDIR)/etc/pgi/configlets
	install -m 644 examples/configlets/live.files.list $(DESTDIR)/etc/pgi/configlets
	install -m 644 examples/configlets/postinst.sh $(DESTDIR)/etc/pgi/configlets
	install -m 755 examples/configlets/do-apt-cdrom $(DESTDIR)/etc/pgi/configlets
	install -m 755 -d $(DESTDIR)/etc/pgi/configlets/user
	install -m 644 user-configlet/main.glade $(DESTDIR)/etc/pgi/configlets/user
	install -m 644 user-configlet/main.py $(DESTDIR)/etc/pgi/configlets/user
	install -m 644 user-configlet/user.xpm $(DESTDIR)/etc/pgi/configlets/user

.PHONY: all _all_recursive clean distclean install-pgi

# vim:set ai noet sw=8 sts=8 ts=8 tw=0:
