Primaries: In progress

This commit is contained in:
2026-06-15 23:29:23 +05:30
parent 3406a2b2bc
commit a079a4184d
+281
View File
@@ -995,5 +995,286 @@ make bindir='' libdir='' install
\end_layout
\begin_layout Subsection
Prefix Not Associated with Installation
\end_layout
\begin_layout Standard
Sometimes,
we don't want certain products to installed anywhere.
That's why we have certain prefix which are not associated with any installation location.
There are 3 main such prefix:
\end_layout
\begin_layout Itemize
\family typewriter
noinst
\family default
:
This signifies that the product listed in a variable with this prefix is not to be installed anywhere in the system after the build process.
It could be a
\shape italic
convenience
\shape default
static library which is only used to build a final product.
\end_layout
\begin_layout Itemize
\family typewriter
check
\family default
:
The products listed will be build only when
\family typewriter
make check
\family default
command is used.
These products are only build for testing purpose.
\end_layout
\begin_layout Itemize
\family typewriter
EXTRA
\family default
:
This signifies the list of products which may be conditionally build and eventually,
installed.
This types of configuration control is possible via
\family typewriter
\shape slanted
configure
\family default
\shape default
script where we pass some argument to it and prompts to build some
\begin_inset Quotes eld
\end_inset
extra
\begin_inset Quotes erd
\end_inset
products.
However,
enabling such feature of autoconf and automake is not as simple as above two.
Go through the below illustration:
\end_layout
\begin_layout Standard
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100col%"
height "1pt"
\end_inset
\end_layout
\begin_layout Standard
\begin_inset listings
lstparams "basicstyle={\rmfamily}"
inline false
status open
\begin_layout Plain Layout
AC_INIT(...)
\end_layout
\begin_layout Plain Layout
...
\end_layout
\begin_layout Plain Layout
optional_programs=
\end_layout
\begin_layout Plain Layout
AC_SUBST([optional_programs])
\end_layout
\begin_layout Plain Layout
...
\end_layout
\begin_layout Plain Layout
if test "x$(build_opt_prog)" = xyes;
then
\end_layout
\begin_layout Plain Layout
optional_programs=$(optional_programs) optprog
\lang american
### 1 ###
\end_layout
\begin_layout Plain Layout
fi
\end_layout
\begin_layout Plain Layout
...
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
A shell script code in configure.ac for building
\series bold
optprog
\series default
product conditionally.
\end_layout
\end_inset
\end_layout
\end_inset
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100col%"
height "1pt"
\end_inset
\end_layout
\begin_layout Standard
\begin_inset space \space{}
\end_inset
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100col%"
height "1pt"
\end_inset
\end_layout
\begin_layout Standard
\begin_inset listings
inline false
status open
\begin_layout Plain Layout
EXTRA_PROGRAMS = optprog ### 2 ###
\end_layout
\begin_layout Plain Layout
bin_PROGRAMS = myprog $(optional_programs) ### 3 ###
\begin_inset Caption Standard
\begin_layout Plain Layout
Using the EXTRA prefix to conditionally build products in Makefile.am
\end_layout
\end_inset
\end_layout
\end_inset
\begin_inset CommandInset line
LatexCommand rule
offset "0.5ex"
width "100col%"
height "1pt"
\end_inset
In Listing 6 ### 1 ###,
\series bold
optprog
\series default
is appended to an Autoconf substitution variable called
\family sans
optional_program
\family default
.
The
\family sans
EXTRA_PROGRAMS
\family default
variable at ### 2 ### in Listing 7 list
\family sans
optprog,
\family default
as a product that may or may not be build.
This redundant information of
\family sans
EXTRA_PROGRAMS
\family default
in Makefile.am make it ensure that Automake knows that optprog is a optional product and make the resultant Makefile with appropriate script.
This make sure that even if
\series bold
optprog
\series default
is not mentioned in
\family typewriter
$(optional_programs)
\family default
variable in some build.
\end_layout
\begin_layout Subsection
Primaries
\end_layout
\begin_layout Standard
\shape italic
Primaries
\shape default
represent type of product which is generated by this build system.
That's it!
What are these type of files?
\begin_inset Newline newline
\end_inset
These files can be executable,
libraries,
config files in terms of xml,
json and event normal txt files.
Wait,
normal txt files?
Well,
what it means is that some products (not exactly) of build system are not actually generated by the build system.
These are part of the project and we will need these files while executing the software in our system after the build process of that software.
For example,
C or C++ language have the prototype of the function or API written in header files (.h or .hpp) which allows the user of the library to make there software aware of these API before using it and enables in linking the implementation to the function calls while in the linking process of the build system.
So,
the main intent of this long boring example is to provide a context on why we have different kind of primaries as this helps in differentiating the type of product to Automake and hence generate rules in resultant Makefile accordingly.
Interestingly,
we can define our own primaries,but beware,
we need to write the rules for those on our own in Makefile.am.
\end_layout
\begin_layout Standard
Let us see the default primaries supported by Automake.
\end_layout
\end_body
\end_document