diff --git a/Makefile b/Makefile
index b4c3bec..3a687cb 100644
--- a/Makefile
+++ b/Makefile
@@ -19,24 +19,16 @@ GITTAG  = $(shell git describe --always 2>/dev/null)
 
 ### The directory environment:
 
-# Use package data if installed...otherwise assume we're under the VDR source directory:
-PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
-LIBDIR = $(call PKGCFG,libdir)
-LOCDIR = $(call PKGCFG,locdir)
-PLGCFG = $(call PKGCFG,plgcfg)
-CFGDIR = $(call PKGCFG,configdir)
-#
 TMPDIR ?= /tmp
 
 ### The compiler options:
 
-export CFLAGS   = $(call PKGCFG,cflags)
-export CXXFLAGS = $(call PKGCFG,cxxflags)
+include $(VDRDIR)/Make.global
 STRIP           ?= /bin/true
 
 ### The version number of VDR's plugin API:
 
-APIVERSION = $(call PKGCFG,apiversion)
+APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
 
 ### Allow user defined options to overwrite defaults:
 
@@ -57,7 +49,7 @@ LIBS = $(shell curl-config --libs)
 
 ### Includes and Defines (add further entries here):
 
-INCLUDES +=
+INCLUDES += -I$(VDRDIR)/include
 
 DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
 
@@ -130,6 +122,7 @@ install-i18n: $(I18Nmsgs)
 $(SOFILE): $(OBJS)
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
 	@$(STRIP) $@
+	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 install-lib: $(SOFILE)
 	install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
