Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
becki:linux:build_tools [2010-07-23 09:18] becki created |
becki:linux:build_tools [2018-03-29 10:12] (aktuell) becki |
||
|---|---|---|---|
| Zeile 3: | Zeile 3: | ||
| This page about How to build applications on Linux. ISO C and its standard library are described in [[c]]. POSIX/Linux specific features and enhancements are described in [[:becki:my:linux:linux programming]]. | This page about How to build applications on Linux. ISO C and its standard library are described in [[c]]. POSIX/Linux specific features and enhancements are described in [[:becki:my:linux:linux programming]]. | ||
| - | ===== gcc / g++ == | + | ===== indent == |
| - | [[http://gcc.gnu.org/onlinedocs/gcc/|Manual]] (Current Development) | + | Use [[man>indent]] to constistently format your C-code. Here a configuration example for ''indent'' to be put in ''$HOME/.indent.pro'': |
| - | * -c : Do not link | + | <code prolog> |
| - | * -o file : Place output in file file. Applies to object files and executables | + | /* Default Config: Use Kernighan & Ritchie coding style: */ |
| - | * -Wall : enable most warnings | + | --k-and-r-style |
| - | ===== Make == | + | /* My minor variants to Kernighan & Ritchie Style: */ |
| + | --line-length 80 /* Because default is 75 */ | ||
| + | --no-tabs /* Use spaces instead of tabs */ | ||
| + | -brf /* Place function opening brace after function declaration */ | ||
| + | </code> | ||
| - | [[http://www.gnu.org/software/make/manual/html_node/|Manual]] | + | Usage: |
| - | * A nonzero exit status of command beginning with ''-'' is ignored | + | find -name '*.c' -print0 | xargs -0 indent |
| - | * 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 | + | |
| - | * Implicit rules example: ''file.o'' is made automatically from ''file.c'' with a command of the form `$(CC) -c $(CPPFLAGS) $(CFLAGS)' | + | |
| - | * To ignore errors in a command line, write a `-' at the beginning of the line's text (after the initial tab). | + | |
| - | * ''%%make -n%%'' or ''%%make --dry-run%%'' - Don't actually run any commands; just print them. | + | |
| - | === Variable assignment == | + | <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> |
| - | <code bash> | + | ===== GNU gcc / g++ == |
| - | a = Peter | + | |
| - | c = $(a) | + | |
| - | d := $(a) | + | |
| - | a = Franz | + | |
| - | test: | + | See [[GNU GCC]] |
| - | @echo c expands to $(c) # Franz | + | |
| - | @echo d expands to $(d) # Peter | + | |
| - | </code> | + | |
| - | ===== Autoconf == | + | ===== GNU Gprof == |
| - | [[http://www.gnu.org/software/autoconf/manual/html_node/index.html#Top|Manual]] | + | See [[GNU Gprof]] |
| + | |||
| + | ===== Make == | ||
| + | |||
| + | See [[GNU Make]] | ||
| + | |||
| + | ===== pkg-config == | ||
| + | |||
| + | http://people.freedesktop.org/~dbn/pkg-config-guide.html | ||
| ===== Automake == | ===== Automake == | ||
| [[http://www.gnu.org/software/automake/manual/html_node/index.html#Top|Manual]] | [[http://www.gnu.org/software/automake/manual/html_node/index.html#Top|Manual]] | ||
| + | |||
| + | [Makefile.am] → (automake) ⇒ [Makefile.in] | ||
| + | |||
| + | ===== Autoconf == | ||
| + | |||
| + | [[http://www.gnu.org/software/autoconf/manual/html_node/index.html#Top|Manual]] | ||
| + | |||
| + | [Makefile.in] | ||
| + | ⇓ | ||
| + | [configure.ac] → (autoconf) ⇒ [(configure)] ⇒ [Makefile] -> make ⇒ ... | ||