| 979 | Recipes |
| 980 | ------- |
| 981 | |
| 982 | A typical recipe takes one of the two following forms:: |
| 983 | |
| 984 | targets : normal-prerequisites | order-only-prerequisites |
| 985 | command |
| 986 | ... |
| 987 | |
| 988 | targets : normal-prerequisites | order-only-prerequisites ; command |
| 989 | command |
| 990 | ... |
| 991 | |
| 992 | Specifying more than one file in the ``targets`` lists is the same as |
| 993 | repeating the recipe for each of the files. |
| 994 | |
| 995 | Use ``+`` and ``+|`` in the list of ``targets`` to tell ``kmk`` that the |
| 996 | recipe has more than one output. [1]_ The files after a ``+`` will |
| 997 | always be remade, while the files after a ``+|`` don't have to be remade. |
| 998 | The latter is frequently employed to update files which prerequisites |
| 999 | change wihtout the output files necessarily changing. See also |
| 1000 | ``kmk_cp --changed``. |
| 1001 | |
| 1002 | |
| 1003 | Double colon recipes |
| 1004 | |
| 1005 | Double colon recipes are written with ``::`` instead of ``:`` and are |
| 1006 | handled differently from ordinary recipes if the target appears in more |
| 1007 | than one recipe. First, all the recipes must be of the double colon type. |
| 1008 | Second, the recipes are executed individually and may be omitted depending |
| 1009 | on the state of their prerequisites. Double colon recipes without any |
| 1010 | prerequisites will always be executed. |
| 1011 | |
| 1012 | |
| 1013 | Pattern rules |
| 1014 | |
| 1015 | A couple of examples:: |
| 1016 | |
| 1017 | %.o : %.c |
| 1018 | gcc -o $@ $< |
| 1019 | %.tab.c %.tab.h : %.y |
| 1020 | bison -d $< |
| 1021 | |
| 1022 | The latter has two outputs. |
| 1023 | |
| 1024 | |
986 | 1033 | :Copyright: Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, |
987 | 1034 | 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, |
988 | 1035 | 2007 Free Software Foundation, Inc. |
989 | 1036 | |