makefile
author agaric <agaric@protonmail.com>
Tue, 09 Mar 2021 07:18:07 +0000
changeset 0 5f04caa7212d
permissions -rw-r--r--
git import
0
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     1
include config.mk
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     2
idir = include
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     3
pdir = protocols
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     4
wpdir = /usr/share/wayland-protocols
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     5
prtc = \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     6
	$(wpdir)/stable/xdg-shell/xdg-shell \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     7
	$(wpdir)/unstable/xdg-output/xdg-output-unstable-v1 \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     8
	$(pdir)/wlr-layer-shell-unstable-v1 \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     9
	$(pdir)/wlr-input-inhibitor-unstable-v1
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    10
prts = \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    11
	$(wpdir)/unstable/pointer-constraints/pointer-constraints-unstable-v1 \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    12
	$(pdir)/idle \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    13
	$(pdir)/wlr-output-power-management-unstable-v1
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    14
deps = \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    15
	gdk-pixbuf-2.0 \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    16
	json-c \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    17
	libevdev \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    18
	libinput \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    19
	pangocairo \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    20
	pixman-1 \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    21
	wayland-client \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    22
	wayland-cursor \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    23
	wayland-egl \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    24
	wayland-protocols \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    25
	wayland-server \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    26
	wlroots \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    27
	xcb \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    28
	xkbcommon
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    29
CFLAGS += -std=c17 -I./$(idir) -I./$(bdir) -DWLR_USE_UNSTABLE
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    30
CFLAGS += $(foreach p,$(deps),$(shell pkg-config --cflags $(p)))
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    31
LDLIBS += $(foreach p,$(deps),$(shell pkg-config --libs $(p)))
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    32
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    33
.DEFAULT_GOAL = all
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    34
.PHONY: all clean prep scan
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    35
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    36
all: prep goose
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    37
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    38
prep:
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    39
	if test ! -d $(bdir); then mkdir $(bdir); fi
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    40
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    41
scan:
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    42
	$(foreach p,$(prts),$(shell \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    43
		wayland-scanner private-code $(p).xml \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    44
			$(bdir)/$(shell basename $(p))-protocol.c; \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    45
		wayland-scanner server-header $(p).xml \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    46
			$(bdir)/$(shell basename $(p))-protocol.h))
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    47
	$(foreach p,$(prtc),$(shell \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    48
		wayland-scanner private-code $(p).xml \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    49
			$(bdir)/$(shell basename $(p))-protocol.c; \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    50
		wayland-scanner server-header $(p).xml \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    51
			$(bdir)/$(shell basename $(p))-protocol.h; \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    52
		wayland-scanner client-header $(p).xml \
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    53
			$(bdir)/$(shell basename $(p))-client-protocol.h))
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    54
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    55
goose: scan goosebump
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    56
	$(CC) $(CFLAGS) src/$@.c $(LDLIBS) -o $(bdir)/$@
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    57
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    58
goosebump:
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    59
	$(CC) $(CFLAGS) src/$@.c -shared -o $(bdir)/$@.so
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    60
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    61
clean:
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    62
	if test -d $(bdir); then rm -R $(bdir); fi
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    63