automake’s behavior seems to have changed between 1.15.1 and 1.16.1:
1.15.1:
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) config.h
1.16.1:
all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS) config.h
This causes an automake file which builds a library and a program that uses that library to fail.