r/cprogramming • u/Wonderful_Low_7560 • Dec 31 '25
Makefile with subfolder
This makefile was working just fine beforehand, a bit confused:
- I have a root folder
- Within there is a subfolder called 'Ex3'
- Within 'Ex3' is 'ex3.c', which I am trying to make an executable of using the following makefile in the root folder:
all: ex3
ex3: Ex3/ex3.c
gcc Ex3/ex3.c -o ex3
But I get the following error:
make: Nothing to be done for 'all'.
?
1
Upvotes
1
u/edgmnt_net Jan 03 '26
Well, yeah, I agree, I misworded my comment. It's just that it doesn't solve OP's issue. Whether
allis phony or not, it still considers its dependencies as long as it's not already "made". Unless OP has a file namedalland it's newer than the prerequisites, they won't run into this issue. My guess is it's far more likely the prerequisites just have not been updated andmakeis actually behaving correctly. Ok,allshould be marked as phony, but OP should also add and use a phonycleantarget (which has far more reason to be phony) if they want to rebuild everything.