Make

From HPC Wiki
Revision as of 11:32, 24 October 2017 by Jan-eitzinger-77c0@uni-erlangen.de (talk | contribs) (Created page with "Make is a build automation tool that automatically builds arbitrary targets (in most cases program executables or libraries) from a list of prerequisites (which can be files o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Make is a build automation tool that automatically builds arbitrary targets (in most cases program executables or libraries) from a list of prerequisites (which can be files or other targets). Make is controlled by reading files called Makefiles which specify how to derive the target. While make is a standard UNIX tool today in most cases people refer to the (GNU make https://www.gnu.org/software/make/) implementation which provides a lot of extensions.

The main benefits of using a build automation tool are:

  • Automation :-) of repetitive command execution
  • Consistent build results preventing errors
  • Easier configuration for different tool chains
  • Formulate complex build settings with possibly various targets from the same source tree
  • Automatic matching of prerequisites
  • Speed up compilation by rebuilding only changed source files targets and parallel build support

Any serious software development effort sooner or later has to use a automated build tool. While make is the standard build tool on Linux systems there are various alternatives available, sometimes standalone and sometimes as a frontend to make.

Basic usage

edit : main.o kbd.o command.o display.o \
       insert.o search.o files.o utils.o
        cc -o edit main.o kbd.o command.o display.o \
                   insert.o search.o files.o utils.o

main.o : main.c defs.h
        cc -c main.c
kbd.o : kbd.c defs.h command.h
        cc -c kbd.c
command.o : command.c defs.h command.h
        cc -c command.c
display.o : display.c defs.h buffer.h
        cc -c display.c
insert.o : insert.c defs.h buffer.h
        cc -c insert.c
search.o : search.c defs.h buffer.h
        cc -c search.c
files.o : files.c defs.h buffer.h command.h
        cc -c files.c
utils.o : utils.c defs.h
        cc -c utils.c
clean :
        rm edit main.o kbd.o command.o display.o \
           insert.o search.o files.o utils.o
$ ls -l

tut d, e und f

Tips and Tricks

Get the source code of this sample Page and copy it into new pages to start with a resonable structure.

Common Pitfalls

blabla ... Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

Links and more Information

Wiki Syntax