P
pozz
I'm sorry for the OT, but I don't know where to ask thos kind of
questions. Anyway it's related to the compilation process of C source code.
I have a library that can be compiled in two different ways depending on
the definition of two symbols through #define.
What I'm using is defining the symbol with -D option of the compiler.
So, for the library compiled in MODE1:
cc -DMODE1 mylib.c -o mylib.o
and for the library compiled in MODE2:
cc -DMODE2 mylib.c -o mylib.o
I have a project that should generates two outputs (executables) with
the library statically linked. The output out1 should link the library
in MODE1, the second out2 should link the library in MODE2.
If I issue "make out2" after "make out1" (or the contrary) I have a
problem, because the second compilation doesn't recompile mylib.c,
because it hasn't change since the creation time of mylib.o of the first
compilation. So out2 is wrongly linked to mylib in MODE1.
The only method to compile both outputs is:
make clean
make out1
make clean
make out2
Of course, it's annoying.
Is there a better approach?
questions. Anyway it's related to the compilation process of C source code.
I have a library that can be compiled in two different ways depending on
the definition of two symbols through #define.
What I'm using is defining the symbol with -D option of the compiler.
So, for the library compiled in MODE1:
cc -DMODE1 mylib.c -o mylib.o
and for the library compiled in MODE2:
cc -DMODE2 mylib.c -o mylib.o
I have a project that should generates two outputs (executables) with
the library statically linked. The output out1 should link the library
in MODE1, the second out2 should link the library in MODE2.
If I issue "make out2" after "make out1" (or the contrary) I have a
problem, because the second compilation doesn't recompile mylib.c,
because it hasn't change since the creation time of mylib.o of the first
compilation. So out2 is wrongly linked to mylib in MODE1.
The only method to compile both outputs is:
make clean
make out1
make clean
make out2
Of course, it's annoying.
Is there a better approach?