Generating make files

How would you create a makefile for a project that has only a bunch of .c and .h files?
Are there any tools available that can create makefiles?
yes, most IDE can export them from a project.
c or c++ or actually other languages does not matter.
When I have a simple project to make a Makefile for, I use a text editor.

Notepad would do, although since TAB is meaningful in a Makefile, an editor that shows TABs visibly is helpful.
Last edited on
Are there any tools available that can create makefiles?

Yes. Many. For example,

'GNU Build System', aka GNU Autotools, has been around for ages.

'CMake' is more recent. See https://cmake.org/

Qt-framework has its 'qmake'.
OOPS,

I recognized that I didn't explain clearly. I know how to write a simple make file with an editor.
I just find it too tedious with 10-20 file names, so I am looking for a tool.
I am just a bit fed up with IDEs at the moment.

@keskiverto,
thanks, I will have a look at CMake.
I don't know anybody who likes to set up Makefiles. If you find a tool do do what you want, go for it.

However, Makefiles do have wildcards. Also, g++ has a flag that can generate dependencies for a source file which can be included as part of a Makefile. So, it is possible to set up a Makefile that doesn't need to grow as you add files to a project. Then, you can copy&paste it to other projects going forward.

It takes a little doing, and I don't have an example at my fingertips to show you, but it is possible.
Topic archived. No new replies allowed.