Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet204/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   200   201   202   203   204   205   206   207   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

DIR
– specify location of the binary directory as 
DIR
• 
--libdir
=
DIR
– specify location for object code (library files) as 
DIR
• 
--infodir
=
DIR
– specify location for documentation as 
DIR
• 
--prefix
=
DIR
– specify location for all directories (this will ensure all directories 
are placed in one location rather than distributing them) as 
DIR
• 
--enable-all
– enable all available modules
• 
--
enable-module
=
module1 module2 module3 
… – enable specified modules
• 
--
disable-module
=
module1 module2 module3
… – disable specified modules
• 
--with-
feature
=
value
– establish that variable 
feature
should have 
value
The configure step may take seconds or minutes depending on its complexity. The result 
will not only be a great deal of output sent to your terminal window, but also the creation 
of a 
makefile
.
13.5.4 The make Step
Once the 
makefile
is successfully generated, your next step is quite easy. Just type 
make

The make command in Linux causes the 
makefile/Makefile
script to execute. There 
are numerous options available for make, but perhaps the only significant ones are –i to 


550

Linux with Operating System Concepts
ignore errors that may occur during compilation, -k to continue to work as much as pos-
sible even if errors arise, and –I 
dir
to specify an include directory. If there are include state-
ments, this directory is searched in place of the current directory. As with the configure 
step, the make step may take seconds or minutes and will result in numerous messages 
being displayed.
Most makefiles are written in parts. These parts may include the compilation section, 
an installation section, a clean-up section, and a tar section. To run the compilation sec-
tion, just issue the 
make
command by itself. To perform the installation separately (which 
is usually required), use the command 
make
install
. If you have already attempted 
to compile and/or install the software and it failed, before trying again, issue 
make
clean
. Finally, if you want to take the files and wrap them up (or back up) in a tar file, use 
make
tar
. The command 
make
all
should perform a 
make
clean

make
, and 
make 
install
all in one. Not all makefiles will have all of these sections and you can find out 
which sections are available in the 
README
file.
Here, we examine the components of a typical 
makefile
, albeit a very simple one. 
Interspersed between the lines of the 
makefile
file are explanations of the script’s code.
CC
=
gcc
FLAGS
=
-Wall
LIBS
=
-lcrypt
LIBM
=
-lm
The above lines define several compilation variables. 
gcc
is the GNUs C/C 
++
compiler. 
This will be the command that the makefile eventually issues to compile the source code. 
–Wall
is a popular option for the compiler, which enables all warnings. LIBS and LIBM 
define library options.
INSTALL_PREFIX
=
/usr/local
BIN_DIR
=
/bin
MAN_DIR
=
/man/man1
BIN_DIR_D
=
/sbin
These variables define installation directories. The BIN_DIR_D is used to store the dae-
mon version of the program assuming that you want to create both a normal executable 
and a daemon.
PROGRAM_NAME 
=
. . .
SOURCES 
=
. . .
HEADERS 
=
. . .
OBJECTS 
=
. . .
These four variables define the names of the files to be used by gcc. Specifically
PROGRAM_NAME is the English description of the program and will be the name of the 
compiled file. SOURCES are the C/C
++
source code files (.c or.cpp). HEADERS lists one or 


Software Installation and Maintenance

551
more header files (.h). Finally, OBJECTS are files that store already-compiled C/C
++
code. 
These are known as object files (.o). The object files are often used as libraries, containing 
the compiled code of commonly referenced functions.
In this case, let us assume that we have the following definitions for SOURCES and 
OBJECTS, respectively:
SOURCES 
=
file1.cpp file2.cpp file3.cpp
OBJECTS 
=
file4.o file5.o file6.o
Continuing with our makefile, we reach the portion that actually performs the 
operation(s) desired.
all: 

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   200   201   202   203   204   205   206   207   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish