#!/usr/bin/make -f

export CFLAGS = $(shell dpkg-buildflags --get CFLAGS)

export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) \
	-D_FILE_OFFSET_BITS=64 \
	-UBUG_STAT_MISSING \

export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)

# build* targets
# ==============

.PHONY: build build-arch build-indep
build build-arch: build-stamp
build-stamp: debian/control
	gcc -shared -fPIC -O2 -Wall -Wextra -o no-afalg.so no-afalg.c -ldl
	touch $(@)

build-indep: ;

# binary* targets
# ===============

.PHONY: binary binary-arch binary-indep
binary binary-arch: build-stamp
	dh_testroot
	dh_prep
	dh_install
	dh_installdocs
	dh_installchangelogs
	dh_installexamples
	dh_installman
	dh_compress
	dh_fixperms
	dh_strip
	dh_shlibdeps
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep: ;

# clean target
# ============

.PHONY: clean
clean: debian/control
	rm -f no-afalg.so
	dh_clean
# vim:ts=4 sw=4
