makefile – Why does make think the target is up to date?

makefile – Why does make think the target is up to date?

Maybe you have a file/directory named test in the directory. If this directory exists, and has no dependencies that are more recent, then this target is not rebuild.

n

To force rebuild on these kind of not-file-related targets, you should make them phony as follows:

n

.PHONY: all test cleann

n

Note that you can declare all of your phony targets there.

n

A phony target is one that is not really the name of a file; rather it is just a name for a recipe to be executed when you make an explicit request.

EDIT: This only applies to some versions of make – you should check your man page.

n

You can also pass the -B flag to make. As per the man page, this does:

n

n

-B, --always-make Unconditionally make all targets.

n

n

So make -B test would solve your problem if you were in a situation where you dont want to edit the Makefile or change the name of your test folder.

makefile – Why does make think the target is up to date?

It happens when you have a file with the same name as Makefile target name in the directory where the Makefile is present.

n

enter

Leave a Reply

Your email address will not be published.