shithub: wl9m

ref: bffc4bdc7f73139ae834619e3a018c17ceee9398
dir: /linux/Makefile/

View raw version
# Makefile for p9wl - Wayland compositor to Plan 9
#
# Install dependencies (Debian/Ubuntu):
#   sudo apt install libwlroots-dev libwayland-dev libxkbcommon-dev libpixman-1-dev
#
# On some systems wlroots is versioned (wlroots-0.17, wlroots-0.18)
# The Makefile will try to auto-detect, or you can override:
#   make WLROOTS_PKG=wlroots-0.18

# Auto-detect wlroots package name
WLROOTS_PKG ?= $(shell pkg-config --exists wlroots && echo wlroots || \
                       pkg-config --list-all 2>/dev/null | grep -o 'wlroots-[0-9.]*' | sort -V | tail -1)

ifeq ($(WLROOTS_PKG),)
  $(error Could not find wlroots. Install libwlroots-dev or specify WLROOTS_PKG=...)
endif

PKGS := $(WLROOTS_PKG) wayland-server xkbcommon pixman-1
CFLAGS := -D_DEFAULT_SOURCE -Wall -lc -lpthread -g -O2 -lz -DUSE_LZ4 -llz4 $(shell pkg-config --cflags $(PKGS)) -DWLR_USE_UNSTABLE
LDFLAGS := $(shell pkg-config --libs $(PKGS)) -lm

all: p9wl 

p9wl: p9wl.c
	@echo "Building with $(WLROOTS_PKG)"
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)

drawclient: drawclient.c
	$(CC) -Wall -O2 -o $@ $< -lm

clean:
	rm -f p9wl drawclient

.PHONY: all clean