Support DESTDIR.
https://github.com/mcg1969/vecLibFort/pull/12

Use CC and FC variables.
https://github.com/mcg1969/vecLibFort/pull/13

Use LDFLAGS when linking.
(Not yet submitted upsream.)

Remove extra -O flag
https://github.com/mcg1969/vecLibFort/pull/16
--- Makefile.orig	2022-01-22 08:32:18.000000000 -0600
+++ Makefile	2022-02-09 20:30:04.000000000 -0600
@@ -1,7 +1,9 @@
 PREFIX=/usr/local
 LIBDIR=$(PREFIX)/lib
 
+CC=clang
 CFLAGS=-O
+FC=gfortran
 
 NAME=vecLibFort
 SOURCE=$(NAME).c
@@ -25,25 +27,25 @@
 	ranlib $@
 
 $(DYNAMIC): $(OBJECT)
-	clang -shared -o $@ $^ \
+	$(CC) -shared $(LDFLAGS) -o $@ $^ \
 		-Wl,-reexport_framework -Wl,Accelerate \
 		-install_name $(LIBDIR)/$@
 
 $(PRELOAD): $(SOURCE) $(DEPEND)
-	clang -shared $(CFLAGS) -DVECLIBFORT_INTERPOSE -o $@ -O $(SOURCE) \
+	$(CC) -shared $(CFLAGS) $(LDFLAGS) -DVECLIBFORT_INTERPOSE -o $@ $(SOURCE) \
 		-Wl,-reexport_framework -Wl,Accelerate \
 		-install_name $(LIBDIR)/$@
 
 install: all
-	mkdir -p $(LIBDIR)
-	cp -f $(STATIC) $(LIBDIR)
-	cp -f $(DYNAMIC) $(LIBDIR)
-	cp -f $(PRELOAD) $(LIBDIR)
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	cp -f $(STATIC) $(DESTDIR)$(LIBDIR)
+	cp -f $(DYNAMIC) $(DESTDIR)$(LIBDIR)
+	cp -f $(PRELOAD) $(DESTDIR)$(LIBDIR)
 
 clean:
 	rm -f $(OBJECT) $(STATIC) $(DYNAMIC) $(PRELOAD)
 
 check: tester.f90 $(OBJECT)
-	gfortran -o tester -O $^ -framework Accelerate 
+	$(FC) -o tester -O $^ -framework Accelerate
 	./tester
 
