I have a following directory structure,
I also have this make file that works fine, but it needs all files in the same directory and also it creates *.o and bin files in the same directory. Can someone please show me how to improve this code so that i can move *.h files into /h, *.c files into /src. Also *.o files would be created in /obj and the binary file will be created in /bin?
I was thinking of something like this. This part only creates *.o files, no binary files. However, this is giving me an error right now.
Step 1:
h/Add a variable, make a small change to the
%.orule, and add avpathdirective, so that the%.orule will know where to look:Step 2:
src/Add another variable, change the assignment of
objs, add anothervpath:Step 3:
obj/Add a variable, change
objsand the%.orule again, and thecleanrule:Step 4:
bin/Add another variable, and change the assignment of
prog:EDIT:
What you are now asking for is a bad design. But here it is:
obj/makefile:
bin/makefile: