-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
32 lines (24 loc) · 901 Bytes
/
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
PREFIX?=/opt/bottled-shell
TARGET=target/release/bottled-shell target/release/bottled
SOURCES=$(wildcard src/**/*.rs)
TEMPDIR=.build
PACKAGE=$(TEMPDIR)/installer.sh
CARGO?=cargo
.PHONY: all package install clean
all: $(TARGET)
package: $(PACKAGE)
$(TARGET): $(SOURCES)
$(CARGO) build --release --locked --all-features
$(PACKAGE): $(TARGET)
install -Dm555 target/release/bottled $(TEMPDIR)/prefix/bin/bottled && \
tar --owner=root --group=root --mode=4555 -C $(TEMPDIR)/prefix \
-cf $(TEMPDIR)/snapshot.tar bin/bottled && \
install -Dm555 target/release/bottled-shell $(TEMPDIR)/prefix/bin/bottled-shell && \
tar --owner=root --group=root -C $(TEMPDIR)/prefix \
-uf $(TEMPDIR)/snapshot.tar bin/bottled-shell && \
cat package/self-extracting/installer.sh $(TEMPDIR)/snapshot.tar >$(TEMPDIR)/installer.sh
install: $(PACKAGE)
bash $(PACKAGE)
clean:
$(RM) -R $(TEMPDIR)
$(CARGO) clean