I encountered a build error when compiling RIsearch1 due to the inclusion of *.h files in the Makefile's targets. The default rule:
RIsearch: *.c *.h
$(CC) $(CFLAGS) -O3 $^ -DRISVERSION=1 -lm -o $@
causes the compiler to fail with:
clang: error: cannot specify -o when generating multiple output files
make: *** [RIsearch] Error 1
This happens because header files (e.g., fasta.h) are not valid input files for the linker, yet they are included via the *.h glob and expanded into $^.
✅ Suggested Fix
A more portable and correct Makefile would explicitly list only the source files (*.c) as dependencies:
CFLAGS += -Wall -pedantic
SRC := dsm.c fasta.c risearch.c weights.c
all: RIsearch RIsearch.dbg
RIsearch: $(SRC)
$(CC) $(CFLAGS) -O3 $(SRC) -DRISVERSION=1 -lm -o RIsearch
RIsearch.dbg: $(SRC)
$(CC) $(CFLAGS) -g -O0 -DRISVERSION=1 -DDEBUG -DVERBOSE=2 $(SRC) -lm -o RIsearch.dbg
.PHONY: clean
clean:
rm -f RIsearch RIsearch.dbg *.o
This avoids passing headers to the linker and allows the build to complete cleanly.
I encountered a build error when compiling
RIsearch1due to the inclusion of*.hfiles in theMakefile's targets. The default rule:causes the compiler to fail with:
This happens because header files (e.g.,
fasta.h) are not valid input files for the linker, yet they are included via the*.hglob and expanded into$^.✅ Suggested Fix
A more portable and correct
Makefilewould explicitly list only the source files (*.c) as dependencies:This avoids passing headers to the linker and allows the build to complete cleanly.