Skip to content

Commit

Permalink
Makefile: Factor out flags and respect user-defined CFLAGS/LDFLAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Oct 22, 2020
1 parent 721c5d4 commit 380e8b7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)"
Expand Down

0 comments on commit 380e8b7

Please sign in to comment.