diff --git a/Makefile b/Makefile
index b3132f4cf78cd4275ac6a3243e54d2b822baad13..d5b51de7e751a291db745e206a70b2d5e98bbc0f 100644
--- a/Makefile
+++ b/Makefile
@@ -77,6 +77,10 @@ all: $(AVPROGS)
 $(TOOLS): %$(EXESUF): %.o
 	$(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS)
 
+tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
+tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
+tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
+
 CONFIGURABLE_COMPONENTS =                                           \
     $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c))                 \
     $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/version.h))              \
diff --git a/tools/Makefile b/tools/Makefile
index f8e1434f296f5d915876d309077820c7712680b2..49f55d2a9e42079afe9cd7344e3c4680fb21c305 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,10 +1,6 @@
 TOOLS = qt-faststart trasher uncoded_frame
 TOOLS-$(CONFIG_ZLIB) += cws2fws
 
-tools/cws2fws$(EXESUF): ELIBS = $(ZLIB)
-tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS)
-tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS)
-
 OBJDIRS += tools
 
 clean::