Skip to contentSkip to conversation

meson: makefile integration cleanup

PATCH In review Jani Nikula 4 participants 12 messages Oct 24, 2017 – Jan 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover meson: makefile integration cleanup

I know the meson "makefile integration" is supposed to be just a simple helper, but add a touch of polish to it anyway.

BR,
Jani.

Jani Nikula (6):
meson: split out simple makefile integration into a makefile Makefile.meson: use $(error ...) for errors Makefile.meson: no need to mkdir build directory before running meson Makefile.meson: fix .PHONY deps
Makefile.meson: no need to have a separate default target Makefile.meson: add distclean target to remove Makefile and build dir

 Makefile.meson | 35 +++++++++++++++++++++++++++++++++++
 meson.sh       | 38 +++-----------------------------------
 2 files changed, 38 insertions(+), 35 deletions(-)
 create mode 100644 Makefile.meson
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/6 meson: split out simple makefile integration into a makefile

A separate makefile is easier to read and maintain than a here document. The meson.sh shell script becomes trivial too.

---
 Makefile.meson | 33 +++++++++++++++++++++++++++++++++
 meson.sh       | 38 +++-----------------------------------
 2 files changed, 36 insertions(+), 35 deletions(-)
 create mode 100644 Makefile.meson
Makefile.meson new file +33 -0
new file mode 100644
index 000000000000..2ed642bdab37
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# Simple makefile integration for meson
+
+.PHONY: default docs
+default: all
+
+Makefile: Makefile.meson
+	cp $< $@
+
+build/build.ninja: Makefile
+	mkdir -p build
+	meson build
+
+all: build/build.ninja
+	ninja -C build
+
+clean: build/build.ninja
+	ninja -C build clean
+
+test: build/build.ninja
+	ninja -C build test
+
+reconfigure: build/build.ninja
+	ninja -C build reconfigure
+
+check distcheck dist distclean:
+	echo "This is the meson wrapper, not automake" && false
+
+install uninstall:
+	echo "meson install support not yet completed" && false
+
+docs:
+	echo "meson gtkdoc support not yet completed" && false
meson.sh +3 -35
index cbf1a9326dbe..cdb384eb16a6 100755
@@ -1,35 +1,3 @@
-#!/bin/bash
-
-cat > Makefile <<EOF
-
-.PHONY: default docs
-default: all
-
-build/build.ninja:
-	mkdir -p build
-	meson build
-
-all: build/build.ninja
-	ninja -C build
-
-clean: build/build.ninja
-	ninja -C build clean
-
-test: build/build.ninja
-	ninja -C build test
-
-reconfigure: build/build.ninja
-	ninja -C build reconfigure
-
-check distcheck dist distclean:
-	echo "This is the meson wrapper, not automake" && false
-
-install uninstall:
-	echo "meson install support not yet completed" && false
-
-docs:
-	echo "meson gtkdoc support not yet completed" && false
-
-EOF
-
-make $@
+#!/bin/sh
+# Simple makefile integration for meson
+make -f Makefile.meson "$@"
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH i-g-t 1/6] meson: split out simple makefile integration into a makefile

Quoted 9 lines · Jani Nikula

A separate makefile is easier to read and maintain than a here document. The meson.sh shell script becomes trivial too.

---
 Makefile.meson | 33 +++++++++++++++++++++++++++++++++
 meson.sh       | 38 +++-----------------------------------
 2 files changed, 36 insertions(+), 35 deletions(-)
 create mode 100644 Makefile.meson

I believe the goal for the toplevel makefile wrapper was to support editors that issue straight up 'make'.

Signature · 1 line
Petri Latvala
Quoted 90 lines
Makefile.meson new file +33 -0
new file mode 100644
index 000000000000..2ed642bdab37
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# Simple makefile integration for meson
+
+.PHONY: default docs
+default: all
+
+Makefile: Makefile.meson
+	cp $< $@
+
+build/build.ninja: Makefile
+	mkdir -p build
+	meson build
+
+all: build/build.ninja
+	ninja -C build
+
+clean: build/build.ninja
+	ninja -C build clean
+
+test: build/build.ninja
+	ninja -C build test
+
+reconfigure: build/build.ninja
+	ninja -C build reconfigure
+
+check distcheck dist distclean:
+	echo "This is the meson wrapper, not automake" && false
+
+install uninstall:
+	echo "meson install support not yet completed" && false
+
+docs:
+	echo "meson gtkdoc support not yet completed" && false
meson.sh +3 -35
index cbf1a9326dbe..cdb384eb16a6 100755
@@ -1,35 +1,3 @@
-#!/bin/bash
-
-cat > Makefile <<EOF
-
-.PHONY: default docs
-default: all
-
-build/build.ninja:
-	mkdir -p build
-	meson build
-
-all: build/build.ninja
-	ninja -C build
-
-clean: build/build.ninja
-	ninja -C build clean
-
-test: build/build.ninja
-	ninja -C build test
-
-reconfigure: build/build.ninja
-	ninja -C build reconfigure
-
-check distcheck dist distclean:
-	echo "This is the meson wrapper, not automake" && false
-
-install uninstall:
-	echo "meson install support not yet completed" && false
-
-docs:
-	echo "meson gtkdoc support not yet completed" && false
-
-EOF
-
-make $@
+#!/bin/sh
+# Simple makefile integration for meson
+make -f Makefile.meson "$@"
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH i-g-t 1/6] meson: split out simple makefile integration into a makefile

Quoted 12 lines · Petri Latvala
Quoted 9 lines · Jani Nikula

A separate makefile is easier to read and maintain than a here document. The meson.sh shell script becomes trivial too.

---
 Makefile.meson | 33 +++++++++++++++++++++++++++++++++
 meson.sh       | 38 +++-----------------------------------
 2 files changed, 36 insertions(+), 35 deletions(-)
 create mode 100644 Makefile.meson
Quoted 2 lines

I believe the goal for the toplevel makefile wrapper was to support editors that issue straight up 'make'.

Yeah I wanted all the built-in editor support for make to Just Work, to reduce the transition cost for everyone. There's ofc emacs/vim/whatever plugins for meson. And typing :make -f Makefile.meson defeats the point of that, might as well install the plugin then.

But if there's no demand for this I'm happy with outright nuking it ... -Daniel

Quoted 104 lines
Signature · 2 lines
-- 
Petri Latvala
Quoted 90 lines
Makefile.meson new file +33 -0
new file mode 100644
index 000000000000..2ed642bdab37
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# Simple makefile integration for meson
+
+.PHONY: default docs
+default: all
+
+Makefile: Makefile.meson
+	cp $< $@
+
+build/build.ninja: Makefile
+	mkdir -p build
+	meson build
+
+all: build/build.ninja
+	ninja -C build
+
+clean: build/build.ninja
+	ninja -C build clean
+
+test: build/build.ninja
+	ninja -C build test
+
+reconfigure: build/build.ninja
+	ninja -C build reconfigure
+
+check distcheck dist distclean:
+	echo "This is the meson wrapper, not automake" && false
+
+install uninstall:
+	echo "meson install support not yet completed" && false
+
+docs:
+	echo "meson gtkdoc support not yet completed" && false
meson.sh +3 -35
index cbf1a9326dbe..cdb384eb16a6 100755
@@ -1,35 +1,3 @@
-#!/bin/bash
-
-cat > Makefile <<EOF
-
-.PHONY: default docs
-default: all
-
-build/build.ninja:
-	mkdir -p build
-	meson build
-
-all: build/build.ninja
-	ninja -C build
-
-clean: build/build.ninja
-	ninja -C build clean
-
-test: build/build.ninja
-	ninja -C build test
-
-reconfigure: build/build.ninja
-	ninja -C build reconfigure
-
-check distcheck dist distclean:
-	echo "This is the meson wrapper, not automake" && false
-
-install uninstall:
-	echo "meson install support not yet completed" && false
-
-docs:
-	echo "meson gtkdoc support not yet completed" && false
-
-EOF
-
-make $@
+#!/bin/sh
+# Simple makefile integration for meson
+make -f Makefile.meson "$@"
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 2/6 Makefile.meson: use $(error ...) for errors

In reply to Jani Nikula

This is the usual way of flagging fatal errors in Makefiles, and gives you the error exit code too.

---
 Makefile.meson | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Makefile.meson +3 -3
index 2ed642bdab37..6955e6a9a694 100644
@@ -24,10 +24,10 @@ reconfigure: build/build.ninja
 	ninja -C build reconfigure
 
 check distcheck dist distclean:
-	echo "This is the meson wrapper, not automake" && false
+	$(error This is the meson wrapper, not automake)
 
 install uninstall:
-	echo "meson install support not yet completed" && false
+	$(error meson install support not yet completed)
 
 docs:
-	echo "meson gtkdoc support not yet completed" && false
+	$(error meson gtkdoc support not yet completed)
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/6
#5 lore raw

Re: [PATCH i-g-t 2/6] Makefile.meson: use $(error ...) for errors

Quoted 4 lines · Jani Nikula

This is the usual way of flagging fatal errors in Makefiles, and gives you the error exit code too.

Regardless of where this change is done (meson.sh output or Makefile.meson, see reply to patch 1),

Quoted 29 lines
---
 Makefile.meson | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Makefile.meson +3 -3
index 2ed642bdab37..6955e6a9a694 100644
@@ -24,10 +24,10 @@ reconfigure: build/build.ninja
 	ninja -C build reconfigure
 
 check distcheck dist distclean:
-	echo "This is the meson wrapper, not automake" && false
+	$(error This is the meson wrapper, not automake)
 
 install uninstall:
-	echo "meson install support not yet completed" && false
+	$(error meson install support not yet completed)
 
 docs:
-	echo "meson gtkdoc support not yet completed" && false
+	$(error meson gtkdoc support not yet completed)
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

PATCH 3/6 Makefile.meson: no need to mkdir build directory before running meson

In reply to Jani Nikula

Meson creates the directory for you.

---
 Makefile.meson | 1 -
 1 file changed, 1 deletion(-)
Makefile.meson +0 -1
index 6955e6a9a694..9f71cf341121 100644
@@ -8,7 +8,6 @@ Makefile: Makefile.meson
 	cp $< $@
 
 build/build.ninja: Makefile
-	mkdir -p build
 	meson build
 
 all: build/build.ninja
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 4/6 Makefile.meson: fix .PHONY deps

In reply to Jani Nikula

Most targets here are phony, tell that to make. Avoid potentials collisions with files and directories with the same names.

---
 Makefile.meson | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile.meson +3 -1
index 9f71cf341121..82fa50bf92e5 100644
@@ -1,7 +1,9 @@
 # -*- makefile -*-
 # Simple makefile integration for meson
 
-.PHONY: default docs
+.PHONY: default all clean test reconfigure check distcheck dist distclean \
+	install uninstall docs
+
 default: all
 
 Makefile: Makefile.meson
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 5/6 Makefile.meson: no need to have a separate default target

In reply to Jani Nikula

Just place "all" target at the top. Makefiles aren't ordered.

---
 Makefile.meson | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
Makefile.meson +4 -6
index 82fa50bf92e5..c7a87f37f47d 100644
@@ -1,10 +1,11 @@
 # -*- makefile -*-
 # Simple makefile integration for meson
 
-.PHONY: default all clean test reconfigure check distcheck dist distclean \
-	install uninstall docs
+.PHONY: all clean test reconfigure check distcheck dist distclean install \
+	uninstall docs
 
-default: all
+all: build/build.ninja
+	ninja -C build
 
 Makefile: Makefile.meson
 	cp $< $@
@@ -12,9 +13,6 @@ Makefile: Makefile.meson
 build/build.ninja: Makefile
 	meson build
 
-all: build/build.ninja
-	ninja -C build
-
 clean: build/build.ninja
 	ninja -C build clean
 
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 6/6 Makefile.meson: add distclean target to remove Makefile and build dir

In reply to Jani Nikula

Useful for forcing a clean meson build from scratch.

---
 Makefile.meson | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Makefile.meson +4 -1
index c7a87f37f47d..2e09c11052da 100644
@@ -16,13 +16,16 @@ build/build.ninja: Makefile
 clean: build/build.ninja
 	ninja -C build clean
 
+distclean:
+	rm -rf build Makefile
+
 test: build/build.ninja
 	ninja -C build test
 
 reconfigure: build/build.ninja
 	ninja -C build reconfigure
 
-check distcheck dist distclean:
+check distcheck dist:
 	$(error This is the meson wrapper, not automake)
 
 install uninstall:
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 6/6
#10 lore raw

Re: [PATCH i-g-t 6/6] Makefile.meson: add distclean target to remove Makefile and build dir

Quoted 12 lines · Jani Nikula

Useful for forcing a clean meson build from scratch.

---
 Makefile.meson | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Makefile.meson +0 -0
index c7a87f37f47d..2e09c11052da 100644

Makefile.meson build/build.ninja: Makefile · line 21

Quoted 6 lines
Makefile.meson +3 -0
@@ -16,13 +16,16 @@ build/build.ninja: Makefile
 clean: build/build.ninja
 	ninja -C build clean
 
+distclean:
+	rm -rf build Makefile
+

If patch 1 is applied, there is no Makefile to remove. Adjusted accordingly, this patch and 3-5 as well are

Quoted 18 lines
Makefile.meson +1 -1
 test: build/build.ninja
 	ninja -C build test
 
 reconfigure: build/build.ninja
 	ninja -C build reconfigure
 
-check distcheck dist distclean:
+check distcheck dist:
 	$(error This is the meson wrapper, not automake)
 
 install uninstall:
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

✗ Fi.CI.BAT: warning for meson: makefile integration cleanup

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: meson: makefile integration cleanup
URL : https://patchwork.freedesktop.org/series/32519/
State : warning

== Summary ==

IGT patchset tested on top of latest successful build e5f7fac9f120b0dcbf370c681b8872b8c29bf890 meson: intel_dp_compliance depends on libudev

with latest DRM-Tip kernel build CI_DRM_3276
5c82a37eff83 drm-tip: 2017y-10m-23d-18h-06m-28s UTC integration manifest

No testlist changes.

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
Test kms_frontbuffer_tracking:
        Subgroup basic:
                fail       -> PASS       (fi-glk-dsi)
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> DMESG-WARN (fi-bsw-n3050)

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:444s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:461s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:374s
fi-bsw-n3050     total:289  pass:242  dwarn:1   dfail:0   fail:0   skip:46  time:531s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:264s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:499s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:494s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:561s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:602s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:419s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:251s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:579s
fi-glk-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:489s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:432s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:434s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:438s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:484s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:461s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:480s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:582s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:476s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:582s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:551s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:458s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:648s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:524s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:501s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:461s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:565s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:418s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_400/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx