xref: /freebsd/sys/contrib/device-tree/scripts/basic/fixdep (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1 *c66ec88fSEmmanuel Vadot#!/bin/sh
2 *c66ec88fSEmmanuel Vadot
3 *c66ec88fSEmmanuel Vadot# Simplfied version of Linux scripts/basic/fixdep. We don't need
4 *c66ec88fSEmmanuel Vadot# CONFIG tracking etc for this usecase.
5 *c66ec88fSEmmanuel Vadot
6 *c66ec88fSEmmanuel Vadot
7 *c66ec88fSEmmanuel Vadot# Fixdep's interface is described:
8 *c66ec88fSEmmanuel Vadot
9 *c66ec88fSEmmanuel Vadot# It is invoked as
10 *c66ec88fSEmmanuel Vadot#
11 *c66ec88fSEmmanuel Vadot#   fixdep <depfile> <target> <cmdline>
12 *c66ec88fSEmmanuel Vadot#
13 *c66ec88fSEmmanuel Vadot# and will read the dependency file <depfile>
14 *c66ec88fSEmmanuel Vadot#
15 *c66ec88fSEmmanuel Vadot# The transformed dependency snipped is written to stdout.
16 *c66ec88fSEmmanuel Vadot#
17 *c66ec88fSEmmanuel Vadot# It first generates a line
18 *c66ec88fSEmmanuel Vadot#
19 *c66ec88fSEmmanuel Vadot#   cmd_<target> = <cmdline>
20 *c66ec88fSEmmanuel Vadot#
21 *c66ec88fSEmmanuel Vadot# and then basically copies the .<target>.d file to stdout, in the
22 *c66ec88fSEmmanuel Vadot# process filtering out the dependency on autoconf.h and adding
23 *c66ec88fSEmmanuel Vadot# dependencies on include/config/my/option.h for every
24 *c66ec88fSEmmanuel Vadot# CONFIG_MY_OPTION encountered in any of the prequisites.
25 *c66ec88fSEmmanuel Vadot
26 *c66ec88fSEmmanuel Vadotecho cmd_$2 = $3
27 *c66ec88fSEmmanuel Vadotcat $1
28