Skip to content

recursive $(MAKE) doesn't find right Makefile #38

@rjleveque

Description

@rjleveque

I've got a directory with a file setrun_restart.py but no setrun.py and Makefile_restart sets SETRUN_FILE=setrun_restart.py

I modified the Makefile.common to print out what setrun file it's using...

----------------------------------------------------------------------------

Make data files needed by Fortran code:

.data: $(SETRUN_FILE) $(MAKEFILE_LIST) ;
@echo Using setrun from $(SETRUN_FILE)
$(MAKE) data

data: $(MAKEFILE_LIST);
-rm -f .data
@echo Using setrun from $(SETRUN_FILE)
$(CLAW_PYTHON) $(SETRUN_FILE) $(CLAW_PKG)
touch .data

----------------------------------------------------------------------------

It works as expected if I do
$ make data -f Makefile_restart

but here's what happens if I "make .data..."

$ make .data -f Makefile_restart
Using setrun from setrun_restart.py
make data
rm -f .data
Using setrun from setrun.py
python setrun.py amrclaw
python: can't open file 'setrun.py': [Errno 2] No such file or directory

The $(MAKE) data command is to blame -- it's not using the right version of the Makefile for this recursive call. (I also have a Makefile in the directory and if I remove that then it says it doesn't know how to make data at all.)

My GNU Make book doesn't tell how to fix this. It says there's a variable $(MAKEFLAGS) that should be passed but say that this does not contain the -f flag in particular.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions