diff --git a/libswscale/Makefile b/libswscale/Makefile
index c0941b92ebfc3e20dec65fa8ba99b68cf19c6b3b..8b1ea9a82f6c5f137628519aedec9488e4c8df13 100644
--- a/libswscale/Makefile
+++ b/libswscale/Makefile
@@ -9,6 +9,9 @@ OBJS-$(ARCH_BFIN)          +=  swscale_bfin.o yuv2rgb_bfin.o
 OBJS-$(CONFIG_GPL)         +=  yuv2rgb.o
 OBJS-$(HAVE_ALTIVEC)       +=  yuv2rgb_altivec.o
 
+OBJS-$(CONFIG_MLIB)        +=  yuv2rgb_mlib.c
+OBJS-$(HAVE_VIS)           +=  yuv2rgb_vis.c
+
 ASM_OBJS-$(ARCH_BFIN)      += internal_bfin.o
 
 HEADERS = swscale.h rgb2rgb.h
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index e51cd0cadc826c1ad84f6628dca2e38def445130..b90f78c1fb6d167ab08388d0204e1ea3d395ca2a 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -39,14 +39,6 @@
 #include "swscale.h"
 #include "swscale_internal.h"
 
-#ifdef HAVE_VIS
-#include "yuv2rgb_vis.c"
-#endif
-
-#ifdef CONFIG_MLIB
-#include "yuv2rgb_mlib.c"
-#endif
-
 #define DITHER1XBPP // only for mmx
 
 const uint8_t  __attribute__((aligned(8))) dither_2x2_4[2][8]={