I am currently developing a C project under Linux and Win32. The 'deliverable' is a shared library, and all the development is done under Linux with the GNU tool chain. I am using a Makefile to compile the shared library.
Every now and then I have to build a .dll under Win32 from the same src.
I've installed MinGW on the Win32 box such that I can use make and get far fewer complaints from the compiler (in comparison to MSVC). I'm at a stage where the src code compiles on both platforms
But the Linux Makefile and Win32 Makefile are different. I'm curious as how to best handle this – should I:
-
have 2 makefiles, e.g. Makefile for linux and Makefile.WIN32 and then run
make -f Makefile.WIN32
on the Windows box -
Should I make a different target in a single Makefile and do something like
make WIN32
on the Windows box -
Should I ditch make and use CMake (is the juice worth the squeeze for such a simple project, i.e. 1 shared library)
Best Answer
Use a single make file and put the platform-specifics in conditionals, eg