--- Makefile.orig	2015-02-27 21:17:45.000000000 +0300
+++ Makefile	2022-09-17 17:52:46.195305832 +0300
@@ -11,7 +11,7 @@
   SONAME=install_name
 endif
 #CFLAGS=-Wall -g -ansi -fPIC -pthread
-CFLAGS=-Wall -O3 -ansi -fPIC -pthread
+CFLAGS+=-ansi -pthread
 LIB_TAG=0.2.0
 CC=gcc
 PREFIX=/usr
@@ -20,7 +20,7 @@
 all: sonic libsonic.so.$(LIB_TAG) libsonic.a
 
 sonic: wave.o main.o libsonic.so.$(LIB_TAG)
-	$(CC) $(CFLAGS) -o sonic wave.o main.o libsonic.so.$(LIB_TAG)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o sonic wave.o main.o libsonic.so.$(LIB_TAG)
 
 sonic.o: sonic.c sonic.h
 	$(CC) $(CFLAGS) -c sonic.c
@@ -32,7 +32,7 @@
 	$(CC) $(CFLAGS) -c main.c
 
 libsonic.so.$(LIB_TAG): sonic.o
-	$(CC) $(CFLAGS) -shared -Wl,-$(SONAME),libsonic.so.0 sonic.o -o libsonic.so.$(LIB_TAG)
+	$(CC) $(CFLAGS) -shared $(LDFLAGS),-$(SONAME),libsonic.so.0 sonic.o -o libsonic.so.$(LIB_TAG)
 	ln -sf libsonic.so.$(LIB_TAG) libsonic.so
 	ln -sf libsonic.so.$(LIB_TAG) libsonic.so.0
 
