-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat Developer Toolset
3.2. Using make
To build a program without using a Makefile, run the
make
tool as follows:
scl enable devtoolset-6 'make source_file_without_extension'
This command makes use of implicit rules that are defined for a number of programming languages, including C, C++, and Fortran. The result is a binary file named
source_file_without_extension
in the current working directory.
Note that you can execute any command using the
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset make
as default:
scl enable devtoolset-6 'bash'
Note
To verify the version of
make
you are using at any point, type the following at a shell prompt:
which make
Red Hat Developer Toolset's
make
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset make
:
make -v
Example 3.1. Building a C Program Using make
Consider a source file named
hello.c
with the following contents:
#include <stdio.h> int main(int argc, char *argv[]) { printf("Hello, World!\n"); return 0; }
To build this source code using the implicit rules defined by the
make
utility from Red Hat Developer Toolset, type:
~]$ scl enable devtoolset-6 'make hello'
cc hello.c -o hello
This creates a new binary file called
hello
in the current working directory.