C is the programming language most frequently associated with UNIX-like operating systems such as Linux or BSD. Since the 1970s, the bulk of the UNIX operating system and its applications have been written in C. Because the C language doesn’t directly rely on any specific hardware architecture, UNIX was one of the first portable operating systems. In other words, the majority of the code that makes up UNIX doesn’t know and doesn’t care which computer it is actually running on.Machine-specific features are isolated in a few modules within the UNIX kernel, which makes it easy for you to modify them when you are porting to different hardware architectures.
C++ extends the capabilities of C by providing the necessary features for object-oriented design and code. C++ also provides some features, such as the capability to associate functions with data structures that do not require the use of class-based object-oriented techniques. For these reasons, the C++ language enables existing UNIX programs to migrate toward the adoption of object orientation over time.Support for C++ programming is provided by gcc, which you run with the name g++when you are compiling C++ code.
You could use make to compile, build, and install a software package, using a simple command like this:
santos@santos:~$ sudo make install
You can use the default makefile (usually called Makefile, with a capital M), or you can use make’s -f option to specify any makefile, such as MyMakeFile, like this:
santos@santos:~$ sudo make -f MyMakeFile
Other options might be available, depending on the contents of your makefile. You may have a source file named hi.c and just run make hi, where make figures out what to do automatically to build the final executable. See make’s built-in rules with make -p.
Using the makefile from the preceding example, you can build a program like this:
santos@santos:~$ sudo make
To build a specified component of a makefile, you can use a target definition on the command line. To build just the program, you use make with the skel target, like this:
santos@santos:~$ sudo make skel
If you make any changes to any element of a target object, such as a source code file, make rebuilds the target automatically. This feature is part of the convenience of usingmake to manage a development project. To build and install a program in one step, you can specify the target of install like this:
santos@santos:~$ sudo make install
The make command is only one of several programming automation utilities included with Ubuntu. There are others, such as automake, and one of the newer tools, autoconf, which builds shell scripts that can be used to configure program source code packages.Many Linux commands and graphical clients for X downloaded in source code forminclude configure scripts. To configure the source package, build the software, and then install the new program, the root user might use the script like this
santos@santos:~$ ./configure ; make ; sudo make install
Although creating the dependency-checking configure script can be done manually, you can easily overcome any complex dependencies by using a graphical project development tool such as KDEs KDevelop or GNOME’s Glade.