From be36d981cd3e7121992bb29d7a83d3d037e17bd2 Mon Sep 17 00:00:00 2001 From: John Marshall Date: Sun, 15 Dec 2019 18:14:49 +0000 Subject: [PATCH] Use $CPPFLAGS and $LDFLAGS if they are set The bwa makefile doesn't set these two itself, but the environment or make command line might set any of CC/CPPFLAGS/CFLAGS/LDFLAGS/LIBS. Use $(CPPFLAGS) when compiling and $(LDFLAGS) when linking so they can be used to customise the build. Remove $(DFLAGS) from link commands as these preprocessor options are irrelevant for linking. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7151435..37751bb 100644 --- a/Makefile +++ b/Makefile @@ -22,15 +22,15 @@ endif .SUFFIXES:.c .o .cc .c.o: - $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@ + $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $(CPPFLAGS) $< -o $@ all:$(PROG) bwa:libbwa.a $(AOBJS) main.o - $(CC) $(CFLAGS) $(DFLAGS) $(AOBJS) main.o -o $@ -L. -lbwa $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) $(AOBJS) main.o -o $@ -L. -lbwa $(LIBS) bwamem-lite:libbwa.a example.o - $(CC) $(CFLAGS) $(DFLAGS) example.o -o $@ -L. -lbwa $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) example.o -o $@ -L. -lbwa $(LIBS) libbwa.a:$(LOBJS) $(AR) -csru $@ $(LOBJS) @@ -39,7 +39,7 @@ clean: rm -f gmon.out *.o a.out $(PROG) *~ *.a depend: - ( LC_ALL=C ; export LC_ALL; makedepend -Y -- $(CFLAGS) $(DFLAGS) -- *.c ) + ( LC_ALL=C ; export LC_ALL; makedepend -Y -- $(CFLAGS) $(DFLAGS) $(CPPFLAGS) -- *.c ) # DO NOT DELETE THIS LINE -- make depend depends on it.