To understand the structure of Makefile, let's take a look at how to make a Makefile with simple c code. As the Altibase Makefile specification complies with the GNU specification, it is recommended to use gmake. However, in this document, it is explained according to the general rules.
Basic structure of Makefile
A Makefile is a scripting language that defines the processes that are going on to make an executable file. In this section, we are going to compile the following source.
This source can be compiled at the prompt as follows.
It can be compiled with make using the simple Makefile script as follows.
- a:a.c finds a.c to make a (check for changes)
- cc -o a.c executes this command when a.c exists
- shell> make -f Makefile If the file name is Makefile, -f Makefile can be omitted