From 380e8b75434531bd79eea238288c60b57bbfdfe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 22 Oct 2020 10:46:06 +0200 Subject: [PATCH] Makefile: Factor out flags and respect user-defined CFLAGS/LDFLAGS --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index afbcdd7..779a618 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,21 @@ -GIMPARGS = $(shell gimptool-2.0 --cflags --libs) +GIMP_CFLAGS = $(shell gimptool-2.0 --cflags) +GIMP_LIBS = $(shell gimptool-2.0 --libs) +CFLAGS += $(GIMP_CFLAGS) -Wall -Wno-unused-variable -Wno-pointer-sign -DGIMP_DISABLE_DEPRECATED +LDFLAGS += $(GIMP_LIBS) -lm SYSTEM_INSTALL_DIR = $(shell gimptool-2.0 --dry-run --install-admin-bin ./bin/bimp | sed 's/cp \S* \(\S*\)/\1/'|tr -d [\']) USER_INSTALL_DIR = $(shell gimptool-2.0 --dry-run --install-bin ./bin/bimp | sed 's/cp \S* \(\S*\)/\1/'|tr -d [\']) make: which gimptool-2.0 && \ - gcc -o ./bin/bimp -Wall -O2 -Wno-unused-variable -Wno-pointer-sign src/*.c src/manipulation-gui/*.c src/images/*.c $(GIMPARGS) -lm -DGIMP_DISABLE_DEPRECATED + gcc -o ./bin/bimp -O2 $(CFLAGS) src/*.c src/manipulation-gui/*.c src/images/*.c $(LDFLAGS) makewin-debug: which gimptool-2.0 && \ - gcc -o ./bin/win32/bimp -Wall -Wno-unused-variable -Wno-pointer-sign src/*.c src/manipulation-gui/*.c src/images/*.c $(GIMPARGS) -lm -DGIMP_DISABLE_DEPRECATED + gcc -o ./bin/win32/bimp $(CFLAGS) src/*.c src/manipulation-gui/*.c src/images/*.c $(LDFLAGS) makewin: which gimptool-2.0 && \ - gcc -mwindows -o ./bin/win32/bimp -O2 -Wall -Wno-unused-variable -Wno-pointer-sign src/*.c src/manipulation-gui/*.c src/images/*.c $(GIMPARGS) -lm -DGIMP_DISABLE_DEPRECATED + gcc -mwindows -o ./bin/win32/bimp -O2 $(CFLAGS) src/*.c src/manipulation-gui/*.c src/images/*.c $(LDFLAGS) install: mkdir -p "$(USER_INSTALL_DIR)"