It seems that nobody has got my question correctly.
Let me elaborate.
We have a project package developed from many years that has about 200
files ( c files and header files ). Now we have a tool ( not developed
by us--only executable available with us ) that does take only 1 C
file as input at a time. Now that the whole code is distributed across
files I wanted one single "C" file with all code in it. As some of you
suggested cat or other editors, If I do it manually with these many
lines of code, the order of file, static functions, name clashes
everything is to be taken care off. So I raised a question in this
group asking for a solution.
Its ok for me if the tool does all the pre-processing. But I want a
single "C" file at the end which is as good as the whole package.
Please don't top-post. Your new text should follow any quoted text
from previous articles, as I've done here. Backwards read to
difficult it's.
The first thing I'd do is complain to whoever provided this tool
you're trying to use. C programs of any reasonable size are not, and
should not be, implemented in a single source file. A tool that
requires this is badly broken.
What is the tool supposed to do? If we knew that, we might have a
better idea of how to work around its limitations.
Automatically combining multiple C source files into an equivalent
single file is probably possible, but it's not easy. For example, two
source files in the same program might define static variables or
functions with the same name; joining them into a single file would
require changing at least one of the names and all references to it.
(Detecting all references is non-trivial; there could be declarations
with the same name in nested scopes that shouldn't be changed.)