I am running a programming course and want to distribute executable binaries of the model solution of the programming assignment, not the source. The problem model solution requires macros to be altered, which affect the behaviour of the program, which affects what the source code looks like for the compiler.
Instead of distributing multiple binaries or rewriting the code; is there a way to compile for all possible post pre-processor source code and allow the user to alter the macros in a separate header file? In this way I could distribute a single object file and a separate header file which could be linked by the user without them seeing the original source.
my_code.c (which will be distributed as .o object file)
my_header.h (a possible user header)Code://code #ifdef DEBUG print debug info #endif //more code #ifdef CLEAN_UP clean up #else dont clean up #endif
my_header.h (another possible user header)Code://#define DEBUG #define CLEAN_UP
Code:#define DEBUG #define CLEAN_UP