1 | # $Id: GCC.kmk 72 2004-05-30 06:16:41Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild Tool Config - Generic GCC.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2004 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 |
|
---|
28 | TOOL_GCC := Generic GCC
|
---|
29 | TOOL_GCC_CC := gcc$(HOSTSUFF_EXE)
|
---|
30 | TOOL_GCC_CFLAGS := -g
|
---|
31 | TOOL_GCC_CFLAGS.debug := -O0
|
---|
32 | TOOL_GCC_CFLAGS.release := -O2
|
---|
33 | TOOL_GCC_CFLAGS.profile := -pg
|
---|
34 | TOOL_GCC_CINCS :=
|
---|
35 |
|
---|
36 |
|
---|
37 | ## Compile C source.
|
---|
38 | # @param $1 Output basename (full).
|
---|
39 | # @param $2 Source filename (relative).
|
---|
40 | # @param $3 Normalized main target name.
|
---|
41 | define TOOL_GCC_COMPILE_C
|
---|
42 | #$ (warning dbg GCC: 1=$1 2=$2 3=$3 4=$4 5=$5)
|
---|
43 | $1.o: $(PATH_CURRENT)/$2 $(dir $1).dir_created
|
---|
44 | $(TOOL_GCC_CC) -c \
|
---|
45 | $($3_$2_CFLAGS) $($3_$2_CFLAGS.$(BUILD_TYPE)) \
|
---|
46 | $($2_CFLAGS) $($2_CFLAGS.$(BUILD_TYPE)) \
|
---|
47 | $($3_CFLAGS) $($3_CFLAGS.$(BUILD_TYPE)) \
|
---|
48 | $(TOOL_GCC_CFLAGS) $(TOOL_GCC_CFLAGS.$(BUILD_TYPE)) \
|
---|
49 | $(addprefix -I, $($3_$2_CINCS) $($3_$2_INCS) $($2_CINCS) $($2_INCS) $($3_CINCS) $($3_INCS) $(INCS) \
|
---|
50 | $(TOOL_GCC_CINCS)) \
|
---|
51 | $(addprefix -D, $($3_$2_CDEFS) $($3_$2_DEFS) $($2_CDEFS) $($2_DEFS) $($3_CDEFS) $($3_DEFS) $(DEFS) $(TOOL_GCC_CDEFS)) \
|
---|
52 | -o $$@ -Wp,-MT,$1$(SUFF_DEP) -Wp,-MD,$$@ \
|
---|
53 | $(PATH_CURRENT)/$2
|
---|
54 | _OBJS_$(3) += $1.o
|
---|
55 | _DEPFILES += $1$(SUFF_DEP)
|
---|
56 | endef
|
---|
57 |
|
---|