--- makefile.orig	2022-06-14 05:50:15.000000000 +0800
+++ makefile	2023-07-13 17:31:30.000000000 +0800
@@ -15,18 +15,18 @@
 # Windows compatibility, jonas-kr, Sep '20.
 
 # Compiler (CXX), and linking from C, fortran. We use GCC by default...
-CXX = g++
-CC = gcc
-FC = gfortran
-CLINK = -lstdc++
-FLINK = $(CLINK)
+CXX = @CXX@
+CC =  @CC@
+FC =  @FC@
+CLINK =
+FLINK =
 # Python version: we use python3 by default, but you may need to change...
 PYTHON = python3
 # baseline compile flags for GCC (no multithreading):
 # Notes: 1) -Ofast breaks isfinite() & isnan(), so use -O3 which now is as fast
 #        2) -fcx-limited-range for fortran-speed complex arith in C++
 #        3) we use simply-expanded (:=) makefile variables, otherwise confusing
-CFLAGS := -O3 -funroll-loops -march=native -fcx-limited-range $(CFLAGS)
+CFLAGS := -O3 -funroll-loops -fcx-limited-range $(CFLAGS)
 FFLAGS := $(CFLAGS) $(FFLAGS)
 CXXFLAGS := $(CFLAGS) $(CXXFLAGS)
 # put this in your make.inc if you have FFTW>=3.3.5 and want thread-safe use...
@@ -34,11 +34,11 @@
 # FFTW base name, and math linking...
 FFTWNAME = fftw3
 # linux default is fftw3_omp, since 10% faster than fftw3_threads...
-FFTWOMPSUFFIX = omp
+FFTWOMPSUFFIX = threads
 LIBS := -lm
 # multithreading for GCC: C++/C/Fortran, MATLAB, and octave (ICC differs)...
 OMPFLAGS = -fopenmp
-OMPLIBS = -lgomp
+OMPLIBS = @LOMP@
 MOMPFLAGS = -D_OPENMP
 OOMPFLAGS =
 # MATLAB MEX compilation (also see below +=)...
@@ -56,7 +56,7 @@
 
 # For your OS, override the above by setting make variables in make.inc ...
 # (Please look in make.inc.* for ideas)
--include make.inc
+# -include make.inc
 
 # Now come flags that should be added, whatever user overrode in make.inc.
 # -fPIC (position-indep code) needed to build dyn lib (.so)
@@ -65,7 +65,7 @@
 CXXFLAGS := $(CXXFLAGS) $(INCL) -fPIC -std=c++14
 CFLAGS := $(CFLAGS) $(INCL) -fPIC
 # here /usr/include needed for fftw3.f "fortran header"... (JiriK: no longer)
-FFLAGS := $(FFLAGS) $(INCL) -I/usr/include -fPIC
+FFLAGS := $(FFLAGS) $(INCL) -I@PREFIX@/include -fPIC
 
 # single-thread total list of math and FFTW libs (now both precisions)...
 # (Note: finufft tests use LIBSFFT; spread & util tests only need LIBS)
@@ -92,7 +92,7 @@
 ifeq ($(MINGW),ON)
   DYNLIB = lib/$(LIBNAME).dll
 else
-  DYNLIB = lib/$(LIBNAME).so
+  DYNLIB = lib/$(LIBNAME).dylib
 endif
 
 STATICLIB = lib-static/$(LIBNAME).a
