I've been looking around on the internet for the use of makefiles and the make command. I found some great tutorials regarding syntax and how to write a good makefile, and this is great. But I have one problem though:
None of these tutorials explained how to physicalle CREATE a Makefile. I mean; do I use a text editor and simply call the file "Makefile"? I tried that but he would always save it as "Makefile.txt", this won't work. Any help is appreciated.
Yes you can use a text editor. The makefile is usually named simply Makefile without a suffix. To execute the makefile you need to have a make tool, like GNU Make installed. Simply run make to run the default all target.
Which editor are you using? Some have a default extension they'll add on if you forget.
And are you working on Windows?
Guessing you might well be...
Newer versions of Windows (and Notepad) can be a bit too "helpful". But you can...
1. After saving and closing the file, use Explorer to find and rename it. Or you could rename it from the console. Once it's got the name makefile, it'll stay that way.
(Aside: have you configured Explorer to always show file extensions?)
2. Quote the file name when saving. i.e. save "makefile"
Great thanks! I do use windows. I know it's not optimal but I'm not much of a programmer at all. I just happen to follow a course out of interest, but I don't want to start using Unix just for a course.
I managed to cancel the suffix by saving it as Makefile. windows is indeed too helpfull and I couldn't find anywhere how to cancel it. I read your post right after this ... xD
When I launch cmd, he targets a default directory. Before I can use make I have to change this directory with "cd PATH" command. Then I juste use make and it works fine.
But is there a way to do this in one command? Something that would say "Run make in _directory" ?