1

So we have for example ffmpeg that can be compiled into > than 4 libraries. Is it possible using GCC to compile\collect not into .a or .so libraries but into some wary large one C files?

Rella
  • 65,003
  • 109
  • 363
  • 636

2 Answers2

1

Funny question, why would you want to do this? Anyway, you can try and see whether gcc -E does what you want - it only invokes the preprocessor. So you might have to adapt the source code to include other source code files.

MiLu@Dago: ~ > cat x.c
int x_num() {
        return 7;
}
MiLu@Dago: ~ > cat moin.c
#include <stdio.h>
#include "x.c"
int main() {
        printf("moin: %d\n", x_num());
        return 0;
}
MiLu@Dago: ~ > gcc -E moin.c | wc -l
1150

I think I'd rather try the cat utility:

find -type f -name \*.c | xargs cat > all_my.c

Still, what are you trying to achieve?

Lumi
  • 14,775
  • 8
  • 59
  • 92
  • I have a small problem with ffmpeg compilation with costume compiler... ( http://stackoverflow.com/questions/6317816/how-to-compile-ffmpeg-via-alchemy-gcc ) so I want to do such thing to have fight with one file instead of many.) – Rella Jun 11 '11 at 19:39
1

You may use cpp with -M family of arguments to generate a make file describing the code dependencies, then add a rule for .c and .h files to append content to the same file.

If the application is not using #ifdef guards within .h files it may cause warnings about macros defined twice.

Pablo Castellazzi
  • 4,164
  • 23
  • 20