about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDrew DeVault <drew@ddevault.org>2025-03-21 10:40:04 +0100
committerAlexey Yerin <yyp@disroot.org>2025-03-21 14:32:38 +0300
commitea84d7a04d5f2eb51c06a5cafbfd877228ab8c4a (patch)
tree5ab0c02740e402c341f01dde8294ac8eb58f8e16
parentb464972aba88159edc202d5e2fb6aef63f9cb2d2 (diff)
Makefile: drop PHONY for hare-gi
Signed-off-by: Drew DeVault <drew@ddevault.org>
-rw-r--r--.gitignore1
-rw-r--r--Makefile25
-rw-r--r--README.md15
-rwxr-xr-xscripts/generate3 (renamed from generate3)2
-rwxr-xr-xscripts/generate4 (renamed from generate4)2
5 files changed, 26 insertions, 19 deletions
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/scripts/generate3
index 3b17734..18a834b 100755
--- a/generate3
+++ b/scripts/generate3
@@ -7,7 +7,7 @@ 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 \
+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 \
diff --git a/generate4 b/scripts/generate4
index 26a15d4..0c75b61 100755
--- a/generate4
+++ b/scripts/generate4
@@ -8,7 +8,7 @@ mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \
 	"$BIND"/pango "$BIND"/pangocairo "$BIND"/gdk4 "$BIND"/xlib "$BIND"/graphene \
 	"$BIND"/gsk "$BIND"/gtk4
 
-hare build cmd/hare-gi && exec ./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 \