From 6f4542fb9ab491912532468766b0f0f4adb0cb67 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Mon, 14 Nov 2022 17:27:27 +0200 Subject: Portable Makefile --- Makefile | 64 +++++++++++++++++++++++++-------------------------------------- README | 11 +++++------ README.ru | 10 +++++----- 3 files changed, 35 insertions(+), 50 deletions(-) diff --git a/Makefile b/Makefile index a092562..8dacd2b 100644 --- a/Makefile +++ b/Makefile @@ -1,54 +1,40 @@ MAIN = plugin-img GIMPTOOL = gimptool-2.0 -CC = gcc -LD = gcc -CFLAGS = $(shell $(GIMPTOOL) --cflags) \ - -O2 -Wall -Wextra -Wno-attributes \ - -Wno-unused-parameter +GIMP = gimp +CC = cc +LD = cc +CFLAGS = -O2 -Wall -Wextra -LIBS = $(shell $(GIMPTOOL) --libs) - -SRC = $(wildcard *.c) -HDR = $(wildcard *.h) -OBJ = $(subst .c,.o,$(SRC)) - -build: $(MAIN) - -help: - @echo "MAKE targets:" - @echo "" - @echo "build - build plugin" - @echo "install - install plugin" - @echo "" - @echo "indent - beatify sources" - @echo "clean - remove build garbage" - @echo "" - @echo "test - run gimp with samples" - @echo "test-fu - run non-interactively gimp for batch file recoding" - - -install: $(MAIN) - $(GIMPTOOL) --install-bin $(MAIN) - -indent: $(SRC) $(HDR) - indent $(INDENT_OPT) $? - -clean: - rm -f *.o *.i *.s $(MAIN) +SRC = img-load.c img-save.c img-save-dialog.c plugin-img.c +HDR = $(SRC:.c=.h) +OBJ = $(SRC:.c=.o) $(MAIN): $(OBJ) - $(LD) $(OBJ) $(LIBS) -o $@ + $(LD) $(OBJ) `$(GIMPTOOL) --libs` -o $@ -%.o: %.c $(HDR) Makefile - $(CC) -c $(CFLAGS) $< -o $@ +$(OBJ): $(HDR) Makefile +.c.o: + $(CC) `$(GIMPTOOL) --cflags` $(CFLAGS) -c $< -o $@ +.PHONY: test test: install gimp samples/*.img +.PHONY: test-fu test-fu: install img-fu - gimp -i -b - < img-fu + $(GIMP) --no-interface --batch - < img-fu -.PHONY: install build test test-fu indent clean +.PHONY: install +install: $(MAIN) + $(GIMPTOOL) --install-bin $(MAIN) + +.PHONY: uninstall +uninstall: + $(GIMPTOOL) --uninstall-bin $(MAIN) + +.PHONY: clean +clean: + rm -f *.o *.i *.s $(MAIN) diff --git a/README b/README index 91678ca..01a6410 100644 --- a/README +++ b/README @@ -18,12 +18,11 @@ See Makefile for details. Example: $ make install -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter img-load.c -o img-load.o -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter img-save.c -o img-save.o -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter img-save-dialog.c -o img-save-dialog.o -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter plugin-img.c -o plugin-img.o -gcc img-load.o img-save.o img-save-dialog.o plugin-img.o -lgimpui-2.0 -lgimpwidgets-2.0 -lgimpmodule-2.0 -lgimp-2.0 -lgimpmath-2.0 -lgimpconfig-2.0 -lgimpcolor-2.0 -lgimpbase-2.0 -lgegl-0.4 -lgegl-npd-0.4 -Wl,--export-dynamic -lgmodule-2.0 -pthread -ljson-glib-1.0 -lbabl-0.1 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -o plugin-img +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c img-load.c -o img-load.o +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c img-save.c -o img-save.o +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c img-save-dialog.c -o img-save-dialog.o +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c plugin-img.c -o plugin-img.o +cc img-load.o img-save.o img-save-dialog.o plugin-img.o `gimptool-2.0 --libs` -o plugin-img gimptool-2.0 --install-bin plugin-img cp 'plugin-img' '/home/pashev/.config/GIMP/2.10/plug-ins/plugin-img/' - diff --git a/README.ru b/README.ru index 93dc168..c3dd0ae 100644 --- a/README.ru +++ b/README.ru @@ -44,11 +44,11 @@ F2-как у меня), то файл сохранится в том же фор Вот пример сборки и установки плагина: $ make install -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter img-load.c -o img-load.o -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter img-save.c -o img-save.o -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter img-save-dialog.c -o img-save-dialog.o -gcc -c -pthread -I/usr/include/gimp-2.0 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -O2 -Wall -Wextra -Wno-attributes -Wno-unused-parameter plugin-img.c -o plugin-img.o -gcc img-load.o img-save.o img-save-dialog.o plugin-img.o -lgimpui-2.0 -lgimpwidgets-2.0 -lgimpmodule-2.0 -lgimp-2.0 -lgimpmath-2.0 -lgimpconfig-2.0 -lgimpcolor-2.0 -lgimpbase-2.0 -lgegl-0.4 -lgegl-npd-0.4 -Wl,--export-dynamic -lgmodule-2.0 -pthread -ljson-glib-1.0 -lbabl-0.1 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -o plugin-img +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c img-load.c -o img-load.o +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c img-save.c -o img-save.o +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c img-save-dialog.c -o img-save-dialog.o +cc `gimptool-2.0 --cflags` -O2 -Wall -Wextra -c plugin-img.c -o plugin-img.o +cc img-load.o img-save.o img-save-dialog.o plugin-img.o `gimptool-2.0 --libs` -o plugin-img gimptool-2.0 --install-bin plugin-img cp 'plugin-img' '/home/pashev/.config/GIMP/2.10/plug-ins/plugin-img/' -- cgit v1.2.3