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