Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the -lrt flag in gnu-make?

Tags:

gcc

gnu-make

In a later stage of the gnu-make process gmake sent a command similar to:

gcc -static foo.so.0 bar.o bizz.o buzz.o -pthreads -lrt

In that command, what dos the -lrt mean?

like image 586
Ocasta Eshu Avatar asked Apr 04 '13 21:04

Ocasta Eshu


People also ask

What does the flag do in makefile?

Flags in make are just variables containing options that should be passed to the tools used in the compilation process. Although you can use any variable for this purpose, make defines some commonly used flags with default values for some common tools, including C and C++ compiler, C preprocessor, lex , and yacc .

What is the use of flag in GCC?

This flag helps us to specify the name of the final executable produced by GCC. It places the output of the final executable in a file “file” as specified along with the flag.

What is flag in g ++ compiler?

(debug) Inserting the `g' flag tells the compiler to insert more information about the source code into the executable than it normally would. This makes use of a debugger such as gdb much easier, since it will be able to refer to variable names that occur in the source code.

What is $@ in makefile?

The file name of the target of the rule. If the target is an archive member, then ' $@ ' is the name of the archive file. In a pattern rule that has multiple targets (see Introduction to Pattern Rules), ' $@ ' is the name of whichever target caused the rule's recipe to be run.


1 Answers

That has not related to make; make will never add a flag like that on its own. Whomever wrote your makefile will have added that flag to the link line themselves. That is a compilation command, and -lrt is a flag passed to the compiler. The -l flag specifies that you should link with a library, and the name of the library follows; so for -lrt it means "link with the rt library". This causes the linker to go look for libraries named librt.a or librt.so (for shared libraries) and link them with the output file.

like image 193
MadScientist Avatar answered Oct 06 '22 00:10

MadScientist