1#!/bin/sh
2
3# Test case for bug https://gitlab.freedesktop.org/xorg/util/makedepend/issues/1
4
5set -e
6
7if [ "x$test_srcdir" = "x" ]; then
8    test_srcdir=..
9fi
10
11if [ "x$test_builddir" = "x" ]; then
12    test_builddir=..
13fi
14
15if [ "x$MAKEDEPEND" = "x" ]; then
16    MAKEDEPEND=makedepend
17fi
18
19mkdir -p ${test_builddir}/1
20cd ${test_builddir}/1
21
22pwd
23
24# Create test conditions:
25#  - directory named "one" containing file one.cpp which includes def.h in the same directory
26#  - directory named "two" containing file two.cpp which includes def.h in the same directory
27mkdir -p one two
28
29# 2 headers with the same name but in different directories
30touch one/def.h two/def.h
31cp ${test_srcdir}/1/one.cpp one/
32cp ${test_srcdir}/1/two.cpp two/
33
34# two/two.cpp depends on two/def.h (not the one seen during exploration in previous directory)
35$MAKEDEPEND -f- -I. one/one.cpp two/two.cpp | grep "two/two.o: one/def.h" && false
36
37
38# Clean up
39rm -rf one two
40