-
Notifications
You must be signed in to change notification settings - Fork 9
/
makefile
111 lines (90 loc) · 2.87 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# dmenu-rs - dynamic menu
# See LICENSE file for copyright and license details.
include config.mk
ifeq ($(XINERAMA),true)
XINERAMA_FLAGS = --all-features # idk if there will ever be a workaround
endif
ifeq ($(CC),)
CC = cc
endif
export CARGOFLAGS
export RUSTFLAGS
export PLUGINS
export VERSION
export XINERAMA
export depcheck
export CC
all: options dmenu stest
options:
@echo "dmenu ($(VERSION)) build options:"
@echo "CC = $(CC)"
@echo "RUSTFLAGS = $(RUSTFLAGS)"
@echo "PLUGINS = $(PLUGINS)"
config: scaffold
cd src && cargo run --release -p config --bin config
$(MAKE) m4
dmenu: config
cd src && cargo run --release -p headers
cd src && cargo build -p dmenu-build --release $(XINERAMA_FLAGS) $(CARGOFLAGS)
cp src/target/release/dmenu target/
man: config
man target/dmenu.1
test: all
cd src && cargo test
seq 1 100 | target/dmenu $(ARGS)
debug: config
cd src && cargo build -p dmenu-build $(XINERAMA_FLAGS) $(CARGOFLAGS)
cp src/target/debug/dmenu target
seq 1 100 | target/dmenu $(ARGS)
plugins:
cd src && cargo run --release -p config --bin list-plugins
stest:
cd src && cargo build -p stest --release $(XINERAMA_FLAGS) $(CARGOFLAGS)
cp src/target/release/stest target/
cp src/man/src/stest.1 target/
scaffold:
mkdir -p target
mkdir -p target/build
touch target/build/deps.toml
$(MAKE) m4 # second round will finish deps
m4:
m4 src/build/CargoSource.toml > target/build/Cargo.toml
test -f src/build/Cargo.toml || cp target/build/Cargo.toml src/build/Cargo.toml
cmp -s -- target/build/Cargo.toml src/build/Cargo.toml || cp target/build/Cargo.toml src/build/Cargo.toml
clean: scaffold
cd src && cargo clean -p config -p dmenu-build -p headers
rm -rf src/target
rm -f vgcore* massif* src/build/Cargo.toml
rm -rf target
rm -rf dmenu-* # distribution files
rm -f src/Cargo.lock
fmt: config
cd src && cargo fmt
version:
@echo -n "${VERSION}"
dist:
mkdir -p dmenu-$(VERSION)
cp -r LICENSE README.md makefile config.mk src dmenu-$(VERSION)
tar -cf dmenu-$(VERSION).tar dmenu-$(VERSION)
gzip dmenu-$(VERSION).tar
rm -rf dmenu-$(VERSION)
# may need sudo
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f target/dmenu src/sh/dmenu_path src/sh/dmenu_run target/stest $(DESTDIR)$(PREFIX)/bin/
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path
chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run
chmod 755 $(DESTDIR)$(PREFIX)/bin/stest
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp target/dmenu.1 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
sed "s/VERSION/$(VERSION)/g" < target/stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\
$(DESTDIR)$(PREFIX)/bin/dmenu_path\
$(DESTDIR)$(PREFIX)/bin/dmenu_run\
$(DESTDIR)$(PREFIX)/bin/stest\
$(DESTDIR)$(MANPREFIX)/man1/dmenu.1\
$(DESTDIR)$(MANPREFIX)/man1/stest.1