[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [5655] add params to modules
From: |
Gautier Hattenberger |
Subject: |
[paparazzi-commits] [5655] add params to modules |
Date: |
Tue, 24 Aug 2010 12:21:15 +0000 |
Revision: 5655
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5655
Author: gautier
Date: 2010-08-24 12:21:15 +0000 (Tue, 24 Aug 2010)
Log Message:
-----------
add params to modules
Modified Paths:
--------------
paparazzi3/trunk/conf/airframes/airframe.dtd
paparazzi3/trunk/sw/tools/gen_aircraft.ml
Modified: paparazzi3/trunk/conf/airframes/airframe.dtd
===================================================================
--- paparazzi3/trunk/conf/airframes/airframe.dtd 2010-08-24 12:19:28 UTC
(rev 5654)
+++ paparazzi3/trunk/conf/airframes/airframe.dtd 2010-08-24 12:21:15 UTC
(rev 5655)
@@ -21,7 +21,7 @@
<!ELEMENT linear EMPTY>
<!ELEMENT makefile (#PCDATA)>
<!ELEMENT modules (load)*>
-<!ELEMENT load EMPTY>
+<!ELEMENT load (param)*>
<!ELEMENT param EMPTY>
<!ELEMENT firmware (target|subsystem)*>
<!ELEMENT target (param|define)*>
Modified: paparazzi3/trunk/sw/tools/gen_aircraft.ml
===================================================================
--- paparazzi3/trunk/sw/tools/gen_aircraft.ml 2010-08-24 12:19:28 UTC (rev
5654)
+++ paparazzi3/trunk/sw/tools/gen_aircraft.ml 2010-08-24 12:21:15 UTC (rev
5655)
@@ -69,7 +69,7 @@
let get_modules = fun dir m ->
match String.lowercase (Xml.tag m) with
- "load" -> dir // ExtXml.attrib m "name"
+ "load" -> (dir // ExtXml.attrib m "name", Xml.children m)
| tag -> failwith (sprintf "Warning: tag load is undefined; found '%s'" tag)
@@ -83,14 +83,14 @@
let files = ref [] in
List.iter (fun x ->
if ExtXml.tag_is x "modules" then
- let modules_names =List.map (get_modules modules_dir) (Xml.children x) in
- List.iter (fun name -> files := name :: !files) modules_names;
- let modules_list = List.map Xml.parse_file modules_names in
+ let modules_names = List.map (get_modules modules_dir) (Xml.children x)
in
+ List.iter (fun (name,_) -> files := name :: !files) modules_names;
+ let modules_list = List.map (fun (m,p) -> (Xml.parse_file m, p))
modules_names in
(* Print modules directories and includes for all targets *)
fprintf f "\n# include modules directory for all targets\n";
let target_list = ref [] in
let dir_list = ref [] in
- List.iter (fun m ->
+ List.iter (fun (m,_) ->
let dir = try Xml.attrib m "dir" with _ -> ExtXml.attrib m "name" in
dir_list := List.merge String.compare !dir_list [dir];
List.iter (fun l ->
@@ -98,20 +98,33 @@
target_list := List.merge String.compare !target_list
(targets_of_field l);
) (Xml.children m)
) modules_list;
- List.iter (fun target -> fprintf f "%s.CFLAGS += -I modules\n" target)
!target_list;
+ List.iter (fun target -> fprintf f "%s.CFLAGS += -I modules -I
arch/$(ARCH)/modules\n" target) !target_list;
List.iter (fun dir -> let dir_name = (String.uppercase dir)^"_DIR" in
fprintf f "%s = modules/%s\n" dir_name dir) !dir_list;
(* Parse each makefile *)
- List.iter (fun modul ->
+ List.iter (fun (modul,params) ->
let name = ExtXml.attrib modul "name" in
let dir = try Xml.attrib modul "dir" with _ -> name in
let dir_name = (String.uppercase dir)^"_DIR" in
+ (* Extract the list of all the targes for this module *)
+ let module_target_list = ref [] in
+ List.iter (fun l ->
+ if ExtXml.tag_is l "makefile" then module_target_list := List.merge
String.compare !module_target_list (targets_of_field l)
+ ) (Xml.children modul);
fprintf f "\n# makefile for module %s\n" name;
- (*fprintf f "%s = modules/%s\n" dir_name name;*)
+ (* Print parameters as global copilation defines *)
+ List.iter (fun target ->
+ List.iter (fun param -> try
+ let name = Xml.attrib param "name"
+ and value = Xml.attrib param "value" in
+ fprintf f "%s.CFLAGS += -D%s=%s\n" target name value
+ with _ -> ()
+ ) params
+ ) !module_target_list;
+ (* Look for makefile section *)
List.iter (fun l ->
if ExtXml.tag_is l "makefile" then begin
let targets = targets_of_field l in
- (* build the list of all the targets *)
- (*List.iter (fun t -> fprintf f "%s.CFLAGS += -I $(%s)\n" t
dir_name ) targets;*)
+ (* Look for defines, flags, files, ... *)
List.iter (fun field ->
match String.lowercase (Xml.tag field) with
"flag" ->
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [5655] add params to modules,
Gautier Hattenberger <=