--- gmic-1.5.9.1/src/Makefile
+++ gmic-1.5.9.1/src/Makefile
@@ -77,7 +77,6 @@
 
 # Flags that are mandatory to compile 'gmic'.
 MANDATORY_CFLAGS += -Dgmic_build -I$(USR)/include
-MANDATORY_LDFLAGS += -L$(USR)/lib
 ifeq ($(CC),g++)
 MANDATORY_CFLAGS += -Wall -W
 MANDATORY_LDFLAGS += -lm
@@ -121,14 +120,14 @@
 # (keep /usr/ dirname here since X11 is located in /usr/ on Mac too).
 # This requires the presence of the X11 include and library files.
 # (package 'libx11-dev' on Debian).
-X11_CFLAGS = -Dcimg_display=1 -Dcimg_appname=\\\"gmic\\\" -I/usr/X11R6/include #-Dcimg_use_xrandr
-X11_LDFLAGS = -L/usr/X11R6/lib -lX11 -lpthread #-lXrandr
+X11_CFLAGS = -Dcimg_display=1 -Dcimg_appname=\\\"gmic\\\" #-Dcimg_use_xrandr
+X11_LDFLAGS = -lX11 -lpthread #-lXrandr
 
 # Flags to enable fast display, using XShm.
 # This requires the presence of the X11 extension include and library files.
 # (package 'libx11-dev' on Debian).
 XSHM_CFLAGS = -Dcimg_use_xshm
-XSHM_LDFLAGS = -L$(USR)/X11R6/lib -lXext
+XSHM_LDFLAGS = -lXext
 
 # Flags to enable image display, using GDI32.
 # This requires the presence of the GDI32 include and library files.
@@ -163,7 +162,7 @@
 # This requires the presence of the FFMPEG include and library files.
 # (packages 'libavcodec-dev', 'libavutil-dev', 'libavformat-dev' and 'libswscale-dev' on Debian).
 FFMPEG_CFLAGS = -Dcimg_use_ffmpeg -D__STDC_CONSTANT_MACROS -I$(USR)/include/libavcodec -I$(USR)/include/libavformat -I$(USR)/include/libswscale -I$(USR)/include/ffmpeg
-FFMPEG_LDFLAGS = -lavcodec -lavformat -lswscale
+FFMPEG_LDFLAGS = -lavcodec -lavformat -lavutil -lswscale
 
 # Flags to enable native support for compressed .cimgz files, using the Zlib library.
 # This requires the presence of the Zlib include and library files.
@@ -174,14 +173,8 @@
 # Flags to enable native support of webcams, using the OpenCV library.
 # This requires the presence of the OpenCV include and library files.
 # (package 'libcv3-2-dev' on Debian).
-ifeq ($(OS),Darwin)
 OPENCV_CFLAGS = -Dcimg_use_opencv -I$(USR)/include -I$(USR)/include/opencv
 OPENCV_LDFLAGS = `pkg-config opencv --libs`   #-> Use this for OpenCV 2.2.0 !
-else
-OPENCV_CFLAGS = -Dcimg_use_opencv -I$(USR)/include -I$(USR)/include/opencv
-# OPENCV_LDFLAGS = -lcv -lhighgui
-OPENCV_LDFLAGS = -lopencv_core -lopencv_highgui   #-> Use this for OpenCV >= 2.2.0 !
-endif
 
 # Flags to enable native support of most classical image file formats, using the GraphicsMagick++ library.
 # This requires the presence of the GraphicsMagick++ include and library files.
@@ -307,10 +300,10 @@
 endif
 
 gimp:
-	$(MAKE) "CFLAGS=$(STD_GIMP_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS+=$(STD_GIMP_LDFLAGS) $(OPT_LDFLAGS)" "STRIP_EXE=1" gmic_gimp
+	$(MAKE) "CFLAGS+=$(STD_GIMP_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS+=$(STD_GIMP_LDFLAGS) $(OPT_LDFLAGS)" gmic_gimp
 
 lib:
-	$(MAKE) "CFLAGS=$(STD_LIB_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS+=$(STD_LIB_LDFLAGS) $(OPT_LDFLAGS)" gmic_lib
+	$(MAKE) "CFLAGS+=$(STD_LIB_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS+=$(STD_LIB_LDFLAGS) $(OPT_LDFLAGS)" gmic_lib
 
 zart: lib
 ifneq ($(OS),Darwin)
@@ -321,7 +314,7 @@
 
 # Entries for other configurations.
 linux:
-	$(MAKE) "CFLAGS=$(STD_UNIX_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS=$(STD_UNIX_LDFLAGS)" "STRIP_EXE=1" gmic_cli_standard
+	$(MAKE) "CFLAGS+=$(STD_UNIX_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS=$(STD_UNIX_LDFLAGS)" gmic_cli_standard
 
 solaris:
 	$(MAKE) "CFLAGS=$(STD_UNIX_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS=$(STD_UNIX_LDFLAGS) -R$(USR)/X11R6/lib -lrt -lnsl -lsocket" "STRIP_EXE=1" gmic_cli_standard
@@ -342,7 +335,7 @@
 	$(MAKE) "CFLAGS+=$(MINIMAL_UNIX_CFLAGS)" "LDFLAGS+=$(MINIMAL_UNIX_LDFLAGS)" gmic_cli_standard
 
 full:
-	$(MAKE) "CFLAGS=$(FULL_UNIX_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS=$(FULL_UNIX_LDFLAGS)" "STRIP_EXE=1" gmic_cli_full
+	$(MAKE) "CFLAGS+=$(FULL_UNIX_CFLAGS) $(OPT_CFLAGS)" "LDFLAGS=$(FULL_UNIX_LDFLAGS)" gmic_cli_full
 
 winminimal:
 	$(MAKE) "CFLAGS=$(MINIMAL_WINDOWS_CFLAGS)" "LDFLAGS=$(MINIMAL_WINDOWS_LDFLAGS)" gmic_cli_standard
@@ -351,10 +344,9 @@
 gmic_lib.o: gmic.cpp
 	$(CC) -o gmic_lib.o -c gmic.cpp -fPIC $(CFLAGS) -Dgmic_float_only
 gmic_lib: gmic_lib.o
-	ar rcs libgmic.a gmic_lib.o
+	$(AR) rcs libgmic.a gmic_lib.o
 ifneq ($(OS),Darwin)
 	$(CC) -shared -Wl,-soname,libgmic.so.1 -o libgmic.so gmic_lib.o $(LDFLAGS)
-	$(CC) -o gmic_use_lib gmic_use_lib.cpp -L. -lgmic $(FFTW_LDFLAGS)
 else
 	$(CC) -shared -o libgmic.so gmic_lib.o $(LDFLAGS)
 endif
@@ -363,7 +355,6 @@
 	$(CC) -o gmic_gimp.o -c gmic.cpp $(CFLAGS) -Dgmic_gimp -Dgmic_float_only
 gmic_gimp : gmic_gimp.o gmic_gimp.cpp
 	$(CC) -o gmic_gimp gmic_gimp.cpp gmic_gimp.o `gimptool-2.0$(EXE) --cflags` $(CFLAGS) `gimptool-2.0$(EXE) --libs` $(LDFLAGS)
-	strip gmic_gimp$(EXE)
 
 gmic_bool.o: gmic.cpp
 	$(CC) -o gmic_bool.o -c gmic.cpp $(CFLAGS) -Dgmic_split_compilation -Dgmic_bool
@@ -385,7 +376,6 @@
 	$(CC) -o gmic_double.o -c gmic.cpp $(CFLAGS) -Dgmic_split_compilation -Dgmic_double
 gmic_cli_full: gmic_bool.o gmic_uchar.o gmic_char.o gmic_ushort.o gmic_short.o gmic_uint.o gmic_int.o gmic_float.o gmic_double.o
 	$(CC) -o gmic gmic_bool.o gmic_uchar.o gmic_char.o gmic_ushort.o gmic_short.o gmic_uint.o gmic_int.o gmic_float.o gmic_double.o $(LDFLAGS)
-	strip gmic$(EXE)
 gmic_cli_standard: gmic.cpp
 	$(CC) -o gmic gmic.cpp $(CFLAGS) -Dgmic_float_only -Dgmic_main $(LDFLAGS)
 
