2 package org
.de
.metux
.unitool
.base
;
4 import org
.de
.metux
.util
.*;
5 import org
.de
.metux
.propertylist
.IPropertylist
;
7 public class CCompilerParam
extends ToolParam
9 public static final String cf_make_depend_target
= "make-depend-target";
10 public static final String cf_make_depend_output
= "make-depend-output";
11 public static final String cf_compiler_define
= "compiler-define";
12 public static final String cf_source
= "source";
13 public static final String cf_output_file
= "output-file";
14 public static final String cf_include_path
= "include-path";
15 public static final String cf_include_file
= "include-file";
16 public static final String cf_compiler_flag
= "compiler-flag";
17 public static final String cf_warning_flag
= "warning-flag";
18 public static final String flag_pic
= "pic";
19 public static final String flag_nopic
= "nopic";
20 public static final String cf_compiler_command
= "tools/compiler/c-binobj/compiler-command";
22 public static final String flag_mkdepend_dummytargets
= "mkdepend-dummy-targets";
23 public static final String flag_mkdepend_default
= "mkdepend-default";
25 public static final String flag_warn_pointer_arith
= "warn-pointer-arith";
26 public static final String flag_warn_strict_prototypes
= "warn-strict-prototypes";
27 public static final String flag_warn_missing_prototypes
= "warn-missing-prototypes";
28 public static final String flag_warn_missing_declarations
= "warn-missing-declarations";
29 public static final String flag_warn_declaration_after_statement
= "warn-declaration-after-statement";
30 public static final String flag_warn_cast_align
= "warn-cast-align";
31 public static final String flag_warn_nested_externs
= "warn-nested-externs";
32 public static final String flag_warn_write_strings
= "warn-write-strings";
33 public static final String flag_warn_no_cast_qual
= "warn-no-cast-qual";
34 public static final String flag_warn_all
= "warn-all";
35 public static final String flag_warn_unused
= "warn-unused";
36 public static final String flag_warn_error
= "warn-error";
37 public static final String flag_warn_no_unused
= "warn-no-unused";
38 public static final String flag_warn_no_format
= "warn-no-format";
39 public static final String flag_warn_inline
= "warn-inline";
41 public CCompilerParam(ToolConfig cf
)
46 public CCompilerParam(ToolConfig cf
, IPropertylist pr
)
51 public void clearMkDependTarget()
53 remove(cf_make_depend_target
);
56 public void clearCompilerFlag()
58 remove(cf_compiler_flag
);
61 public void addWarningFlag(String flag
)
63 add(cf_warning_flag
,flag
);
66 public void addCompilerFlag(String flag
)
68 add(cf_compiler_flag
,flag
);
71 public void addCompilerFlag(String
[] flag
)
73 add(cf_compiler_flag
,flag
);
76 public String
[] getCompilerFlags()
78 return get_str_list(cf_compiler_flag
);
81 public String
[] getWarningFlags()
83 return get_str_list(cf_warning_flag
);
86 public void setPIC(boolean f
)
89 addCompilerFlag(flag_pic
);
91 addCompilerFlag(flag_nopic
);
94 public void setMkDependTarget(String target
)
96 set(cf_make_depend_target
, target
);
99 public String
getMkDependTarget()
101 return get_str_def(cf_make_depend_target
, null);
104 public String
getMkDependOutput()
106 return get_str_def(cf_make_depend_output
, null);
109 public void clearMkDependOutput()
111 remove(cf_make_depend_output
);
114 public void setMkDependOutput(String fn
)
116 set(cf_make_depend_output
, fn
);
119 public String
[] getDefines()
121 return get_str_list(cf_compiler_define
);
124 public void addDefine(String def
)
126 add(cf_compiler_define
, def
);
129 public void clearDefine()
131 remove(cf_compiler_define
);
134 public void addDefine(String def
[])
136 add(cf_compiler_define
,def
);
139 public String
[] getSourceFiles()
141 return get_str_list(cf_source
);
144 public void addSourceFile(String fn
)
149 public void clearSourceFile()
154 public void addSourceFile(String fn
[])
159 public void setCompilerCommand(String fn
)
161 System
.err
.println("WARN: setCompilerCommand() is obsolete");
162 set(cf_compiler_command
,fn
);
165 public String
getCompilerCommand()
167 return getConfigStr(cf_compiler_command
);
170 public void clearCompilerCommand()
172 remove(cf_compiler_command
);
175 public void setOutputFile(String fn
)
177 set(cf_output_file
,fn
);
180 public String
getOutputFile()
182 return get(cf_output_file
);
185 public void clearOutputFile()
187 remove(cf_output_file
);
190 public void addIncludeFile(String str
)
192 add(cf_include_file
,str
);
195 public void addIncludeFile(String str
[])
197 add(cf_include_file
,str
);
200 public void addIncludePath(String str
)
202 add(cf_include_path
,str
);
205 public void addIncludePath(String str
[])
207 add(cf_include_path
,str
);
210 public void addIncludePath_enc_sysroot(String str
)
212 addIncludePath(normalizer
.enc_sysroot(str
));
215 public void addIncludePath_enc_sysroot(String str
[])
218 for (int x
=0; x
<str
.length
; x
++)
219 addIncludePath(str
[x
]);
222 public void addIncludePath(UniqueNameList l
)
225 addIncludePath(l
.getNames());
228 public void addPackageImport(PackageInfo pkg
)
233 System
.err
.println(" include_pathes ==> "+pkg
.include_pathes
.toString());
234 System
.err
.println(" include_pathes_private ==> "+pkg
.include_pathes_private
.toString());
235 System
.err
.println(" cflags => "+pkg
.cflags
);
236 System
.err
.println(" cflags_private => "+pkg
.cflags_private
);
238 addIncludePath(pkg
.include_pathes
);
239 addIncludePath(pkg
.include_pathes_private
);
242 public void addPackageImport(PackageInfo pkg
[])
245 for (int x
=0; x
<pkg
.length
; x
++)
246 addPackageImport(pkg
[x
]);
249 public String
[] getIncludePathes()
251 return UniqueValues
.unique(get_str_list(cf_include_path
));
254 public String
[] getIncludeFiles()
256 return UniqueValues
.unique(get_str_list(cf_include_file
));
259 public void clearWarningFlag()
261 System
.err
.println("clearing warning-flag");
262 remove(cf_warning_flag
);
265 public void clearIncludePath()
267 remove(cf_include_path
);
270 public void clearIncludeFile()
272 remove(cf_include_file
);
275 public String
[] getIncludePathes_add_sysroot()
277 String
[] pathes
= getIncludePathes();
278 for (int x
=0; x
<pathes
.length
; x
++)
279 pathes
[x
] = normalizer
.dec_sysroot(pathes
[x
]);