#!/usr/bin/make -f
# -*- makefile -*-

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

include /usr/share/dpkg/pkg-info.mk

CFLAGS=$(shell dpkg-buildflags --get CFLAGS) -no-pie
CXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS) -no-pie

%:
	dh $@ --buildsystem=cmake --parallel --with python2

override_dh_auto_configure:
	dh_auto_configure -- -DREVISION_LAST=$(DEB_VERSION_UPSTREAM) -DREVISION=$(DEB_VERSION_UPSTREAM) -DLLVM_DEFINITIONS="-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" -DBCC_KERNEL_HAS_SOURCE_DIR=1


override_dh_auto_install:
	dh_auto_install
	for eachFile in $(CURDIR)/debian/tmp/usr/share/bcc/tools/* ; do \
	    mv $$eachFile $$eachFile-bpfcc ; \
	done

	for eachMan in $(CURDIR)/debian/tmp/usr/share/bcc/man/man8/* ; do \
	    manPage=`basename $$eachMan | cut -d "." -f1`; \
	    mv $$eachMan $(CURDIR)/debian/tmp/usr/share/bcc/man/man8/$$manPage-bpfcc.8 ; \
	done


override_dh_auto_test:
	@# We can't really run root privilege tests in build env
	# do not run tests
