TrampolineTales
TrampolineTales

Reputation: 826

Make won't recognize that files are being modified

I'm attempting to run an echo command in a Makefile when my .cpp files are modified.

Makefile:

src/*.cpp:
   echo 'file has changed'

Command line:

$ mingw32-make.exe
mingw32-make: 'src/main.cpp' is up to date.

I'm confused as to why this says main.cpp is up to date, even after I modify it. Shouldn't it output file has changed?

Version info:

$ mingw32-make.exe --version
GNU Make 4.1
Built for i686-w64-mingw32

Upvotes: 0

Views: 92

Answers (1)

mkcms
mkcms

Reputation: 262

You can have a target that depends on your *.cpp files:

cpp_files_are_up_to_date: src/*.cpp
    echo 'files have changed'
    echo.>cpp_files_are_up_to_date 

Upvotes: 3

Related Questions