From ea84d7a04d5f2eb51c06a5cafbfd877228ab8c4a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 21 Mar 2025 10:40:04 +0100 Subject: Makefile: drop PHONY for hare-gi Signed-off-by: Drew DeVault --- .gitignore | 1 + Makefile | 25 ++++++++++++++++++------- README.md | 15 +++++---------- generate3 | 36 ------------------------------------ generate4 | 43 ------------------------------------------- scripts/generate3 | 36 ++++++++++++++++++++++++++++++++++++ scripts/generate4 | 43 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 103 insertions(+), 96 deletions(-) delete mode 100755 generate3 delete mode 100755 generate4 create mode 100755 scripts/generate3 create mode 100755 scripts/generate4 diff --git a/.gitignore b/.gitignore index 28c2fe4..6245975 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ /hare-gi /demo3 /demo4 +/.gen _generated.ha diff --git a/Makefile b/Makefile index 00e2a54..1250439 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .POSIX: .SUFFIXES: -all: hare-gi +all: hare-gi .gen DESTDIR = PREFIX = /usr/local @@ -38,21 +38,29 @@ MODULES_GTK4 = $(MODULES_CORE) $(MODULES_GTK_SHARED) \ LIBS_3 != pkg-config --libs-only-l gtk+-3.0 LIBS_4 != pkg-config --libs-only-l gtk4 -hare-gi: +HARE_GI_SRC != find cmd/hare-gi/ -name '*.ha' +GIR_SRC != find gir/ -name '*.ha' +FORMAT_FASTXML_SRC != find format/fastxml/ -name '*.ha' + +hare-gi: $(HARE_GI_SRC) $(GIR_SRC) $(FORMAT_FASTXML_SRC) hare build -o $@ cmd/hare-gi/ -.PHONY: hare-gi -install: hare-gi install3 install4 +.gen: hare-gi + ./scripts/generate3 + ./scripts/generate4 + touch .gen + +install: hare-gi install-gtk3 install-gtk4 install -Dm755 hare-gi "$(DESTDIR)$(BINDIR)"/hare-gi -install3: +install-gtk3: .gen @for mod in $(MODULES_GTK3); do \ printf "installing %s\n" "$$mod"; \ mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \ install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \ done -install4: +install-gtk4: .gen @for mod in $(MODULES_GTK4); do \ printf "installing %s\n" "$$mod"; \ mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \ @@ -93,4 +101,7 @@ demo4: clean: rm -f hare-gi xmltree demo3 demo4 bindings/gi/*/_generate.ha -.PHONY: all install3 install4 uninstall3 uninstall4 demo3 demo4 clean +.PHONY: all clean +.PHONY: install install-gtk3 install-gtk4 +.PHONY: uninstall uninstall3 uninstall4 +.PHONY: demo3 demo4 diff --git a/README.md b/README.md index 9bf993c..a55f405 100644 --- a/README.md +++ b/README.md @@ -8,23 +8,18 @@ Dependencies: * Development files for GObject-Introspection, the desired GTK version and its dependencies. Make sure `/usr/share/gir-1.0` is included. -### GTK 3 -``` -./generate -make install -``` +To generate and install both GTK 3 and GTK 4 bindings: -### GTK 4 ``` -./generate4 -make install4 +$ make +# make install [PREFIX=/usr/local] [DESTDIR=] ``` ## Running examples ### GTK 3 ``` -make demo -./demo +make demo3 +./demo3 ``` ### GTK 4 diff --git a/generate3 b/generate3 deleted file mode 100755 index 3b17734..0000000 --- a/generate3 +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -BIND=./bindings/gi -NS=gi:: - -mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \ - "$BIND"/gdkpixbuf "$BIND"/freetype "$BIND"/harfbuzz "$BIND"/cairo \ - "$BIND"/pango "$BIND"/gdk "$BIND"/xlib "$BIND"/gtk - -hare build cmd/hare-gi && exec ./hare-gi -B \ - -m GLib,${NS}glib,"$BIND"/glib/_generated.ha \ - -m GObject,${NS}gobject,"$BIND"/gobject/_generated.ha \ - -m Gio,${NS}gio,"$BIND"/gio/_generated.ha \ - -m GModule,${NS}gmodule,"$BIND"/gmodule/_generated.ha \ - -m Atk,${NS}atk,"$BIND"/atk/_generated.ha \ - -m GdkPixbuf,${NS}gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \ - -m freetype2,${NS}freetype,"$BIND"/freetype/_generated.ha \ - -m HarfBuzz,${NS}harfbuzz,"$BIND"/harfbuzz/_generated.ha \ - -m cairo,${NS}cairo,"$BIND"/cairo/_generated.ha \ - -m Pango,${NS}pango,"$BIND"/pango/_generated.ha \ - -m Gdk,${NS}gdk,"$BIND"/gdk/_generated.ha \ - -m xlib,${NS}xlib,"$BIND"/xlib/_generated.ha \ - -m Gtk,${NS}gtk,"$BIND"/gtk/_generated.ha \ - /usr/share/gir-1.0/GLib-2.0.gir \ - /usr/share/gir-1.0/GObject-2.0.gir \ - /usr/share/gir-1.0/Gio-2.0.gir \ - /usr/share/gir-1.0/GModule-2.0.gir \ - /usr/share/gir-1.0/Atk-1.0.gir \ - /usr/share/gir-1.0/GdkPixbuf-2.0.gir \ - /usr/share/gir-1.0/freetype2-2.0.gir \ - /usr/share/gir-1.0/HarfBuzz-0.0.gir \ - /usr/share/gir-1.0/cairo-1.0.gir \ - /usr/share/gir-1.0/Pango-1.0.gir \ - /usr/share/gir-1.0/Gdk-3.0.gir \ - /usr/share/gir-1.0/xlib-2.0.gir \ - /usr/share/gir-1.0/Gtk-3.0.gir diff --git a/generate4 b/generate4 deleted file mode 100755 index 26a15d4..0000000 --- a/generate4 +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -BIND=./bindings/gi -NS=gi:: - -mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \ - "$BIND"/gdkpixbuf "$BIND"/freetype "$BIND"/harfbuzz "$BIND"/cairo \ - "$BIND"/pango "$BIND"/pangocairo "$BIND"/gdk4 "$BIND"/xlib "$BIND"/graphene \ - "$BIND"/gsk "$BIND"/gtk4 - -hare build cmd/hare-gi && exec ./hare-gi \ - -m GLib,${NS}glib,"$BIND"/glib/_generated.ha \ - -m GObject,${NS}gobject,"$BIND"/gobject/_generated.ha \ - -m Gio,${NS}gio,"$BIND"/gio/_generated.ha \ - -m GModule,${NS}gmodule,"$BIND"/gmodule/_generated.ha \ - -m Atk,${NS}atk,"$BIND"/atk/_generated.ha \ - -m GdkPixbuf,${NS}gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \ - -m freetype2,${NS}freetype,"$BIND"/freetype/_generated.ha \ - -m HarfBuzz,${NS}harfbuzz,"$BIND"/harfbuzz/_generated.ha \ - -m cairo,${NS}cairo,"$BIND"/cairo/_generated.ha \ - -m Pango,${NS}pango,"$BIND"/pango/_generated.ha \ - -m PangoCairo,${NS}pangocairo,"$BIND"/pangocairo/_generated.ha \ - -m Gdk,${NS}gdk4,"$BIND"/gdk4/_generated.ha \ - -m xlib,${NS}xlib,"$BIND"/xlib/_generated.ha \ - -m Graphene,${NS}graphene,"$BIND"/graphene/_generated.ha \ - -m Gsk,${NS}gsk,"$BIND"/gsk/_generated.ha \ - -m Gtk,${NS}gtk4,"$BIND"/gtk4/_generated.ha \ - /usr/share/gir-1.0/GLib-2.0.gir \ - /usr/share/gir-1.0/GObject-2.0.gir \ - /usr/share/gir-1.0/Gio-2.0.gir \ - /usr/share/gir-1.0/GModule-2.0.gir \ - /usr/share/gir-1.0/Atk-1.0.gir \ - /usr/share/gir-1.0/GdkPixbuf-2.0.gir \ - /usr/share/gir-1.0/freetype2-2.0.gir \ - /usr/share/gir-1.0/HarfBuzz-0.0.gir \ - /usr/share/gir-1.0/cairo-1.0.gir \ - /usr/share/gir-1.0/Pango-1.0.gir \ - /usr/share/gir-1.0/PangoCairo-1.0.gir \ - /usr/share/gir-1.0/Gdk-4.0.gir \ - /usr/share/gir-1.0/xlib-2.0.gir \ - /usr/share/gir-1.0/Graphene-1.0.gir \ - /usr/share/gir-1.0/Gsk-4.0.gir \ - /usr/share/gir-1.0/Gtk-4.0.gir diff --git a/scripts/generate3 b/scripts/generate3 new file mode 100755 index 0000000..18a834b --- /dev/null +++ b/scripts/generate3 @@ -0,0 +1,36 @@ +#!/bin/sh + +BIND=./bindings/gi +NS=gi:: + +mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \ + "$BIND"/gdkpixbuf "$BIND"/freetype "$BIND"/harfbuzz "$BIND"/cairo \ + "$BIND"/pango "$BIND"/gdk "$BIND"/xlib "$BIND"/gtk + +exec ./hare-gi -B \ + -m GLib,${NS}glib,"$BIND"/glib/_generated.ha \ + -m GObject,${NS}gobject,"$BIND"/gobject/_generated.ha \ + -m Gio,${NS}gio,"$BIND"/gio/_generated.ha \ + -m GModule,${NS}gmodule,"$BIND"/gmodule/_generated.ha \ + -m Atk,${NS}atk,"$BIND"/atk/_generated.ha \ + -m GdkPixbuf,${NS}gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \ + -m freetype2,${NS}freetype,"$BIND"/freetype/_generated.ha \ + -m HarfBuzz,${NS}harfbuzz,"$BIND"/harfbuzz/_generated.ha \ + -m cairo,${NS}cairo,"$BIND"/cairo/_generated.ha \ + -m Pango,${NS}pango,"$BIND"/pango/_generated.ha \ + -m Gdk,${NS}gdk,"$BIND"/gdk/_generated.ha \ + -m xlib,${NS}xlib,"$BIND"/xlib/_generated.ha \ + -m Gtk,${NS}gtk,"$BIND"/gtk/_generated.ha \ + /usr/share/gir-1.0/GLib-2.0.gir \ + /usr/share/gir-1.0/GObject-2.0.gir \ + /usr/share/gir-1.0/Gio-2.0.gir \ + /usr/share/gir-1.0/GModule-2.0.gir \ + /usr/share/gir-1.0/Atk-1.0.gir \ + /usr/share/gir-1.0/GdkPixbuf-2.0.gir \ + /usr/share/gir-1.0/freetype2-2.0.gir \ + /usr/share/gir-1.0/HarfBuzz-0.0.gir \ + /usr/share/gir-1.0/cairo-1.0.gir \ + /usr/share/gir-1.0/Pango-1.0.gir \ + /usr/share/gir-1.0/Gdk-3.0.gir \ + /usr/share/gir-1.0/xlib-2.0.gir \ + /usr/share/gir-1.0/Gtk-3.0.gir diff --git a/scripts/generate4 b/scripts/generate4 new file mode 100755 index 0000000..0c75b61 --- /dev/null +++ b/scripts/generate4 @@ -0,0 +1,43 @@ +#!/bin/sh + +BIND=./bindings/gi +NS=gi:: + +mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \ + "$BIND"/gdkpixbuf "$BIND"/freetype "$BIND"/harfbuzz "$BIND"/cairo \ + "$BIND"/pango "$BIND"/pangocairo "$BIND"/gdk4 "$BIND"/xlib "$BIND"/graphene \ + "$BIND"/gsk "$BIND"/gtk4 + +exec ./hare-gi \ + -m GLib,${NS}glib,"$BIND"/glib/_generated.ha \ + -m GObject,${NS}gobject,"$BIND"/gobject/_generated.ha \ + -m Gio,${NS}gio,"$BIND"/gio/_generated.ha \ + -m GModule,${NS}gmodule,"$BIND"/gmodule/_generated.ha \ + -m Atk,${NS}atk,"$BIND"/atk/_generated.ha \ + -m GdkPixbuf,${NS}gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \ + -m freetype2,${NS}freetype,"$BIND"/freetype/_generated.ha \ + -m HarfBuzz,${NS}harfbuzz,"$BIND"/harfbuzz/_generated.ha \ + -m cairo,${NS}cairo,"$BIND"/cairo/_generated.ha \ + -m Pango,${NS}pango,"$BIND"/pango/_generated.ha \ + -m PangoCairo,${NS}pangocairo,"$BIND"/pangocairo/_generated.ha \ + -m Gdk,${NS}gdk4,"$BIND"/gdk4/_generated.ha \ + -m xlib,${NS}xlib,"$BIND"/xlib/_generated.ha \ + -m Graphene,${NS}graphene,"$BIND"/graphene/_generated.ha \ + -m Gsk,${NS}gsk,"$BIND"/gsk/_generated.ha \ + -m Gtk,${NS}gtk4,"$BIND"/gtk4/_generated.ha \ + /usr/share/gir-1.0/GLib-2.0.gir \ + /usr/share/gir-1.0/GObject-2.0.gir \ + /usr/share/gir-1.0/Gio-2.0.gir \ + /usr/share/gir-1.0/GModule-2.0.gir \ + /usr/share/gir-1.0/Atk-1.0.gir \ + /usr/share/gir-1.0/GdkPixbuf-2.0.gir \ + /usr/share/gir-1.0/freetype2-2.0.gir \ + /usr/share/gir-1.0/HarfBuzz-0.0.gir \ + /usr/share/gir-1.0/cairo-1.0.gir \ + /usr/share/gir-1.0/Pango-1.0.gir \ + /usr/share/gir-1.0/PangoCairo-1.0.gir \ + /usr/share/gir-1.0/Gdk-4.0.gir \ + /usr/share/gir-1.0/xlib-2.0.gir \ + /usr/share/gir-1.0/Graphene-1.0.gir \ + /usr/share/gir-1.0/Gsk-4.0.gir \ + /usr/share/gir-1.0/Gtk-4.0.gir -- cgit 1.3.0-6-gf8a5