bug_cp_xliterate.t (1791B)
1 # 2 # Using CP_OBJ and .xliterate special target on the same file results 3 # in make depending on the CP_OBJ file in obj/ instead of the one in 4 # the source directory. 5 # 6 # I don't know how to easily fix this at the moment. 7 # 8 use Modern::Perl; 9 use Test::Cmd; 10 use Test::File; 11 use Test::More tests => 14; 12 13 14 my $cmd = Test::Cmd->new( prog => '/usr/bin/make', workdir => '' ); 15 my $html_mk = $cmd->here . '/bsd.html.mk'; 16 17 $cmd->write( 'site.mk', <<EOF ); 18 EOF 19 20 $cmd->write( 'index.in', '#include "file.xliterate"' ); 21 $cmd->write( 'file.txt', 'some file contents' ); 22 23 $cmd->subdir( 'destdir' ); 24 $cmd->write( 'Makefile', <<EOF ); 25 BSDSRCDIR = /tmp 26 BSDOBJDIR = destdir 27 28 CP_OBJ = file.txt 29 30 .include "$html_mk" 31 EOF 32 33 # Create obj/ directory. 34 $cmd->run( args => 'obj', chdir => $cmd->curdir ); 35 is( $? >> 8, 0, 'make obj exit status' ); 36 37 # Create dependencies 38 $cmd->run( args => 'depend', chdir => $cmd->curdir ); 39 is( $? >> 8, 0, 'make depend exit status' ); 40 41 my $o = "cpp .* 42 cp .*/file.txt .*/obj/file.txt"; 43 44 $cmd->run( chdir => $cmd->curdir ); 45 like( $cmd->stdout, qr{$o}, 'make stdout' ); 46 is( $cmd->stderr, '', 'make stderr' ); 47 is( $? >> 8, 0, 'make exit status' ); 48 49 file_exists_ok( $cmd->workdir . "/file.txt" ); 50 file_exists_ok( $cmd->workdir . "/obj/file.txt" ); 51 file_contains_like( $cmd->workdir . '/obj/index.html', qr{some file contents} ); 52 53 # 54 # BUG: Another `make' is not supposed to do anything, but further 55 # processing happens. 56 # 57 $o = "sed .*"; 58 59 $cmd->run( chdir => $cmd->curdir ); 60 like( $cmd->stdout, qr{$o}, 'make stdout' ); 61 is( $cmd->stderr, '', 'make stderr' ); 62 is( $? >> 8, 0, 'make exit status' ); 63 64 65 # A third `make' does nothing. 66 $cmd->run( chdir => $cmd->curdir ); 67 is( $cmd->stdout, '', 'make stdout' ); 68 is( $cmd->stderr, '', 'make stderr' ); 69 is( $? >> 8, 0, 'make exit status' );