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
A Makefile can be described as a script that navigates through the source and describes the listed commands to create a target as described above.
If there is no change to the same source, the error "make: is up to date" will be output because compilation does not need to be performed.
The example source to proceed uses $ALTIBASE_HOME/sample?APRE?connect1.sc included in the same sources in the directory where Altibase is installed. (Based on Altibase 5.3 or later)
This example was written based on the environment compiling based on the GCC compiler in Linux. Therefore, when using other Unix environments and compilers, a part of Makefile must be written differently for the environment.
Some of the sources are as follows.
Running the Precompile
The APRE extension of Altibase uses "*.sc". Since this file is not in a format that can be directly interpreted by the C/C++ compiler, it must be converted into C/C++ source with the precompiler provided by Altibase.