#!/bin/sh

# Copyright © 2009-2015 Jakub Wilk <jwilk@jwilk.net>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.

make paths.hh $(ls *.xml | sed -e 's/[.]xml/.hh/') || exit 1
: "${CXX:=g++}"
"$CXX" -MM *.cc \
| while read line
do
  target=$(printf '%s' "$line" | cut -d: -f1)
  deps=$(printf '%s' "$line" | cut -d: -f2 | tr ' ' '\n' | sort)
  for dep in $deps
  do
    echo "$target: $dep"
  done
done \
| sort > Makefile.dep

# vim:ts=2 sts=2 sw=2 et
