--- a/Makefile
+++ b/Makefile
@@ -41,8 +41,8 @@ CXXFLAGS ?= -g -O2 -W -Wall -Wextra -Wer
 
 ### The directory environment:
 
-VDRDIR ?= ../../..
-LIBDIR ?= ../../lib
+VDRDIR = /usr/local/include/vdr
+LIBDIR = ../lib
 TMPDIR ?= /tmp
 
 ### Make sure that necessary options are included:
@@ -72,7 +72,7 @@ DEFINES += $(CONFIG) -D_GNU_SOURCE -DPLU
 _CFLAGS = $(DEFINES) $(INCLUDES) \
 	$(shell pkg-config --cflags libavcodec) \
 	`pkg-config --cflags x11 x11-xcb xcb xcb-xv xcb-shm xcb-dpms xcb-atom\
-		xcb-screensaver xcb-randr xcb-glx xcb-icccm xcb-keysyms`\
+		xcb-screensaver xcb-randr xcb-glx xcb-keysyms`\
 	`pkg-config --cflags gl glu` \
 	$(if $(findstring USE_VDPAU,$(CONFIG)), \
 		    `pkg-config --cflags vdpau`) \
@@ -88,7 +88,7 @@ override CFLAGS	  += $(_CFLAGS)
 LIBS += -lrt \
 	$(shell pkg-config --libs libavcodec) \
 	`pkg-config --libs x11 x11-xcb xcb xcb-xv xcb-shm xcb-dpms xcb-atom\
-		xcb-screensaver xcb-randr xcb-glx xcb-icccm xcb-keysyms`\
+		xcb-screensaver xcb-randr xcb-glx xcb-keysyms`\
 	`pkg-config --libs gl glu` \
 	$(if $(findstring USE_VDPAU,$(CONFIG)), \
 		    `pkg-config --libs vdpau`) \
@@ -113,7 +113,7 @@ all: libvdr-$(PLUGIN).so i18n
 
 ### Dependencies:
 
-MAKEDEP = $(CC) -MM -MG
+MAKEDEP = $(CC) -MM # # # -MG
 DEPFILE = .dependencies
 $(DEPFILE): Makefile
 	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(SRCS) >$@
@@ -125,7 +125,7 @@ $(OBJS): Makefile
 ### Internationalization (I18N):
 
 PODIR	  = po
-LOCALEDIR = $(VDRDIR)/locale
+LOCALEDIR = ../locale
 I18Npo	  = $(wildcard $(PODIR)/*.po)
 I18Nmsgs  = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
 I18Npot	  = $(PODIR)/$(PLUGIN).pot
@@ -153,7 +153,11 @@ i18n: $(I18Nmsgs) $(I18Npot)
 
 libvdr-$(PLUGIN).so: $(OBJS) Makefile
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -fPIC $(OBJS) -o $@ $(LIBS)
+ifdef FREEBSD
+	@cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
+else
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
+endif
 
 dist: $(I18Npo) clean
 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
@@ -166,9 +170,17 @@ dist: $(I18Npo) clean
 clean:
 	@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
 
+#install:	libvdr-$(PLUGIN).so
+#	cp --remove-destination libvdr-$(PLUGIN).so \
+#		/usr/lib/vdr/plugins/libvdr-$(PLUGIN).so.$(APIVERSION)
+
 install:	libvdr-$(PLUGIN).so
+ifdef FREEBSD
+	${INSTALL_PROGRAM} libvdr-$(PLUGIN).so ${DESTDIR}$(PREFIX)/lib/vdr/libvdr-$(PLUGIN).so.$(APIVERSION)
+else
 	cp --remove-destination libvdr-$(PLUGIN).so \
 		/usr/lib/vdr/plugins/libvdr-$(PLUGIN).so.$(APIVERSION)
+endif
 
 HDRS=	$(wildcard *.h)
 
