From a5e2d9e5baf869ae961fbb5820447290d6d9c7c8 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 26 Apr 2011 21:55:48 -0700 Subject: volk: reorganization of generation sources and generated files All generation sources have been moved to the gen/ subdirectory. Bootstrap and volk_register.py generate the files into to gen/ subdirectory in an effort to cleanly separate the static/generated parts of the build tree. Define top_gendir in Makefile.common, all generated sources listed in Makefile.ams are prefixed with $(top_gendir) to differentiate them from static in-tree sources. --- volk/gen/make_machines_c.py | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 volk/gen/make_machines_c.py (limited to 'volk/gen/make_machines_c.py') diff --git a/volk/gen/make_machines_c.py b/volk/gen/make_machines_c.py new file mode 100644 index 000000000..9ad56fb62 --- /dev/null +++ b/volk/gen/make_machines_c.py @@ -0,0 +1,57 @@ +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +from volk_regexp import * + +def make_machines_c(machines): + tempstring = r""" +// This file is automatically generated by make_machines_c.py. +// Do not edit this file. + +#include +#include +#include + +struct volk_machine volk_machines[] = { +""" + for machine in machines: + tempstring += """#if LV_MACHINE_""" + machine.swapcase() + "\n" + tempstring += "volk_machine_" + machine + tempstring += "," + tempstring += "\n#endif\n" + + tempstring += r""" +}; + +""" + + for machine in machines: + tempstring += "#if LV_MACHINE_" + machine.swapcase() + "\n" + tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 1\n" + tempstring += "#else\n" + tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 0\n" + tempstring += "#endif\n" + + tempstring += """unsigned int n_volk_machines = +""" + for machine in machines: + tempstring += "(LV_MACHINE_" + machine.swapcase() + "_CNT) " + tempstring += "+ " + tempstring = tempstring[:-2] + tempstring += ";\n" + + return tempstring -- cgit From 701b1c520865388a4287c6a3f63afb3ce2626cf1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 5 May 2011 19:02:03 -0700 Subject: volk: make volk_machines.cc c-safe Initialize the list of machine structs w/ pointers, this does not rely on C++ initialization and is smaller. In addition, rename the file extension to .c so we know its C only. Interesting note, this also fixes a bug when compiling under MSVC, the machines list initialization seemed to have problems prior to this change. --- volk/gen/make_machines_c.py | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'volk/gen/make_machines_c.py') diff --git a/volk/gen/make_machines_c.py b/volk/gen/make_machines_c.py index 9ad56fb62..ccac21131 100644 --- a/volk/gen/make_machines_c.py +++ b/volk/gen/make_machines_c.py @@ -1,5 +1,5 @@ # -# Copyright 2010 Free Software Foundation, Inc. +# Copyright 2010-2011 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,32 +26,16 @@ def make_machines_c(machines): #include #include -struct volk_machine volk_machines[] = { +struct volk_machine *volk_machines[] = { """ for machine in machines: tempstring += """#if LV_MACHINE_""" + machine.swapcase() + "\n" - tempstring += "volk_machine_" + machine + tempstring += "&volk_machine_" + machine tempstring += "," tempstring += "\n#endif\n" tempstring += r""" }; - -""" - - for machine in machines: - tempstring += "#if LV_MACHINE_" + machine.swapcase() + "\n" - tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 1\n" - tempstring += "#else\n" - tempstring += "#define LV_MACHINE_" + machine.swapcase() + "_CNT 0\n" - tempstring += "#endif\n" - - tempstring += """unsigned int n_volk_machines = +unsigned int n_volk_machines = sizeof(volk_machines)/sizeof(*volk_machines); """ - for machine in machines: - tempstring += "(LV_MACHINE_" + machine.swapcase() + "_CNT) " - tempstring += "+ " - tempstring = tempstring[:-2] - tempstring += ";\n" - return tempstring -- cgit From 9bfe75fd7c6a7069db2d2a98195faabf6ba248e2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 13 May 2011 13:58:01 -0700 Subject: volk: do not install library-only headers --- volk/gen/make_machines_c.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'volk/gen/make_machines_c.py') diff --git a/volk/gen/make_machines_c.py b/volk/gen/make_machines_c.py index ccac21131..a7ab63d6e 100644 --- a/volk/gen/make_machines_c.py +++ b/volk/gen/make_machines_c.py @@ -24,7 +24,7 @@ def make_machines_c(machines): #include #include -#include +#include "volk_machines.h" struct volk_machine *volk_machines[] = { """ -- cgit