Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

GCC dependency generation; keep original targets directory structure for modification

$
0
0

Basically, Im using the command g++ -MM Source/Somefolder/foo.cpp, this will obviously generate an output such as:

foo.o: Source/Somefolder/foo.cpp Source/Somefolder/../base.h \  Source/Somefolder/foo2.h Source/Somefolder/foo.h#... Other targets & dependency's

Im wanting to keep the target's (foo.o: ...) directory structure in proportion to the working directory where g++ has been executed, resulting in this:

Source/Somefolder/foo.o: Source/Somefolder/foo.cpp Source/Somefolder/../base.h \  Source/Somefolder/foo2.h Source/Somefolder/foo.h#... Other targets & dependency's

I would also like to modify the targets value somehow. What would be perfect is regex to extract groups, and some kind of formatting to join them back together. If this cannot be done directly with g++, thats okay, Im sure there is some command that I can execute to modify the output file, or even via pipe to fix this. What would be perfect is regex to extract groups, and some kind of formatting to join them back together. Resulting in this:

Regex: /^.*?\/(.*)$/g
Formatting: Build/%1

Build/Somefolder/foo.o: Source/Somefolder/foo.cpp Source/Somefolder/../base.h \  Source/Somefolder/foo2.h Source/Somefolder/foo.h#... Other targets & dependency's

Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>