#!/bin/sh

#	$NetBSD: amdgpu2netbsd,v 1.1 2018/08/27 14:02:32 riastradh Exp $
#
# $ /path/to/amdgpu2netbsd > /path/to/files.amdgpu.new
#
# Run from the top-level amd/amdgpu source directory.

set -Ceu

# Location of the amdgpu sources relative to $NETBSDSRCDIR.
amdgpu_top=external/bsd/drm2/dist/drm/amd/amdgpu

# config(5) flag for the amdgpu driver.
amdgpu_flag=amdgpu

env CONFIG_ACPI=y \
env src=. \
make -f Makefile -V '$(amdgpu-y)' \
| tr ' ' '\n' \
| grep -v '^$' \
| sed -e 's,\.o$,.c,' \
| sort -u \
| while read f; do
	printf 'file\t%s\t%s\n' "$amdgpu_top/$f" "$amdgpu_flag"
done
