gvanem / gen-make

A simple Makefile generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gen-make 1.0.2

Build Status

A simple makefile generator that can generate makefiles for:

  • GNU-make targeting MinGW, clang-cl or MSVC.
  • Microsoft's Nmake targeting MSVC only.
  • OpenWatcom targeting only OpenWatcom programs for Windows.

It supports these generators (option -G) and makefile syntaxes:

Generator Syntax
windows GNU-make, targeting MinGW, MSVC and clang-cl.
Use e.g. make -f Makefile.Windows CC=gcc.
cygwin GNU-make
mingw GNU-make, assumes a dual-target MinGW supporting -m32.
msvc Nmake for Microsoft's make program.
watcom Wmake for OpenWatcom's make program.

It works by finding all source-files (.c, *.cc, *.cxx and *.cpp) in current directory and all sub-directories (except .git)
and writes the Makefile based on this information. The Makefile is just a starting point for further hand-editing. Hints are inserted into Makefiles as #! xx.

For a GNU-make generator, it also adds:

  • a rule to create a foo.rc file.
  • a rule to create dependencies from SOURCES.

For the MinGW or Cygwin targets (in generators window, mingw and cygwin), you can select x64 target by e.g. a:
c:\MyProject> set CPU=x64 & gen-make -G mingw

This will add a -m64 to the CFLAGS and LDFLAGS. It preferably should do this at the time invoking Makefile.MinGW
(not at the time of generating it). You'll have to hand-edit the makefile to fix this.

A generated makefile in this git checkout directory is able to compile and link a program foo.exe.
When running foo.exe, it should print:

It seems a "gen-make.exe" generated Makefile was able to compile and build this 'foo.exe' program.
Congratulations! But I will not let you do any damage here.

A future version could use the Python package Mako to generate the templates. Maybe at run-time?

About

A simple Makefile generator

License:The Unlicense


Languages

Language:C 96.8%Language:Makefile 3.1%Language:C++ 0.0%