From 0caadec8b8da8d8da20919270a8af3cfe50086a4 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 4 Oct 2005 06:24:33 +0000
Subject: [PATCH] Include SDLMain in ciolib library on OSX.

---
 src/conio/Common.gmake |  2 +-
 src/conio/GNUmakefile  | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/conio/Common.gmake b/src/conio/Common.gmake
index 61dcfcfc5b..64f1f06939 100644
--- a/src/conio/Common.gmake
+++ b/src/conio/Common.gmake
@@ -43,7 +43,7 @@ ifdef USE_SDL
    ifeq ($(os),darwin)
     CIOLIB-MT_CFLAGS	+=	-DWITH_SDL
     CIOLIB-MT_CFLAGS	+=	-I/Library/Frameworks/SDL.framework/Headers
-    CIOLIB-MT_LIBS	+=	$(SRC_ROOT)$(DIRSEP)conio$(DIRSEP)SDLMain.m -framework SDL -framework Cocoa -I/Library/Frameworks/SDL.framework/Headers
+    CIOLIB-MT_LIBS	+=	-framework SDL -framework Cocoa -I/Library/Frameworks/SDL.framework/Headers
    endif
   endif
  endif
diff --git a/src/conio/GNUmakefile b/src/conio/GNUmakefile
index 59c6ba9dcd..1f846dd182 100644
--- a/src/conio/GNUmakefile
+++ b/src/conio/GNUmakefile
@@ -21,6 +21,18 @@ ifeq ($(os),netbsd)
  CFLAGS	+=	-DN_CURSES_LIB
 endif
 
+ifeq ($(os),darwin)
+ ifdef WITH_SDL
+  OBJS	+=	$(MTOBJODIR)$(DIRSEP)SDLMain$(OFILE)
+ endif
+endif
+
+ifeq ($(os),darwin)
+$(MTOBJODIR)$(DIRSEP)SDLMain$(OFILE): SDLMain.m
+	@echo $(COMPILE_MSG) $<
+	$(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) -o $@ -c $<
+endif
+
 $(MTOBJODIR)$(DIRSEP)console$(OFILE).static:
 	$(QUIET)$(DELETE) $(MTOBJODIR)$(DIRSEP)console$(OFILE)*
 	$(QUIET)touch $(MTOBJODIR)$(DIRSEP)console$(OFILE).static
-- 
GitLab