-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (68 loc) · 2.33 KB
/
Makefile
File metadata and controls
83 lines (68 loc) · 2.33 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
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
export prefix ?= /usr
sysconfdir ?= /usr/share
bindir = $(prefix)/bin
includedir = $(prefix)/include
libdir = $(prefix)/lib
PACKAGE=pop_upgrade_gtk
LIB=lib$(PACKAGE).so
BIN=pop-upgrade
ID=com.system76.PopUpgrade
TESTING ?= 0
ifeq ($(TESTING),1)
ARGS += --features testing
endif
DEBUG ?= 0
TARGET = debug
ifeq ($(DEBUG),0)
ARGS += "--release"
TARGET = release
endif
VENDOR ?= 0
ifeq ($(VENDOR),1)
ARGS += "--frozen" "--offline"
endif
BINARY=target/$(TARGET)/$(BIN)
LIBRARY=target/$(TARGET)/$(LIB)
PKGCONFIG = target/$(PACKAGE).pc
HEADER = gtk/ffi/$(PACKAGE).h
NOTIFY = pop-upgrade-notify
NOTIFY_APPID = $(ID).Notify
STARTUP_DESKTOP = $(NOTIFY_APPID).desktop
.PHONY: all clean distclean install uninstall update vendor
all: $(BINARY) $(LIBRARY) $(PKGCONFIG)
clean:
cargo clean
distclean:
rm -rf .cargo vendor vendor.tar target
vendor:
mkdir -p .cargo
cargo vendor | head -n -1 > .cargo/config
echo 'directory = "vendor"' >> .cargo/config
tar pcf vendor.tar vendor
rm -rf vendor
extract-vendor:
ifeq ($(VENDOR),1)
rm -rf vendor; tar pxf vendor.tar
endif
install:
install -Dm0755 "$(BINARY)" "$(DESTDIR)$(bindir)/$(BIN)"
install -Dm0755 "data/$(BIN).sh" "$(DESTDIR)$(libdir)/$(BIN)/upgrade.sh"
install -Dm0644 "$(HEADER)" "$(DESTDIR)$(includedir)/$(PACKAGE).h"
install -Dm0644 "$(LIBRARY)" "$(DESTDIR)$(libdir)/$(LIB)"
install -Dm0644 "$(PKGCONFIG)" "$(DESTDIR)$(libdir)/pkgconfig/$(PACKAGE).pc"
install -Dm0644 "data/$(BIN)-init.service" "$(DESTDIR)$(libdir)/systemd/system/$(BIN)-init.service"
install -Dm0644 "data/$(BIN).conf" "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN).conf"
install -Dm0644 "data/$(BIN).service" "$(DESTDIR)$(libdir)/systemd/system/$(BIN).service"
install -Dm0644 "data/dbus-$(BIN).service" "$(DESTDIR)$(sysconfdir)/dbus-1/system-services/$(ID).service"
install -Dm0644 "data/$(NOTIFY).service" "$(DESTDIR)$(libdir)/systemd/user/$(NOTIFY).service"
install -Dm0644 "data/$(NOTIFY).timer" "$(DESTDIR)$(libdir)/systemd/user/$(NOTIFY).timer"
install -Dm0644 "data/$(STARTUP_DESKTOP)" "$(DESTDIR)/etc/xdg/autostart/$(STARTUP_DESKTOP)"
$(BINARY): extract-vendor
cargo build $(ARGS) -p pop-upgrade
$(LIBRARY): extract-vendor
cargo build $(ARGS) -p pop-upgrade-gtk-ffi
$(PKGCONFIG):
echo "libdir=$(libdir)" > "[email protected]"
echo "includedir=$(includedir)" >> "[email protected]"
cat "$(PKGCONFIG).stub" >> "[email protected]"
mv "[email protected]" "$@"