#! /usr/bin/make -f
# -*- makefile -*-
# Build rules for gcc (>= 2.95) and gcc-snapshot
# Targets found in this makefile:
#	- unpack tarballs
#	- patch sources
#	- (re)create the control file
#	- create a debian/rules.parameters file, which is included
#	  by debian/rules2
# All other targets are passed to the debian/rules2 file

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=2

default: build

include debian/rules.defs
#include debian/rules.unpack
#include debian/rules.patch

unpack: $(unpack_stamps)
$(unpack_stamp)-%:
	$(MAKE) -f debian/rules2 TARGET=$* $@

patch: unpack $(patch_stamps)
$(patch_stamp)-%:
	$(MAKE) -f debian/rules2 TARGET=$* $@

control: patch $(control_stamp)
$(control_stamp):
	-mkdir $(stampdir)
	$(MAKE) -f debian/rules.conf control
	touch $(control_stamp)

control-file:
	$(MAKE) -f debian/rules.conf $@

configure: control $(configure_stamps)
$(configure_stamp)-%:
	$(MAKE) -f debian/rules2  TARGET=$* $@

build: configure $(build_stamps)
$(build_stamp)-%:
	$(MAKE) -f debian/rules2 TARGET=$* $@

check:
	$(MAKE) -f debian/rules2 TARGET=native $@

clean:
	rm -rf $(stampdir)
	-$(MAKE) -f debian/rules2 $@
	rm -rf $(srcdir) $(builddir)*
	rm -rf src src-* build build-*
	rm -f bootstrap-* first-move-stamp
	rm -f debian/*.tmp debian/rules2.hack
	dh_clean

mail-summary:
	$(MAKE) -f debian/rules2 $@

install: build $(install_stamps)
$(install_stamp)-%:
	$(MAKE) -f debian/rules2 TARGET=$* $@

binary-indep: install $(binary_stamps)
	$(MAKE) -f debian/rules2 TARGET=$* $@

binary-arch: install binary-arch-hack $(binary_stamps)
	$(MAKE) -f debian/rules2 TARGET=$* $@

binary-arch-hack:
	echo 'binary_hack = arch' > debian/rules2.hack
binary-indep-hack:
	echo 'binary_hack = indep' > debian/rules2.hack

binary: install $(binary_stamps)
$(binary_stamp)-%:
	$(MAKE) -f debian/rules2 TARGET=$* $@

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

.PHONY: build clean binary-indep binary-arch binary
