#!/usr/bin/make -f

SH=/bin/bash
PERL=/usr/bin/perl -w

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    MAKEFLAGS += -j$(NUMJOBS)
endif

%:
	dh $@

override_dh_auto_build:
	cd debian && \
	./makestatus.py && \
	./makequeue.py

override_dh_install:
	@echo "Installing files into the build directory..."
	cd debian && NUMJOBS="$(NUMJOBS)" $(SH) distribute.sh
	dh_install -i
	dh_missing -i --fail-missing
	@echo "Creating symlinks in the usr/share/doc/RFC/links..."
	cd debian && $(PERL) create-links.pl
