Close -- you'll end up with one (large) h264.c
(if there are any headers) in a directory h265
, and one gsm.c
and one hsm.h
(ditto) in another directory gsm
(if I understood the question correctly that is).
Yes, you can include the headers in one file at the begging of your .c
, but you'd need to go through the entire .c
file and remove all the #include
directives for local
header files -- the difference is
#include <stdio.h> means it's in /include, /usr/include or similar
#incldue "file.h" means it is the local directory tree
Lot's of screwing around to little effect (including a header file is trivial during the compilation process. Note, though, that you'll probably need to edit out all of the #include
directives in any event from your giant .c
; it's quite likely that header files will get included multiple times and you don't want that (it'll be messy at least).
What you can do is use, say, sed
to create a little file of all the header directives, something like this
<after you've created the giant .c file>
sed -n '/#include/p' | uniq > file_name
That will give you a list of the include directives that you can insert (with a text editor) at the begging of the .c
file -- after
you've done this
sed '/#include/d' gsm.c > gsm_new.c
That will delete all the include directives, saving the result in gsm_new.c
. Then just edit gsm_new.c
and read the unique header list in at the top of it.
There are, of course, other ways to do that (regular expressions is one) but the above is quick and easy.
Again, this is not going to be trivial -- when you first try to compile this thing it's probably going to spit out a whole lot of errors and you're most likely going to be doing a whole lot of editing and moving things around before you'll get a clean compile. Make sure you keep back up copies before you edit things.
Hope this helps some.