build: Bail out early if m4 or lex don't exist.
[lopsub.git] / Makefile
index 230a966b257de0eb761907426905ea97d30db64b..c0057a38b89119897044caa0a1eaa705877989ca 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,15 @@ INSTALL := install
 GZIP := gzip -fn9
 ZCAT := zcat
 
+dummy != $(M4) /dev/null || printf 'failed'
+ifeq ($(dummy), failed)
+$(error m4 is required to build this package)
+endif
+dummy != printf '%%%%\n' | $(LEX) -o /dev/null || printf 'failed'
+ifeq ($(dummy), failed)
+$(error (f)lex is required to build this package)
+endif
+
 DATE_FMT := +%B %Y
 # To get a reproducible build, we use $(SOURCE_DATE_EPOCH) instead of the
 # current time if this variable is set.
@@ -83,7 +92,7 @@ $(lsg_objs) $(liblopsub_objs) $(lopsubex_objs): %.o: %.c
 lopsubgen.o config_file.o:
        $(CC) -g -c -fPIC -o $@ ${@:.o=.c}
 lsg1.o: lsg.c lsg.h
-       $(CC) -g -DSTAGE1 -Wall -g -c $< -o $@
+       $(CC) -g -DSTAGE1 -Wall -c $< -o $@
 %.o: %.c
        $(CC) -Wall -I. -g -c -fPIC -o $@ $<