1 | # $Id: GCC.kmk 73 2004-05-31 01:11:52Z 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 |
|
---|
30 | TOOL_GCC_CC := gcc$(HOSTSUFF_EXE)
|
---|
31 | TOOL_GCC_COBJSUFF := .o
|
---|
32 | TOOL_GCC_CFLAGS := -g
|
---|
33 | TOOL_GCC_CFLAGS.debug := -O0
|
---|
34 | TOOL_GCC_CFLAGS.release := -O2
|
---|
35 | TOOL_GCC_CFLAGS.profile := -pg
|
---|
36 | TOOL_GCC_CINCS :=
|
---|
37 | TOOL_GCC_CDEFS :=
|
---|
38 |
|
---|
39 | TOOL_GCC_CC := gcc$(HOSTSUFF_EXE)
|
---|
40 | TOOL_GCC_CXXOBJSUFF := .o
|
---|
41 |
|
---|
42 | TOOL_GCC_AS := as$(HOSTSUFF_EXE)
|
---|
43 | TOOL_GCC_ASOBJSUFF := .o
|
---|
44 |
|
---|
45 | TOOL_GCC_AR := ar$(HOSTSUFF_EXE)
|
---|
46 | TOOL_GCC_ARFLAGS := cr
|
---|
47 | TOOL_GCC_ARLIBSUFF := .a
|
---|
48 |
|
---|
49 |
|
---|
50 | ## Compile C source.
|
---|
51 | # @param $(target) Normalized main target name.
|
---|
52 | # @param $(source) Source filename (relative).
|
---|
53 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
54 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
55 | # @param $(flags) Flags.
|
---|
56 | # @param $(defs) Definitions. No -D or something.
|
---|
57 | # @param $(incs) Includes. No -I or something.
|
---|
58 | # @param $(dirdep) Directory creation dependency.
|
---|
59 | #
|
---|
60 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
61 | # @param $(objsuff) Object suffix.
|
---|
62 | define TOOL_GCC_COMPILE_C
|
---|
63 | #$ (warning dbg: GCC: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
|
---|
64 | $(obj): $(dirdep) $(PATH_CURRENT)/$(source)
|
---|
65 | $(call MSG_L2,Compiling $$@ using GCC)
|
---|
66 | $(TOOL_GCC_CC) -c\
|
---|
67 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
68 | -Wp,-MT,$(dep) -Wp,-MD,$$@\
|
---|
69 | -o $$@\
|
---|
70 | $(PATH_CURRENT)/$(source)
|
---|
71 |
|
---|
72 | endef
|
---|
73 |
|
---|
74 |
|
---|
75 | ## Link library
|
---|
76 | # @param $(target) Normalized main target name.
|
---|
77 | # @param $(lib) Library name.
|
---|
78 | # @param $(objs) Object files to put in the library.
|
---|
79 | # @param $(flags) Flags.
|
---|
80 | # @param $(dirdep) Directory creation dependency.
|
---|
81 | # @param $(deps) Other dependencies.
|
---|
82 | #
|
---|
83 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
84 | define TOOL_GCC_LINK_LIBRARY
|
---|
85 | #$ (warning dbg: GCC: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase))
|
---|
86 | $(lib): $(dirdep) $(objs) $(deps)
|
---|
87 | $(call MSG_L1,Creating Library $$@)
|
---|
88 | $(RM) -f $$@
|
---|
89 | $(TOOL_GCC_AR) $(flags) $$@ $(objs)
|
---|
90 |
|
---|
91 | endef
|
---|
92 |
|
---|