gui: Add trailing newline to all log messages.
[paraslash.git] / depend.sh
1 #!/bin/sh
2
3 # Call gcc to output a rule suitable for make describing the dependencies of
4 # the given input file and parse the output to add a *.d target with the same
5 # dependencies.
6
7 # The first three arguments to that script are special: $1 is the
8 # dependency directory and $2 is the object directory. These are used
9 # to prefix the .d and .o targets respectively. $3 is the directory
10 # that contains the *.cmdline.h files generated by gengetopt.
11
12 # As gcc outputs the dependencies on the *.cmdline.h files either as
13 # foo.cmdline.h or as $cmdline_dir/foo.cmdline.h, depending on whether the
14 # latter file exists, we prefix the former with $2/
15
16 dep_dir="$1"
17 object_dir="$2"
18 cmdline_dir="$3"
19 shift
20 shift
21 shift
22
23 LC_ALL=C gcc -MM -MG "$@" \
24 | sed -e "s@^\(.*\)\.o:@$dep_dir/\1.d $object_dir/\1.o:@" \
25 -e "s@[ ^]\([a-zA-Z0-9_]\{1,\}\.cmdline.h\)@ $cmdline_dir/\1@g"