diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e36305ff33201d0900980dbd4f07d621d19bd8a8..40c16818d5bceee915f380a06c0ba3762cbf701d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -710,6 +710,9 @@ endif
 $(SUBDIR)%_tablegen$(HOSTEXESUF): $(SUBDIR)%_tablegen.c $(SUBDIR)tableprint.c
 	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(HOSTLIBS)
 
-$(SUBDIR)mpegaudiodec.o: $(SUBDIR)mpegaudio_tables.h
 $(SUBDIR)%_tables.h: $(SUBDIR)%_tablegen$(HOSTEXESUF)
 	./$< > $@
+
+ifdef CONFIG_HARDCODED_TABLES
+$(SUBDIR)mpegaudiodec.o: $(SUBDIR)mpegaudio_tables.h
+endif