nixos-dotfiles

nixos-dotfiles

https://git.tonybtw.com/nixos-dotfiles.git git://git.tonybtw.com/nixos-dotfiles.git
3,040 bytes raw
1
.POSIX:
2
.SUFFIXES:
3
4
include config.mk
5
6
# flags for compiling
7
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \
8
	-DVERSION=\"$(VERSION)\" $(XWAYLAND)
9
DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \
10
	-Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \
11
	-Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types \
12
	-Wfloat-conversion
13
14
# CFLAGS / LDFLAGS
15
PKGS      = wayland-server xkbcommon libinput pixman-1 fcft $(XLIBS)
16
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
17
LDLIBS    = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
18
19
all: dwl
20
dwl: dwl.o util.o
21
	$(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
22
dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h \
23
	pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h \
24
	wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h
25
util.o: util.c util.h
26
27
# wayland-scanner is a tool which generates C headers and rigging for Wayland
28
# protocols, which are specified in XML. wlroots requires you to rig these up
29
# to your build system yourself and provide them in the include path.
30
WAYLAND_SCANNER   = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
31
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
32
33
cursor-shape-v1-protocol.h:
34
	$(WAYLAND_SCANNER) enum-header \
35
		$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
36
pointer-constraints-unstable-v1-protocol.h:
37
	$(WAYLAND_SCANNER) enum-header \
38
		$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
39
wlr-layer-shell-unstable-v1-protocol.h:
40
	$(WAYLAND_SCANNER) enum-header \
41
		protocols/wlr-layer-shell-unstable-v1.xml $@
42
wlr-output-power-management-unstable-v1-protocol.h:
43
	$(WAYLAND_SCANNER) server-header \
44
		protocols/wlr-output-power-management-unstable-v1.xml $@
45
xdg-shell-protocol.h:
46
	$(WAYLAND_SCANNER) server-header \
47
		$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
48
49
config.h:
50
	cp config.def.h $@
51
clean:
52
	rm -f dwl *.o *-protocol.h
53
54
dist: clean
55
	mkdir -p dwl-$(VERSION)
56
	cp -R LICENSE* Makefile CHANGELOG.md README.md client.h config.def.h \
57
		config.mk protocols dwl.1 dwl.c util.c util.h dwl.desktop \
58
		dwl-$(VERSION)
59
	tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION)
60
	rm -rf dwl-$(VERSION)
61
62
install: dwl
63
	mkdir -p $(DESTDIR)$(PREFIX)/bin
64
	rm -f $(DESTDIR)$(PREFIX)/bin/dwl
65
	cp -f dwl $(DESTDIR)$(PREFIX)/bin
66
	chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl
67
	mkdir -p $(DESTDIR)$(MANDIR)/man1
68
	cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1
69
	chmod 644 $(DESTDIR)$(MANDIR)/man1/dwl.1
70
	mkdir -p $(DESTDIR)$(DATADIR)/wayland-sessions
71
	cp -f dwl.desktop $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
72
	chmod 644 $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
73
uninstall:
74
	rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 \
75
		$(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
76
77
.SUFFIXES: .c .o
78
.c.o:
79
	$(CC) $(CPPFLAGS) $(DWLCFLAGS) -o $@ -c $<