linux - How to use gcc to generate all possible binary files from object files -


does know how use gcc generate possible binary files object files ? know can use : "gcc -mm" generate .o files given source files.

but how use gcc generate possible binary files object files in project ?

example: use "gcc -mm" generate: a.o, b.o, c.o, d.o if 1 trying generate list of binaries files built each of .o files this:

a: b.o c.o d.o b: a.o c.o d.o c: a.o b.o d.o d: a.o b.o b.o 

i can perl script, curious if there way gcc

thanks

short answer, "no, but..."

gcc -mm can give foo.o: bar.h because foo.cc contains directive:

#include "bar.h" 

that's easy. foo.cc can contain declaration:

int bar_f1(int); 

how can gcc know object file contains binary code function? or if there two object files containing functions signature, should use? can't.

...unless...

long answer, "yes, if..."

if refrain giving source files forward declarations of things in other source files, , refrain giving header file declarations of not contained in the corresponding source file, , give source file containing int main(...) fixed name like, say, main.cc, can take output of gcc -mm:

bar.o: bar.h baz.h foo.o: bar.h main.o: foo.h zot.h pan.o: pan.h zot.o: zot.h 

and transform without trouble (using e.g perl or sed) into:

main: bar.o foo.o zot.o 

in theory without these restrictions(*) scanning object files , constructing dependency tree; might equivalent scanning presence of int main(...), segregating files , linking each of them against others, or listing them, if want list of possible executables without dependencies (i'm still not sure want). these things still require scripting on part, know of no way them gcc alone.

(*)you must still refrain having 2 definitions of same thing.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -