diff --git a/common.mak b/common.mak
index d7b54d0427de6137f6ca1b7e9345af91193d9053..b55e921f54c548f4a6e057f9a93afd2780a3f868 100644
--- a/common.mak
+++ b/common.mak
@@ -31,7 +31,7 @@ endif
 
 ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
 
-CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
+CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
 CFLAGS   += $(ECFLAGS)
 
 %.o: %.c
diff --git a/subdir.mak b/subdir.mak
index b67288a4b7985c5b492b9c61d21d68950f453525..db0d8763f7cccb630838544775aabcb7e1ce5041 100644
--- a/subdir.mak
+++ b/subdir.mak
@@ -5,6 +5,8 @@ include $(SUBDIR)../common.mak
 LIBVERSION := $(lib$(NAME)_VERSION)
 LIBMAJOR   := $(lib$(NAME)_VERSION_MAJOR)
 
+$(OBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
+
 ifdef CONFIG_STATIC
 all: $(SUBDIR)$(LIBNAME)