Say you have a C project with tons of files, and tons of configurations managed by using the -D
option in GCC to define some flags.
In my particular case, I have loads of files with that kind of stuff:
void foo( sometype *x)
{
do_stuff_with_x(x);
#ifdef MY_FLAG
do_additional_stuff(x);
#endif
#ifdef OTHER_FLAG
do_some_other_stuff(x);
#endif
}
Now, whenever I change one of the flags, I need to clear the project and recompile all the source code because I cannot selectively touch the files that use this flag.
Is it possible, using Eclipse under Windows, to do th开发者_如何学Pythonat? Maybe an Eclipse plugins, or whatever.
For linux, I might use some mix of grep
, find
and touch
, but on Windows I have no idea.
Okay, under people pressure, I installed MSYS and used a command like this one:
$ find . -name "*.c" -or -name "*.h" | xargs grep "MYFLAG" -q -l | xargs touch
You can actually add some other filters to find
to tune more finely your touched files.
I didn't know xargs
, any idea on my command line?
If you have already cooked up a solution for Unix with grep, find and touch, why don't you do the same on Windows? You can use msys and the unix tools that come with it.
I don't have an Eclipse installation on the machine I am at the moment, but I'm sure you can launch a batch from Eclipse
Why wouldn't you use a mix of grep, find, and touch on Windows too?
http://unxutils.sourceforge.net/
精彩评论