Reputation: 213
I have made a makefile for some c files. I have seen too many ways on the internet but i had always the same problem: Running make, I am told:
make: `q_a' is up to date.
My Makefile
contains:
q_a:
gcc -o q_a quick_sort_i.c
q_g:
gcc -o q_g quick_sort_g.c
s_a:
gcc -o s_a shell_sort_i.c
s_g:
gcc -o s_g shell_sort_g.c
fork:
gcc -o fork fork.c
I don't have files with the same name as the target in my folder, and I can perform the compilation commands successfully them when I enter them manually in a terminal.
Upvotes: 6
Views: 10498
Reputation: 1
is not actually an error; it indicates that the target mpi_wavefront has already been built and there are no changes that require rebuilding the target. Essentially, make believes that the compiled output is up to date with respect to the source file mpi_wavefront.cpp.
make clean make mpi_wavefront
Upvotes: 0
Reputation: 5796
You have not specified dependencies for your targets.
What make does, is first checking if your target (q_a
) exists as a file, and if it does, if its dependencies are newer (as in, have more recent modification time) as your target. Only if it needs to be updated (it does not exist or dependencies are newer) the rule is executed.
That means, if you need q_a
to be recompiled every time quick_sort_i.c
is changed, you need to add it as a dependency to q_a
, like this:
q_a: quick_sort_i.c
gcc -o q_a quick_sort_i.c
With that, make will recompile q_a
if necessary.
Upvotes: 13