From 1508f6b488de263842e330bd88436bded8af59ce Mon Sep 17 00:00:00 2001 From: invertego Date: Wed, 29 Mar 2023 19:01:57 -0700 Subject: [PATCH] nall: split main.cpp into separate translation unit When using nall as a header-only library it was possible to opt out of nall taking over main() by simply not including main.hpp. There was no mechanism to opt out when building nall as a separate translation unit because nall.cpp unconditionally pulled in main.cpp. Now, users of nall must specifically opt in by including main.cpp in their build (though header-only users still only need to include main.hpp). --- nall/GNUmakefile | 4 +++- nall/main.cpp | 1 + nall/nall.cpp | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nall/GNUmakefile b/nall/GNUmakefile index 8d1abea24..84304bdb3 100644 --- a/nall/GNUmakefile +++ b/nall/GNUmakefile @@ -422,6 +422,8 @@ else endif # objects -nall.objects := $(object.path)/nall.o +nall.objects := nall nall-main +nall.objects := $(nall.objects:%=$(object.path)/%.o) $(object.path)/nall.o: $(nall.path)/nall.cpp +$(object.path)/nall-main.o: $(nall.path)/main.cpp diff --git a/nall/main.cpp b/nall/main.cpp index 37b7a5ee3..c11cf2ad0 100644 --- a/nall/main.cpp +++ b/nall/main.cpp @@ -1,6 +1,7 @@ #include #if defined(PLATFORM_WINDOWS) + #include #include #include #include diff --git a/nall/nall.cpp b/nall/nall.cpp index db1ca7fde..33e6ef9d3 100644 --- a/nall/nall.cpp +++ b/nall/nall.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include