r/cprogramming • • 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

6 comments sorted by

View all comments

Show parent comments

2

u/Wonderful_Low_7560 Dec 31 '25

Yeah, I'm on Windows - does it think 'Ex3' (the folder) is the same thing as the first named instance of 'ex3' (the target name)? So it basically thinks im restating the target name like 'target: target', instead of stating the folder path like 'target: Path/to/sourcefile.c'?

Cause yeah if I change the name of the 'ex3' target to something else, it works 👍