Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
becki:linux:build_tools [2017-09-25 13:23] becki |
becki:linux:build_tools [2018-03-29 10:12] (aktuell) becki |
||
---|---|---|---|
Zeile 23: | Zeile 23: | ||
<note important>indent needs files with Unix line ends (''\n'') as input. Files with other line endings can be converted with ''fromdos'' or ''sbfromdos''</note> | <note important>indent needs files with Unix line ends (''\n'') as input. Files with other line endings can be converted with ''fromdos'' or ''sbfromdos''</note> | ||
- | ===== gcc / g++ == | + | ===== GNU gcc / g++ == |
- | [[http://gcc.gnu.org/onlinedocs/gcc/|Manual]] (Current Development) | + | See [[GNU GCC]] |
- | * -c : Do not link | + | ===== GNU Gprof == |
- | * -o file : Place output in file file. Applies to object files and executables | + | |
- | * -Wall : enable most warnings | + | |
- | See also: [[http://www.thegeekstuff.com/2011/10/c-program-to-an-executable/|Journey of a C Program to Linux Executable in 4 Stages]] | + | See [[GNU Gprof]] |
===== Make == | ===== Make == | ||
- | [[http://www.gnu.org/software/make/manual/html_node/|Manual]] | + | See [[GNU Make]] |
- | + | ||
- | === Misc == | + | |
- | + | ||
- | * A line beginning with ''#'' is a comment | + | |
- | * The variable ''$*'' contains FIXME | + | |
- | * The variable ''$@'' or ''$(@)'' contains the name of the target (tested) | + | |
- | * '@' at the beginning of a command runs the command but does not copy the line to stdout | + | |
- | * '-' at the beginning of a command runs the command but does not abort make if command fails | + | |
- | * Implicit rules example: ''file.o'' is made automatically from ''file.c'' with a command of the form `$(CC) -c $(CPPFLAGS) $(CFLAGS)' | + | |
- | * ''%%make -n%%'' or ''%%make --dry-run%%'' - Don't actually run any commands; just print them. | + | |
- | + | ||
- | === Variable assignment == | + | |
- | + | ||
- | <code bash> | + | |
- | a = Peter | + | |
- | c = $(a) | + | |
- | d := $(a) | + | |
- | a = Franz | + | |
- | + | ||
- | test: | + | |
- | @echo c expands to $(c) # Franz | + | |
- | @echo d expands to $(d) # Peter | + | |
- | </code> | + | |
- | + | ||
- | ==== rules for overwriting variables == | + | |
- | + | ||
- | # Every environment variable that make sees when it starts up is transformed into a make variable with the same name and value. | + | |
- | # An explicit assignment in the makefile overrides the environment | + | |
- | # An assignment in the makefile can be overridden by the command line argument, eg {{{make CFLAGS='-g -O' [target] }}} | + | |
- | + | ||
- | Sources: [[https://www.gnu.org/software/make/manual/html_node/Overriding.html|1]] [[https://www.gnu.org/software/make/manual/html_node/DESTDIR.html|2]] | + | |
- | + | ||
- | ==== CFLAGS usage == | + | |
- | + | ||
- | useres expect FIXME | + | |
- | https://www.gnu.org/software/make/manual/html_node/Command-Variables.html#Command-Variables | + | |
- | + | ||
- | ==== Implicit rules == | + | |
- | + | ||
- | FIXME | + | |
- | + | ||
- | ==== Automatic variables == | + | |
- | + | ||
- | $@ does oviously not work in prerequsites, only in recipie! | + | |
===== pkg-config == | ===== pkg-config == |