aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-05-02 16:31:01 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-05-02 16:31:01 +0200
commita9396a4bcdca424d221bcb8698f9676d1029727f (patch)
tree9abf5346d83041a2d68f169b696f6f4836510099 /Makefile
parent051747ef00510d9bea17b4494fc430133f26cf56 (diff)
downloaddrminfo-a9396a4bcdca424d221bcb8698f9676d1029727f.tar.gz
make: build with meson if we find it installed
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 23 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ebebf03..2d3c756 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,24 @@
+MESON := $(shell which meson 2>&1)
+
+ifneq ($(MESON),)
+
+HOST := $(shell hostname -s)
+BDIR := build-meson-$(HOST)
+
+build: $(BDIR)/build.ninja
+ ninja-build -C $(BDIR)
+
+install: build
+ ninja-build -C $(BDIR) install
+
+clean:
+ rm -rf $(BDIR)
+
+$(BDIR)/build.ninja:
+ $(MESON) $(BDIR)
+
+else
+
CC ?= gcc
CFLAGS ?= -Os -g -std=c99
CFLAGS += -Wall
@@ -24,3 +45,5 @@ clean:
drminfo: drminfo.o drmtools.o
drmtest: drmtest.o drmtools.o render.o image.o
gtktest: gtktest.o render.o image.o
+
+endif