I had created a Makefile for my project. my project file hierarchy is like this:
- a source folder with main.c and Makefile in it
- and a top level Makefile
here is the Makefile in src folder
all: program
program: main.c
gcc -o program main.c
clean:
rm program
and here is top level Makefile:
all:
cd src && $(MAKE) all
clean:
cd src && $(MAKE) clean
program:
cd src && $(MAKE) program
It is working fine but when i change top level Majefile to this:
all:
cd src && $(MAKE) all
clean:
cd src
$(MAKE) clean
program:
cd src && $(MAKE) program
and run for example make clean, the output is this:
cd src
make clean
make[1]: Entering directory `<Project Directory>'
cd src
make clean
it shows this in a loop and show lots of this without stopping.