0

I have following files-

maze: maze.c
    gcc -o maze createMaze.c findcheese_iter.c maze.c -I.

Even after making changes to createMaze.c when I try running make command in the terminal,it says make: 'maze' is up to date. As a result I am not getting the correct answer.When I run the same code by this way it runs-

gcc createMaze.c maze.c  findcheese_iter.c -o exe

2 Answers2

1

change your makefile to the following:

maze: maze.c createMaze.c findcheese_iter.c
    gcc -o maze createMaze.c findcheese_iter.c maze.c -I.

make will just compile, when the targets right behind the doublepoint changes...

seeppp
  • 300
  • 3
  • 10
0

As far as I can tell, your problem is that you have set the dependencies for maze to be only maze.c and when you update createMaze.c you are not updating any of the dependencies.

You should add all the files the output-binary actually depends on, to the depend list.

E.g.:

maze: createMaze.c findcheese_iter.c maze.c
    gcc -o maze createMaze.c findcheese_iter.c maze.c -I.
Morten Jensen
  • 5,818
  • 3
  • 43
  • 55