diff --git a/Makefile b/Makefile
index f786e73..32df980 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-CC = gcc
-CFLAGS = -W -Wall -finline-functions -fPIC -std=gnu99 -Wno-unused-result -O3
-CLIB = -lz -lm -llzma -lbz2 -lcurl
+CC ?= gcc
+CFLAGS ?= -W -Wall -finline-functions -fPIC -std=gnu99 -Wno-unused-result -O3
+CLIB = -lz -lm -llzma -lbz2 -lcurl -lpthread
 CF_OPTIMIZE = 1
 
 OS := $(shell uname)
diff --git a/htslib-1.15.1/Makefile b/htslib-1.15.1/Makefile
index 0871580..e7a313d 100644
--- a/htslib-1.15.1/Makefile
+++ b/htslib-1.15.1/Makefile
@@ -22,7 +22,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-CC     = gcc
+CC     ?= gcc
 AR     = ar
 RANLIB = ranlib
 
