I am trying to write a program that will play a game using strategies that I can easily modify and compile in multiple directories. Most of the source files of the game are immutable (i.e. they remain the same even when strategies are altered). Say my source files are a.c, b.c, c.c, d.c, e.c, where a.c through d.c are immutable and e.c is the only file that varies between different strategies. In addition, a.c makes a call to e.c, so they can't be fully compiled independently without invoking an undefined function error.
Is there any way to compile (cc/gcc/etc.) a.c through d.c into a single file, everything.o, that I can then compile with the missing e.c?
> <command here> everything.o a.c b.c c.c d.c
> cc -g -o e.o e.c
> cc -g -o foo.o everything.o e.o
where I can copy everything.o into different directories so that I can have programs to run different strategies, without copying all four (in my case, ~20) files into each directory?