diff --git a/include/package.mk b/include/package.mk
index dd70128c8fe1f18c255bbd5a0131dca695e784c3..51daa860444c3101379287bab352504c9f19b234 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -293,6 +293,7 @@ define Build/Configure/Default
 		CXXFLAGS="$(TARGET_CFLAGS)" \
 		CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
 		LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
+		PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
 		PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
 		$(2) \
 		$(PKG_CONFIG_PATH)/configure \
@@ -322,11 +323,12 @@ define Build/Configure
 endef
 
 define Build/Compile/Default
+	CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
+	LDFLAGS="$(EXTRA_LDFLAGS) " \
 	$(MAKE) -C $(PKG_BUILD_DIR) \
 		$(TARGET_CONFIGURE_OPTS) \
 		CROSS="$(TARGET_CROSS)" \
-		EXTRA_CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include " \
-		EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib " \
+		CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS) " \
 		ARCH="$(ARCH)" \
 		$(1);
 endef
diff --git a/package/isakmpd/Makefile b/package/isakmpd/Makefile
index 628b97fd9493e90c2e3aa85f27561dd2301a2206..d7220522ac6b8bd8a55ee91aa828b77ad5ad89be 100644
--- a/package/isakmpd/Makefile
+++ b/package/isakmpd/Makefile
@@ -32,11 +32,13 @@ define Package/isakmpd
 endef
 
 define Build/Compile
-	$(call Build/Compile/Default, \
+	CFLAGS="$(TARGET_CFLAGS)" \
+	$(MAKE) -C $(PKG_BUILD_DIR) \
+		$(TARGET_CONFIGURE_OPTS) \
 		LINUX_DIR="$(LINUX_DIR)" \
-		EXTRA_CPPFLAGS="-I$(STAGING_DIR)/usr/include/openssl -I$(STAGING_DIR)/usr/include/keynote  -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
-		EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
-	)
+		EXTRA_CPPFLAGS="-I$(STAGING_DIR)/usr/include/openssl -I$(STAGING_DIR)/usr/include/keynote -I$(STAGING_DIR)/usr/include " \
+		EXTRA_LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib"
+
 	$(MAKE) -C $(PKG_BUILD_DIR) \
 		STAGING_DIR="$(STAGING_DIR)" \
 		DESTDIR="$(PKG_INSTALL_DIR)" \
diff --git a/package/keynote/Makefile b/package/keynote/Makefile
index 579300407bc7edc94b3942ee88a1a11c357afcc7..ed4d4f020b8d384dab4ea5a27586f9520a24b62d 100644
--- a/package/keynote/Makefile
+++ b/package/keynote/Makefile
@@ -42,11 +42,7 @@ define Build/Configure
 	)
 endef
 
-define Build/Compile
-	$(call Build/Compile/Default, \
-		CFLAGS="\$$$$(EXTRA_CFLAGS) \$$$$(EXTRA_LDFLAGS)" \
-	)
-endef
+EXTRA_CFLAGS += $(EXTRA_LDFLAGS)
 
 define Build/InstallDev
 	mkdir -p $(STAGING_DIR)/usr/include
diff --git a/package/linux-atm/Makefile b/package/linux-atm/Makefile
index 9aae0a0b0ed1a4f0b59aedaf1ca5b3811156affe..7691c1149a14da5f7c2ef86d4af46efa96fe4628 100644
--- a/package/linux-atm/Makefile
+++ b/package/linux-atm/Makefile
@@ -51,11 +51,12 @@ define Build/Configure
 	touch $(PKG_BUILD_DIR)/stamp-h.in
 endef
 
+TARGET_CFLAGS := -I$(PKG_BUILD_DIR)/src/include $(TARGET_CFLAGS)
 define Build/Compile
-	$(call Build/Compile/Default, \
+	$(MAKE) -C $(PKG_BUILD_DIR) \
+		$(TARGET_CONFIGURE_OPTS) \
 		DESTDIR="$(PKG_INSTALL_DIR)" \
-		all install \
-	)
+		all install
 endef
 
 define Build/InstallDev
diff --git a/package/util-linux/Makefile b/package/util-linux/Makefile
index e265edb149830715f000a1745e28c8caa2afe202..ecabbc06fb4233362ff9a542b11911d7da464d00 100644
--- a/package/util-linux/Makefile
+++ b/package/util-linux/Makefile
@@ -56,6 +56,7 @@ define Package/swap-utils
 	- swapoff
 endef
 
+TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib
 define Build/Compile
 	$(call Build/Compile/Default, \
 		OPT="$(TARGET_CFLAGS)" \
diff --git a/rules.mk b/rules.mk
index 3afdab67c2822c4a3a2925c326ef580363dd7486..0a958c2d58688f3894835cb4da95ff619ce51bf1 100644
--- a/rules.mk
+++ b/rules.mk
@@ -69,6 +69,9 @@ ifneq ($(CONFIG_CCACHE),)
   TARGET_CC:= ccache $(TARGET_CC)
 endif
 
+EXTRA_CPPFLAGS := -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include
+EXTRA_LDFLAGS := -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
+
 TARGET_CONFIGURE_OPTS:= \
   AR=$(TARGET_CROSS)ar \
   AS="$(TARGET_CC) -c $(TARGET_CFLAGS)" \