#!/usr/bin/make -f

CCFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)

binary-arch:
	dh_testdir
	dh_testroot
	dh_installdocs -s
	dh_installman -s
	dh_installchangelogs -s CHANGELOG
	dh_install -s
	chmod -R 755 debian/vlan/etc/network
	dh_strip -s
	dh_fixperms -s
	dh_compress -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_installdeb -s
	dh_md5sums -s
	dh_builddeb -s

build:
	# upstream ships a macvlan_config binary
	#mv -f macvlan_config macvlan_config.orig
	# STRIP is to avoid the upstream stripping
	$(MAKE) CCFLAGS="$(CCFLAGS)" STRIP=true

clean:
	# restore macvlan_config binary shipped by upstream
	#-mv -f macvlan_config.orig macvlan_config
	dh_clean
	rm -f vconfig.h vconfig.o vconfig

binary-indep:

binary: binary-arch binary-indep

.PHONY: binary binary-arch binary-indep clean
