Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
becki:linux:build_tools [2010-07-23 09:35] becki |
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: |
- | === Misc == | + | find -name '*.c' -print0 | xargs -0 indent |
- | * A line beginning with ''#'' is a comment | + | <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> |
- | * 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 == | + | ===== GNU gcc / g++ == |
- | <code bash> | + | See [[GNU GCC]] |
- | a = Peter | + | |
- | c = $(a) | + | |
- | d := $(a) | + | |
- | a = Franz | + | |
- | test: | + | ===== GNU Gprof == |
- | @echo c expands to $(c) # Franz | + | |
- | @echo d expands to $(d) # Peter | + | See [[GNU Gprof]] |
- | </code> | + | |
+ | ===== Make == | ||
+ | |||
+ | See [[GNU Make]] | ||
+ | |||
+ | ===== pkg-config == | ||
+ | |||
+ | http://people.freedesktop.org/~dbn/pkg-config-guide.html | ||
===== Automake == | ===== Automake == |