-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (42 loc) · 1.54 KB
/
Makefile
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
# We need to use a makefile for building because we want to conditionally enable
# using the alsa and pulseaudio backends for both usage in the window manager
# and usage of the cargo dependency. We could enable the feature from build.rs
# but what won't allow us to conditionally include the crates and if the
# respective libraries are not installed those crates will give us a build error
# even if we don't use them.
FEATURES :=
ifeq ($(shell pkg-config --exists alsa; echo $$?),0)
FEATURES += alsa
endif
ifeq ($(shell pkg-config --exists libpulse; echo $$?),0)
FEATURES += pulse
endif
# We usually only want to build the window manager so for debug builds we only
# compile the utility programs if requested.
ifeq ($(BUILD_ALL),1)
CARGO_BIN :=
else
CARGO_BIN = --bin window_manager
endif
SRC = $(wildcard src/*.rs src/**/*.rs) build.rs Cargo.toml
BIN = target/debug/window_manager
RELBIN = target/release/window_manager
DESKTOP_FILE = window_manager.desktop
SESSION_PATH = /usr/share/xsessions/$(DESKTOP_FILE)
INSTALL_PREFIX ?= /usr/local/bin
COPY ?= cp -v
.PHONY: debug
debug: $(BIN)
.PHONY: release
release: $(RELBIN)
$(BIN): $(SRC)
cargo build $(CARGO_BIN) --no-default-features --features '$(FEATURES)'
$(RELBIN): $(SRC)
cargo build --release
$(SESSION_PATH): $(DESKTOP_FILE)
@$(COPY) $< $@
.PHONY: install
install: $(RELBIN) $(SESSION_PATH)
@$(COPY) $(RELBIN) $(INSTALL_PREFIX)/window_manager
@$(COPY) target/release/quit $(INSTALL_PREFIX)/window_manager_quit
@$(COPY) target/release/message_box $(INSTALL_PREFIX)/window_manager_message_box