r/C_Programming • u/c-smile • Dec 14 '17
Question #include source "foo.c", why not?
If we would have #include source construct that includes compilation units into final assembly (rather than just headers in-place) any library can be included to a project as plain .c file:
// foo-library.c
#include "foo.h"
#include source "foo-a.c"
#include source "foo-b.c"
#if defined(PLATFORM_MACOS)
#include source "foo-mac.c"
#elif defined(PLATFORM_WINDOWS)
#include source "foo-win.c"
#else
#include source "foo-posix.c"
#endifPretty much each popular C/C++ library can be wrapped into such amalgamation files. This will make our life easier - eliminate the need of the whole zoo of build/make systems. At great extent at least.
Yes/no ?
4
Upvotes
View all comments
Show parent comment
1
u/c-smile Dec 17 '17
Oh, thanks for the advice... But did I say anywhere that I don't know how to use makefiles?
I am already compiling my Sciter for five different platforms + maintaining samples for 4 different IDEs.
I am using several external libraries other than my own. I see that zoo each day in real life. As an example: Skia uses GYP build system. Some other library uses premake, another one uses jam ... Legion is the name of them.