1 | # $Id: programs.kmk 72 2004-05-30 06:16:41Z bird $
|
---|
2 | ## @file
|
---|
3 | # This file deals with TARGET_PROGRAMS.
|
---|
4 | # It should only be included from rules.kMk.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
7 | #
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 2 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild; if not, write to the Free Software
|
---|
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 |
|
---|
27 | # Assert correct context
|
---|
28 | .ifndef __RULES_KMK__
|
---|
29 | .error $(MAKEFILE) can only be included from rules.kMk.
|
---|
30 | .endif
|
---|
31 |
|
---|
32 |
|
---|
33 | ## @page Makefile Makefile
|
---|
34 | #
|
---|
35 | # A makefile defines a context. The context consists of a .CURDIR, .OBJDIR,
|
---|
36 | # and stuff done by the config.kMk. Sources for instance is always relative
|
---|
37 | # to .CURDIR, while objects and other output files are relative to .OBJDIR.
|
---|
38 | #
|
---|
39 | #
|
---|
40 | # @todo move this page
|
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 | ## @page TARGET_PROGRAMS TARGET_PROGRAMS
|
---|
45 | #
|
---|
46 | # Programs to be made. On platforms which enforces extensions for programs
|
---|
47 | # the default extension is added.
|
---|
48 | # Modules listed in TARGET_PROGRAMS should NOT be listed TARGETS.
|
---|
49 | #
|
---|
50 | # Let's say TARGET_PROGRAMS = foo. Then you can configure the executable foo
|
---|
51 | # using the following macros:
|
---|
52 | #
|
---|
53 | # foo_SOURCES - The sources files which object files foo is linked to
|
---|
54 | # together of.
|
---|
55 | #
|
---|
56 | # foo_TEMPLATE - Compiler, linker, and more setup.
|
---|
57 | #
|
---|
58 | #
|
---|
59 | # foo_DEFINES - Defines used by all tools which support it. No -D should be
|
---|
60 | # used as this is tool specific. Defines which have a value
|
---|
61 | # must use '=' as assignment, foo_DEFINES=VER=1 for instance.
|
---|
62 | #
|
---|
63 | # foo_INCLUDES - Include directories used by all tools which support it. No -I
|
---|
64 | # or similar should be used as this is tool specific. Directories
|
---|
65 | # are separated by ';'.
|
---|
66 | #
|
---|
67 | # foo_LIBS - Libraries to link with.
|
---|
68 | #
|
---|
69 | #
|
---|
70 | # C Compilers:
|
---|
71 | # foo_CTOOL - The C compiler tool to use.
|
---|
72 | # foo_CDEFS - C compiler defines.
|
---|
73 | # foo_CINCS - C compiler include directories.
|
---|
74 | # foo_COPTS - C compiler options. This is somewhat compiler independant.
|
---|
75 | # foo_CFLAGS - C compiler flags. Specifying compiler specific flags.
|
---|
76 | #
|
---|
77 | #
|
---|
78 | # C++ Compilers:
|
---|
79 | # foo_CXXTOOL - The C++ compiler tool to use.
|
---|
80 | # foo_CXXDEFS - C++ compiler defines.
|
---|
81 | # foo_CXXINCS - C++ compiler include directories.
|
---|
82 | # foo_CXXOPTS - C++ compiler options. This is somewhat compiler independant.
|
---|
83 | # foo_CXXFLAGS - C++ compiler flags. Specifying compiler specific flags.
|
---|
84 | #
|
---|
85 | #
|
---|
86 | # Assemblers:
|
---|
87 | # foo_ASTOOL - The assembler tool to use.
|
---|
88 | # foo_ASDEFS - Assembler defines.
|
---|
89 | # foo_ASINCS - Assembler include directories.
|
---|
90 | # foo_ASOPTS - Assembler options. This is somewhat assembler independant.
|
---|
91 | # foo_ASFLAGS - Assembler flags. Specifying compiler specific flags.
|
---|
92 | #
|
---|
93 | #
|
---|
94 | # Resource Compilers:
|
---|
95 | # foo_RCTOOL - The Resource compiler tool to use.
|
---|
96 | # foo_RCDEFS - Resource compiler defines.
|
---|
97 | # foo_RCINCS - Resource compiler include directories.
|
---|
98 | # foo_RCOPTS - Resource compiler options. This is somewhat compiler independant.
|
---|
99 | # foo_RCFLAGS - Resource compiler flags. Specifying compiler specific flags.
|
---|
100 | #
|
---|
101 | #
|
---|
102 | # Link Editors:
|
---|
103 | # foo_LDTOOL - The link editor tool to use.
|
---|
104 | # foo_LDOPTS - Link editor options. This is somewhat link editor independant.
|
---|
105 | # foo_LDFLAGS - Link editor flags. Specifying link editor specific flags.
|
---|
106 | # foo_LDDEFFILE - Link editor definition file. (PC thingy)
|
---|
107 | # foo_LDLIBS - Link editor . (PC thingy)
|
---|
108 | #
|
---|
109 | #
|
---|
110 | #
|
---|
111 |
|
---|
112 |
|
---|
113 | #
|
---|
114 | # Generate program rules.
|
---|
115 | #
|
---|
116 | .for trgt in ${TARGET_PROGRAMS}
|
---|
117 |
|
---|
118 | ${trgt}_int_objects :=
|
---|
119 | TARGETS += ${trgt}${SFX_EXE}
|
---|
120 |
|
---|
121 |
|
---|
122 | # rules for each of the C source files.
|
---|
123 | .for src in ${${trgt}_SOURCES:M*.c}
|
---|
124 | int_object := ${src}
|
---|
125 | ${trgt}_int_objects += ${int_object}
|
---|
126 |
|
---|
127 | .endfor
|
---|
128 |
|
---|
129 | #.for csrc in ${${trgt}_SOURCES:M${SFXS_C:S@^@*@}}
|
---|
130 | .for csrc in ${${trgt}_SOURCES:M*.c}
|
---|
131 | ${trgt}__OBJECTS += ${csrc:S@.${csrc:E}@${SFX_OBJ}@}
|
---|
132 | ${csrc:S@.${csrc:E}@${SFX_OBJ}@}: ${csrc}
|
---|
133 | echo "compiling ${.ALLSRC} -> $@"
|
---|
134 | .endfor
|
---|
135 |
|
---|
136 |
|
---|
137 | # linking rule
|
---|
138 | ${trgt}${SFX_EXE}: ${trgt}_int_objects
|
---|
139 | echo "$@"
|
---|
140 |
|
---|
141 | .endfor
|
---|
142 |
|
---|
143 | # clean up := variables we've used.
|
---|
144 |
|
---|