[Ilugc] make tutorial

  • From: l.mohanphy@xxxxxxxxx (Mohan L)
  • Date: Fri Jun 18 18:19:54 2010

On Fri, Jun 18, 2010 at 4:59 PM, Girish Venkatachalam <
girishvenkatachalam@xxxxxxxxx> wrote:

Dear all,

This mail is an attempt to teach makefiles in UNIX. Makefiles work the
same way everywhere even in
Windoze. There are also several names for the make tool. tmake, pmake,
gmake, nmake and so on. ;)

But all of them work similarly.

In the BSD world makefiles are more subtle and much shorter. Makefiles
also work differently in the
autoconf world with configure script, Makefile.in , Makefile.am and so on.

As you can see it is very complicated, complex and needlessly boring. But
this does not take away the fact that makefiles are a beautiful thing.


Hi ,

make is the standard against which all other build systems are currently
compared. Make is at its core a dependency checker that can execute shell
commands based on one file being older than another. Implementations of Make
exist on almost every software platform, although by far the most widespread
would be GNU Make. make is almost dead(virtually nobody is using today the
original BSD Unix Make).

Most Make implementations include a set of 'default make rules' which allow
very simple building of C, C++  projects. Additionally make rules can be
specified for other languages, but these tend to need to be customized from
platform to platform.

Make doesn't include dependency checking by default, although there are make
rules that can do this for you fairly easily in the case of GNU Make.

GNU Make's support for shell scripts under GNU/Linux means that GNU
Makefiles can be very powerful, but use of advanced GNU Make features will
usually render your makefile incompatible with other Make implementations.

see the article what-is-wrong-with-make? :
http://freshmeat.net/articles/what-is-wrong-with-make

Make implementations are poor and dirty by today's standards . That is why
we have few more modern alternatives GNU Autotools,CMake,SCons :

GNU Autotools
GNU Autotools extends GNU Make with a larger library of default build rules,
plus extensive dependency checking capability. It knows how to compile
software (executables, shared libraries, plus documentation, etc) for a
large number of targets, which is something that rapidly becomes tedious
when using plain Makefiles. GNU Autotools is the defacto standard build
system for large linux programs.

CMake
CMake is a principal competitor to both GNU Autotools and SCons. It is a
build system generator, i.e. after running CMake, the user has a native
Visual Studio file at his disposal, or a native Makefile, or nmake file, or
whatever their preference is. Off-the-shelf build capabilties are
comprehensive and proven for large scale software development. The
implementation architecture is far more unified than GNU Autotools and it
runs much faster. CMake has its own scripting language that runs on all
platforms that CMake targets. It is Yet Another Scripting Language, which
puts some people off, but it has the advantage of not introducing any
additional language dependencies to a project.

Thanks & Rg
Mohan L

Other related posts: