Debian Codegraph @

tests/scripts/options/dash-C

raw
1 # -*-perl-*-
2
3 $description = "Test the -C option to GNU Make.";
4
5 use File::Spec;
6
7 # Pre-set $makefile to be in a subdirectory
8 $makefile = 'Makefile';
9
10 my $_srcdir = 'src';
11 mkdir($_srcdir, 0775);
12
13 my $_incdir = 'inc';
14 mkdir($_incdir, 0775);
15
16 my $_mkpath = File::Spec->catfile($_srcdir, $makefile);
17 create_file($_mkpath, "include \$(file)\nall: ;\n");
18
19 # TEST #1
20 # -------
21 run_make_test('', "-C $_srcdir --no-print-directory",
22 "#MAKE#: 'all' is up to date.");
23
24 # TEST #2
25 # -------
26 # Do it again with trailing "/"; this should work the same
27
28 run_make_test(undef, "-C $_srcdir/ --no-print-directory",
29 "#MAKE#: 'all' is up to date.");
30
31 # Test stringing together multiple -C options
32
33 run_make_test(undef, "-C $_incdir -C .. -C $_srcdir --no-print-directory",
34 "#MAKE#: 'all' is up to date.");
35
36 # SV 63552 - Ensure -I is considered after -C
37
38 my $_incfile = 'test';
39 my $_incpath = File::Spec->catfile($_incdir, $_incfile);
40 create_file($_incpath, '$(info included)');
41
42 my $_incopt = File::Spec->catfile('..', $_incdir);
43
44 run_make_test(undef, "-C src -I $_incopt --no-print-directory file=$_incfile",
45 "included\n#MAKE#: 'all' is up to date.");
46
47 unlink($_incpath);
48 rmdir($_incdir);
49
50 unlink($_mkpath);
51 rmdir($_srcdir);
52 1;