-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (43 loc) · 1.82 KB
/
Copy pathMakefile
File metadata and controls
55 lines (43 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.RECIPEPREFIX = >
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
PKG_CONFIG ?= pkg-config
PKGS = wayland-client pangocairo cairo
WFLAGS = -Wall -Wextra -Wformat=2 -Werror=format -Wshadow \
-Wmissing-prototypes -Wmissing-declarations -Wundef \
-Wstrict-prototypes -Wno-unused-parameter -Werror \
-Wconversion -Wsign-conversion -Wcast-qual -Wpointer-arith
HFLAGS = -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong
# GCC static analyzer; clear it for compilers without it: make ANALYZER=
ANALYZER ?= -fanalyzer
CFLAGS += -std=c11 $(WFLAGS) $(HFLAGS) $(ANALYZER) \
$(shell $(PKG_CONFIG) --cflags $(PKGS)) -isystem gen
LDLIBS += $(shell $(PKG_CONFIG) --libs $(PKGS))
PROTO = wlr-layer-shell-unstable-v1
XDGXML = $(shell $(PKG_CONFIG) --variable=pkgdatadir wayland-protocols)/stable/xdg-shell/xdg-shell.xml
SCANNER = $(shell $(PKG_CONFIG) --variable=wayland_scanner wayland-scanner 2>/dev/null || echo wayland-scanner)
all: swaytime
gen/$(PROTO)-client-protocol.h: protocol/$(PROTO).xml
> mkdir -p gen
> $(SCANNER) client-header $< $@
gen/$(PROTO)-protocol.c: protocol/$(PROTO).xml
> mkdir -p gen
> $(SCANNER) private-code $< $@
gen/xdg-shell-protocol.c: $(XDGXML)
> mkdir -p gen
> $(SCANNER) private-code $< $@
gen/%.o: gen/%.c
> $(CC) $(CFLAGS) -c -o $@ $<
swaytime.o: swaytime.c gen/$(PROTO)-client-protocol.h
> $(CC) $(CFLAGS) -c -o $@ $<
swaytime: swaytime.o gen/$(PROTO)-protocol.o gen/xdg-shell-protocol.o
> $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
install: swaytime
> install -Dm755 swaytime $(DESTDIR)$(BINDIR)/swaytime
> install -Dm644 swaytime.1 $(DESTDIR)$(MANDIR)/man1/swaytime.1
uninstall:
> rm -f $(DESTDIR)$(BINDIR)/swaytime $(DESTDIR)$(MANDIR)/man1/swaytime.1
clean:
> rm -rf gen swaytime swaytime.o
.PHONY: all install uninstall clean