VPATH		= @srcdir@
srcdir		= @srcdir@
top_srcdir	= @top_srcdir@

VERSION		= $(shell cat version-nr)

GENFILES	= version.h

include Makefile.conf

SUBDIRS		= include optlib lib intl dpkg-deb split scripts utils main \
		  utils @DSELECTDIR@ po methods doc

all: version.h all-recursive

install: all install-recursive
	$(mkinstalldirs) $(DESTDIR)$(dpkgconfdir)/origins
	$(INSTALL_DATA) $(srcdir)/origin $(DESTDIR)$(dpkgconfdir)/origins/debian

clean: clean-recursive
	rm -f $(GENFILES)

distclean: clean distclean-recursive
	rm -f Makefile.conf Makefile config.cache config.h config.log config.status
	rm -f automake/gettext.m4 automake/progtest.m4 automake/lcmessage.m4

version.h: version-nr
	echo "#define DPKG_VERSION \"$(VERSION)\" /* This line modified by Makefile */" > version.h

all-recursive install-recursive clean-recursive distclean-recursive:
	set -e ; target=`echo $@ | sed s/-recursive//`; \
	    for d in $(SUBDIRS) ; do \
	    $(MAKE) $(MFLAGS) -C $$d $$target ; \
	done;

.PHONY: all install clean distclean 
.PHONY: all-recursive install-recursive clean-recursive distclean-recursive
