Project

General

Profile

Actions

Bug #11949

closed

make -C caches wrong directory contents

Added by Andy Fiddaman over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

make -C does a chdir() call to the target directory but this is currently done too late, after the contents of the working directory (.) is cached, and after any local make.rules file is read.

Here's a basic example, from the root of the illumos-gate checkout:

% /usr/bin/make -C usr/src/tools/env
make: Fatal error: No arguments to build
Current working directory /data/omnios-build/omniosorg/bloody/illumos/usr/src/tools/env

% touch Makefile illumos.sh

% /usr/bin/make -C usr/src/tools/env
/usr/bin/rm -f illumos
cat illumos.sh > illumos
chmod +x illumos

I wrote a set of tests to check the behaviour of -C both on the command line and in MAKEFLAGS, along with assorted makefiles and make.rules files and they almost all fail:

FAIL make -C a/ from empty directory
PASS make -C a/ from non-empty directory
FAIL makeflags -C a/ from empty directory
PASS makeflags -C a/ from non-empty directory
FAIL make -C a/a from empty directory
FAIL make -C a/a from non-empty directory
FAIL makeflags -C a/a from empty directory
FAIL makeflags -C a/a from non-empty directory
FAIL make -C a/b from empty directory
FAIL make -C a/b from non-empty directory
FAIL makeflags -C a/b from empty directory
FAIL makeflags -C a/b from non-empty directory
FAIL make -C a/c from empty directory
FAIL make -C a/c from non-empty directory
FAIL makeflags -C a/c from empty directory
FAIL makeflags -C a/c from non-empty directory
FAIL make -C -C from empty directory
FAIL make -C -C from non-empty directory
FAIL makeflags -C -C from empty directory
FAIL makeflags -C -C from non-empty directory
FAIL make -C -C relative from empty directory

Related issues

Related to illumos gate - Feature #10891: dmake could support -CClosedRobert Mustacchi

Actions
Actions

Also available in: Atom PDF