#!/usr/bin/make -f

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) $(CPPFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

%:
	dh $@

override_dh_auto_build:
	mkdir build-glibc
	$(MAKE) -f $(CURDIR)/GNUmakefile -C build-glibc SRC=$(CURDIR)/ DIET='' SHARED=1 libowfat.so
	$(MAKE) -f $(CURDIR)/GNUmakefile -C build-glibc SRC=$(CURDIR)/ clean
	$(MAKE) -f $(CURDIR)/GNUmakefile -C build-glibc SRC=$(CURDIR)/ DIET=''

	mkdir build-diet
	$(MAKE) -f $(CURDIR)/GNUmakefile -C build-diet SRC=$(CURDIR)/ DIET='diet -v -Os'
	touch build-stamp

override_dh_clean:
	dh_clean # doesn't remove directories
	-rm -rf build-glibc build-diet

override_dh_installchangelogs:
	dh_installchangelogs CHANGES

# empty targets:
override_dh_auto_install:
