Index: Makefile
===================================================================
RCS file: /cvsroot/xineliboutput/vdr-xineliboutput/Makefile,v
retrieving revision 1.21
diff -U2 -r1.21 Makefile
--- Makefile	22 Jan 2007 18:37:21 -0000	1.21
+++ Makefile	30 Mar 2007 17:41:45 -0000
@@ -39,4 +39,5 @@
 endif
 
+APPLE_DARWIN = $(shell gcc -dumpmachine | grep -q 'apple-darwin' && echo "1" || echo "0")
 
 #
@@ -67,8 +68,18 @@
 CXX      ?= g++
 OPTFLAGS ?= 
-CXXFLAGS ?= -O3 -pipe -Wall -Woverloaded-virtual -fPIC -g 
+#CXXFLAGS ?= -O3 -pipe -Wall -Woverloaded-virtual -fPIC -g 
 
 CC     ?= gcc 
-CFLAGS ?= -O3 -pipe -Wall -fPIC -g
+#CFLAGS ?= -O3 -pipe -Wall -fPIC -g
+
+ifeq ($(APPLE_DARWIN), 1)
+    CXXFLAGS   ?= -O3 -pipe -Wall -Woverloaded-virtual -fPIC -g -fno-common -bundle -flat_namespace -undefined suppress
+    CFLAGS     ?= -O3 -pipe -Wall -fPIC -g -fno-common -bundle -flat_namespace -undefined suppress
+    LDFLAGS_SO ?= -fvisibility=hidden
+else
+    CXXFLAGS   ?= -O3 -pipe -Wall -Woverloaded-virtual -fPIC -g 
+    CFLAGS     ?= -O3 -pipe -Wall -fPIC -g
+    LDFLAGS_SO ?= -shared -fvisibility=hidden 
+endif
 
 
@@ -98,5 +109,12 @@
 ###
 
-VDRVERSION = $(shell sed -ne '/define VDRVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h)
+ifeq ($(APPLE_DARWIN), 1)
+    VDRVERSION = $(shell sed -ne '/define VDRVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
+    APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
+else
+    VDRVERSION = $(shell sed -ne '/define VDRVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h)
+    APIVERSION = $(shell sed -ne '/define APIVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h)
+endif
+
 ifeq ($(strip $(VDRVERSION)),)
     $(warning ********************************************************)
@@ -105,6 +123,4 @@
     XINELIBOUTPUT_VDRPLUGIN = 0
 else
-    ### The version number of VDR's plugin API (taken from VDR's "config.h"):
-    APIVERSION = $(shell sed -ne '/define APIVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h)
     ifeq ($(strip $(APIVERSION)),)
         $(warning VDR APIVERSION missing, using VDRVERSION $(VDRVERSION) )
@@ -185,5 +201,11 @@
 LIBS_X11  += -L/usr/X11R6/lib -lX11 -lXv -lXext
 
-LIBS      += -lrt
+ifeq ($(APPLE_DARWIN), 1)
+    INCLUDES  += -I/sw/include
+    LIBDIRS   += -L/sw/lib
+    LIBS      += $(LIBDIRS) -ljpeg -liconv
+else
+    LIBS      += -lrt
+endif
 
 DEFINES   += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' \
@@ -355,5 +377,5 @@
 ifeq ($(XINELIBOUTPUT_VDRPLUGIN), 1)
 $(VDRPLUGIN_SO): $(OBJS) $(OBJS_MPG)
-	$(CXX) $(CXXFLAGS) -shared -fvisibility=hidden $(OBJS) $(OBJS_MPG) $(LIBS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS_SO) $(OBJS) $(OBJS_MPG) $(LIBS) -o $@
 	@-rm -rf $(LIBDIR)/$@.$(APIVERSION)
 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
@@ -362,5 +384,5 @@
 ifeq ($(XINELIBOUTPUT_X11), 1)
 $(VDRPLUGIN_SXFE_SO): $(OBJS_SXFE_SO)
-	$(CC) $(CFLAGS) -shared -fvisibility=hidden $(OBJS_SXFE_SO) $(LIBS_X11) $(LIBS_XINE) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS_SO) $(OBJS_SXFE_SO) $(LIBS_X11) $(LIBS_XINE) -o $@
 	@-rm -rf $(LIBDIR)/$(VDRPLUGIN_SXFE_SO).$(VERSION)
 	@cp $@ $(LIBDIR)/$(VDRPLUGIN_SXFE_SO).$(VERSION)
@@ -371,5 +393,5 @@
 ifeq ($(XINELIBOUTPUT_FB), 1)
 $(VDRPLUGIN_FBFE_SO): $(OBJS_FBFE_SO)
-	$(CC) $(CFLAGS) -shared -fvisibility=hidden $(OBJS_FBFE_SO) $(LIBS_XINE) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS_SO) $(OBJS_FBFE_SO) $(LIBS_XINE) -o $@
 	@-rm -rf $(LIBDIR)/$(VDRPLUGIN_FBFE_SO).$(VERSION)
 	@cp $@ $(LIBDIR)/$(VDRPLUGIN_FBFE_SO).$(VERSION)
@@ -380,13 +402,13 @@
 ifeq ($(XINELIBOUTPUT_XINEPLUGIN), 1)
 $(XINEINPUTVDR_SO): xine_input_vdr.o
-	$(CC) -g -shared -fvisibility=hidden xine_input_vdr.o $(LIBS_XINE) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS_SO) xine_input_vdr.o $(LIBS_XINE) -o $@
 $(XINEPOSTAUTOCROP_SO): xine_post_autocrop.o
-	$(CC) -g -shared -fvisibility=hidden xine_post_autocrop.o $(LIBS_XINE) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS_SO) xine_post_autocrop.o $(LIBS_XINE) -o $@
 $(XINEPOSTAUDIOCHANNEL_SO): xine_post_audiochannel.o
-	$(CC) -g -shared -fvisibility=hidden xine_post_audiochannel.o $(LIBS_XINE) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS_SO) xine_post_audiochannel.o $(LIBS_XINE) -o $@
 endif
 ifeq ($(ENABLE_TEST_POSTPLUGINS), 1)
 $(XINEPOSTHEADPHONE_SO): xine_post_headphone.o
-	$(CC) -g -shared -fvisibility=hidden xine_post_headphone.o $(LIBS_XINE) -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS_SO) xine_post_headphone.o $(LIBS_XINE) -o $@
 endif
 
