#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

%:
	dh $@ --with apache2

override_dh_auto_configure:
	cd wims/src; autoreconf && ./configure --without-units --without-chemeq --without-wimsd CFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" CPPFLAGS="-D_FORTIFY_SOURCE=2" CXXFLAGS="-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" FFLAGS="-g -O2" LDFLAGS="-Wl,-z,relro"


DESTDIR=$(CURDIR)/debian/tmp

override_dh_auto_install:
	# for some reason, dh_installdirs does not work as expected !
	mkdir -p $(DESTDIR)
	for d in $$(cat debian/*.dirs); do \
	  if echo $$d | grep -q "#"; then \
	    true; \
	  else \
	    mkdir -p $(DESTDIR)/$$d; \
	  fi; \
	done
	$(MAKE) install DESTDIR=$(DESTDIR)
