wl-overlay/makefile

77 lines
2.2 KiB
Makefile
Raw Permalink Normal View History

2022-10-20 13:57:50 +00:00
#!/usr/bin/make -f
2022-10-20 13:43:37 +00:00
# This file is part of wl-overlay: show overlays with images and text in Wayland
# Copyright © 2022 Midgard
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2022-10-20 13:57:50 +00:00
SHELL = /bin/sh
2022-09-09 20:12:06 +00:00
# Choose a dedicated build directory as make clean will remove it entirely
2022-09-06 21:36:03 +00:00
BUILD = build
2022-09-09 20:12:06 +00:00
$(shell mkdir -p $(BUILD))
2022-09-06 21:36:03 +00:00
2022-10-20 13:57:50 +00:00
# Convenience targets
.PHONY: all
all: $(BUILD)/wl-overlay
.PHONY: clean
clean:
rm -rf $(BUILD) wlr-layer-shell-protocol.h
# Installation
DESTDIR ?=
PREFIX ?= /usr/local
BINDIR ?= $(DESTDIR)$(PREFIX)/bin
.PHONY: install
install: $(BUILD)/wl-overlay
install -D -t "$(BINDIR)" "$^"
# Dependencies
2022-09-06 21:36:03 +00:00
CFLAGS += -Wall
2022-09-07 14:28:43 +00:00
CFLAGS += $(shell pkg-config --cflags pangocairo)
LDLIBS += $(shell pkg-config --libs pangocairo)
2022-09-07 18:10:19 +00:00
CFLAGS += $(shell pkg-config --cflags cairo)
LDLIBS += $(shell pkg-config --libs cairo)
2022-09-07 14:28:43 +00:00
2022-09-07 18:10:19 +00:00
CFLAGS += $(shell pkg-config --cflags wayland-client)
LDLIBS += $(shell pkg-config --libs wayland-client)
2022-09-07 14:28:43 +00:00
LDLIBS += -lrt
2022-09-06 21:36:03 +00:00
2022-10-20 13:57:50 +00:00
# Generated C files
wlr-layer-shell-protocol.h: wlr-layer-shell-unstable-v1.xml
2022-09-06 21:36:03 +00:00
wayland-scanner client-header < "$^" > "$@"
2022-09-09 20:12:06 +00:00
$(BUILD)/wlr-layer-shell-protocol.c: wlr-layer-shell-unstable-v1.xml
2022-09-06 21:36:03 +00:00
wayland-scanner private-code < "$^" > "$@"
2022-09-09 20:12:06 +00:00
$(BUILD)/xdg-shell-protocol.c: /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml
2022-09-06 21:36:03 +00:00
wayland-scanner private-code < "$^" > "$@"
2022-10-20 13:57:50 +00:00
# Objects
SRCS = $(wildcard *.c)
GEN_SRCS = $(BUILD)/wlr-layer-shell-protocol.c $(BUILD)/xdg-shell-protocol.c
OBJS = $(SRCS:%.c=$(BUILD)/%.o) $(GEN_SRCS:%.c=%.o)
$(BUILD)/%.o: %.c
$(CC) $(CFLAGS) -c $< $(OUTPUT_OPTION)
$(BUILD)/wayland.o: wayland.c wlr-layer-shell-protocol.h
$(BUILD)/wl-overlay: $(OBJS)