Makefile: Suppress `-Wimplicit-fallthrough` when compiling `lex.yy`
[fio.git] / Makefile
index 8495e727ba370c7f29e6376a93e75a8169c98165..ed66305a202b3a81daf351f06f804ac0588ebb48 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -535,8 +535,12 @@ else
        $(QUIET_LEX)$(LEX) $<
 endif
 
+ifneq (,$(findstring -Wimplicit-fallthrough,$(CFLAGS)))
+LEX_YY_CFLAGS := -Wno-implicit-fallthrough
+endif
+
 lex.yy.o: lex.yy.c y.tab.h
-       $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
+       $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LEX_YY_CFLAGS) -c $<
 
 y.tab.o: y.tab.c y.tab.h
        $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<