Vaibhav Bajpai
Vaibhav Bajpai

Reputation: 16814

make doesn't see changes?

Scenario 1:

I checked out a project, and made some changes to a source file, and did make, and make sees the changes.

Scenario 2:

I checked out the project again to different directory (some reasons), copied the modified source file here, and did make and nothing happens, if I run the program, I don't see my changes, make doesn't see that I made change to this source file

Upvotes: 3

Views: 3669

Answers (5)

Karmavil
Karmavil

Reputation: 993

Make sure you have your .PHONY tags and they are correct

Upvotes: 0

ctrl-alt-delor
ctrl-alt-delor

Reputation: 7745

If you used cp to copy files options -a --archive -p --preserve will preserve the timestamp. That is not what you want!

Add option --no-preserve=timestamps

cp [options] --no-preserve=timestamps .....

Upvotes: 0

codaddict
codaddict

Reputation: 455440

Adding to existing answers:

To touch the targets, you can use the -t or --touch option of make. This option will not make the target but just touch it so that the next time you invoke make, the target will be made.

Alternatively you can use the -B or --always-make option which will unconditionally make the target irrespective of the modification of it's dependent(s).

Upvotes: 2

Adrian Smith
Adrian Smith

Reputation: 17593

make uses the timestamps of the files to determine what to build.

Perhaps your version-control system is checking all files out with the current time. When you copy your source over, it has a time in the past, making make think that the object file (presumably in your checkout) is newer than your source.

If that's the case, you can use touch to set the timestamp of a file to now.

Upvotes: 4

Vaibhav Bajpai
Vaibhav Bajpai

Reputation: 16814

okay, I just touched the copied (modified) source and now make recognizes the changes.

Upvotes: 0

Related Questions