DP_ARCH:=$(shell uname)
ifneq ($(filter %BSD,$(DP_ARCH)),)
DP_MAKE_TARGET=bsd
+else
+ifeq ($(DP_ARCH), Darwin)
+ DP_MAKE_TARGET=macosx
else
DP_MAKE_TARGET=linux
-endif
-endif
-
-endif
+endif # ifeq ($(DP_ARCH), Darwin)
+endif # ifneq ($(filter %BSD,$(DP_ARCH)),)
+endif # ifdef windir
+endif # ifndef DP_MAKE_TARGET
# If we're not on compiling for Win32, we need additional information
ifneq ($(DP_MAKE_TARGET), mingw)
EXE_SDL=$(EXE_UNIXSDL)
endif
+# Mac OS X configuration
+ifeq ($(DP_MAKE_TARGET), macosx)
+ OBJ_SOUND=$(OBJ_MACOSXSOUND)
+ LIB_SOUND=$(LIB_MACOSXSOUND)
+ OBJ_CD=$(OBJ_MACOSXCD)
+
+ OBJ_CL=$(OBJ_AGL)
+
+ LDFLAGS_CL=$(LDFLAGS_MACOSXCL)
+ LDFLAGS_SV=$(LDFLAGS_MACOSXSV)
+ LDFLAGS_SDL=$(LDFLAGS_MACOSXSDL)
+
+ EXE_CL=$(EXE_UNIXCL)
+ EXE_SV=$(EXE_UNIXSV)
+ EXE_SDL=$(EXE_UNIXSDL)
+endif
+
# BSD configuration
ifeq ($(DP_MAKE_TARGET), bsd)
ifeq ($(DP_ARCH),FreeBSD)
LDFLAGS_LINUXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
+##### Mac OS X specific variables #####
+
+#OBJ_MACOSXSOUND=$(OBJ_COMMONSOUND) snd_coreaudio.c
+OBJ_MACOSXSOUND=$(OBJ_NOSOUND)
+LIB_MACOSXSOUND=
+
+# If you want CD sound in Mac OS X
+#OBJ_MACOSXCD=cd_macosx.o
+# If you want no CD audio
+OBJ_MACOSXCD=$(OBJ_NOCD)
+
+# Link
+LDFLAGS_MACOSXCL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXCL)
+LDFLAGS_MACOSXSV=$(LDFLAGS_UNIXCOMMON) -ldl
+LDFLAGS_MACOSXSDL=$(LDFLAGS_UNIXCOMMON) -ldl $(LDFLAGS_UNIXSDL)
+
+OBJ_AGL= builddate.c sys_linux.o vid_agl.o $(OBJ_SOUND) $(OBJ_CD) $(OBJ_COMMON)
+
+
##### BSD specific variables #####
OBJ_BSDSOUND=$(OBJ_COMMONSOUND) snd_bsd.o