$NetBSD: patch-Makefile,v 1.1 2020/08/06 22:47:16 joerg Exp $

Honor proper compiler flags.

--- Makefile.orig	2020-08-06 22:39:25.558919061 +0000
+++ Makefile
@@ -4,12 +4,14 @@ OBJECTS=linenoise.o encodings/utf8.o lin
 
 ifeq ($(OS),Darwin)
 linenoise.dylib: $(OBJECTS)
-	gcc -o $@ -bundle -undefined dynamic_lookup $^ $(OPT_LIB)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -bundle -undefined dynamic_lookup $^ $(OPT_LIB)
 else
-CFLAGS=-fPIC -I/usr/include/lua5.1
 linenoise.so: $(OBJECTS)
-	gcc -o $@ -shared $^ $(OPT_LIB)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -shared $^ $(OPT_LIB)
 endif
 
+%.o: %.c
+	$(CC) -c $(CFLAGS) -fPIC $< -o $@
+
 clean:
 	rm -f *.o encodings/*.o *.so *.dylib
