diff --git a/Makefile b/Makefile index b9b76837c7..88bef5f0d4 100644 --- a/Makefile +++ b/Makefile @@ -56,11 +56,11 @@ ifeq ($(DEBUG), 1) endif CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I. -CXXFLAGS = -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS +CXXFLAGS := $(CFLAGS) -std=c++0x -D__STDC_CONSTANT_MACROS ifeq ($(CXX_BUILD), 1) LINK = $(CXX) - CFLAGS += $(CXXFLAGS) + CFLAGS := $(CXXFLAGS) -xc++ else ifeq ($(findstring Win32,$(OS)),) LINK = $(CC) @@ -80,9 +80,11 @@ endif ifeq ($(NOUNUSED), yes) CFLAGS += -Wno-unused-result + CXXFLAGS += -Wno-unused-result endif ifeq ($(NOUNUSED_VARIABLE), yes) CFLAGS += -Wno-unused-variable + CXXFLAGS += -Wno-unused-variable endif RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ)) @@ -103,11 +105,7 @@ retroarch: $(RARCH_OBJ) $(JTARGET): $(RARCH_JOYCONFIG_OBJ) @$(if $(Q), $(shell echo echo LD $@),) -ifeq ($(CXX_BUILD), 1) - $(Q)$(CXX) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS) -else - $(Q)$(CC) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS) -endif + $(Q)$(LINK) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS) tools/retrolaunch/retrolaunch: $(RARCH_RETROLAUNCH_OBJ) @$(if $(Q), $(shell echo echo LD $@),) @@ -121,7 +119,7 @@ $(OBJDIR)/%.o: %.c config.h config.mk $(OBJDIR)/%.o: %.cpp @mkdir -p $(dir $@) @$(if $(Q), $(shell echo echo CXX $<),) - $(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $< + $(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $< .FORCE: diff --git a/frontend/frontend.c b/frontend/frontend.c index 378f13b011..32b8a25c41 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -18,8 +18,6 @@ #include "frontend.h" #include "../general.h" -#include "frontend_context.h" - #if defined(HAVE_MENU) #include "menu/menu_input_line_cb.h" #include "menu/menu_common.h" @@ -31,7 +29,6 @@ #if defined(ANDROID) -#define main_entry android_app_entry #define returntype void #define returnfunc() exit(0) #define return_negative() return @@ -41,12 +38,6 @@ #define args_initial_ptr() data #else -#if defined(__APPLE__) || defined(HAVE_BB10) || defined(EMSCRIPTEN) -#define main_entry rarch_main -#else -#define main_entry main -#endif - #define returntype int #define returnfunc() return 0 #define return_negative() return 1 diff --git a/frontend/frontend_context.h b/frontend/frontend_context.h index e51466dad9..9bde1ef795 100644 --- a/frontend/frontend_context.h +++ b/frontend/frontend_context.h @@ -26,11 +26,17 @@ #if defined(ANDROID) #include "platform/platform_android.h" +#define main_entry android_app_entry #define args_type() struct android_app* #define signature() void* data #define signature_expand() data #define returntype void #else +#if defined(__APPLE__) || defined(HAVE_BB10) || defined(EMSCRIPTEN) +#define main_entry rarch_main +#else +#define main_entry main +#endif #define args_type() void* #define signature() int argc, char *argv[] #define signature_expand() argc, argv diff --git a/tools/retrolaunch/main.c b/tools/retrolaunch/main.c index 8de0da09b7..c70270a4e7 100644 --- a/tools/retrolaunch/main.c +++ b/tools/retrolaunch/main.c @@ -281,6 +281,9 @@ int detect_file(const char *path, char *game_name, size_t max_len, } #ifndef RARCH_CONSOLE +#ifndef __APPLE__ +#undef main +#endif int main(int argc, char *argv[]) { struct RunInfo info;