-
Notifications
You must be signed in to change notification settings - Fork 63
/
Makefile
65 lines (56 loc) · 2.53 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
PREFIX:=/usr
DESTDIR:=
PLATFORM:=linux
PKG_CONFIG:=$(shell which pkg-config 2>/dev/null)
UNIT_DIR:=$(if $(PKG_CONFIG),\
$(DESTDIR)$(shell $(PKG_CONFIG) --variable systemdsystemunitdir systemd),\
$(DESTDIR)$(PREFIX)/lib/systemd/system)
all:
@echo "Run 'make install' to install."
.PHONY: install
install: install-$(PLATFORM)
.PHONY: install-openwrt
install-openwrt: install-lib
install -m 0755 -d $(DESTDIR)/etc/hotplug.d/iface $(DESTDIR)/etc/config \
$(DESTDIR)/etc/init.d
install -m 0600 platform/openwrt/sqm-hotplug $(DESTDIR)/etc/hotplug.d/iface/11-sqm
install -m 0755 platform/openwrt/sqm-init $(DESTDIR)/etc/init.d/sqm
install -m 0644 platform/openwrt/sqm-uci $(DESTDIR)/etc/config/sqm
install -m 0744 src/run-openwrt.sh $(DESTDIR)$(PREFIX)/lib/sqm/run.sh
.PHONY: install-linux
install-linux: install-lib
install -m 0755 -d $(UNIT_DIR) $(DESTDIR)$(PREFIX)/lib/tmpfiles.d \
$(DESTDIR)$(PREFIX)/bin
install -m 0644 -C -b platform/linux/default.conf $(DESTDIR)/etc/sqm
install -m 0644 platform/linux/[email protected] $(UNIT_DIR)
install -m 0644 platform/linux/sqm-tmpfiles.conf \
$(DESTDIR)$(PREFIX)/lib/tmpfiles.d/sqm.conf
install -m 0755 platform/linux/sqm-bin $(DESTDIR)$(PREFIX)/bin/sqm
test -d $(DESTDIR)/etc/network/if-up.d && install -m 0755 platform/linux/sqm-ifup \
$(DESTDIR)/etc/network/if-up.d/sqm || exit 0
.PHONY: install-lib
install-lib:
install -m 0755 -d $(DESTDIR)/etc/sqm $(DESTDIR)$(PREFIX)/lib/sqm
install -m 0644 -C -b platform/$(PLATFORM)/sqm.conf $(DESTDIR)/etc/sqm/sqm.conf
install -m 0644 src/functions.sh src/defaults.sh \
src/*.qos src/*.help $(DESTDIR)$(PREFIX)/lib/sqm
install -m 0744 src/start-sqm src/stop-sqm src/update-available-qdiscs \
$(DESTDIR)$(PREFIX)/lib/sqm
.PHONY: uninstall
uninstall: uninstall-$(PLATFORM)
.PHONY: uninstall-openwrt
uninstall-openwrt: uninstall-lib
@for f in $(DESTDIR)/etc/hotplug.d/iface/11-sqm $(DESTDIR)/etc/init.d/sqm; do \
if [ -f "$$f" ]; then rm -vf "$$f"; fi; done
@echo "Not removing config in $(DESTDIR)/etc/sqm and $(DESTDIR)/etc/config/sqm - remove manually if needed"
.PHONY: uninstall-linux
uninstall-linux: uninstall-lib
@for f in $(UNIT_DIR)/[email protected] $(DESTDIR)$(PREFIX)/lib/tmpfiles.d/sqm.conf \
$(DESTDIR)$(PREFIX)/bin/sqm $(DESTDIR)/etc/network/if-up.d/sqm; do \
if [ -f "$$f" ]; then rm -vf "$$f"; fi; done
@echo "Not removing config in $(DESTDIR)/etc/sqm - remove manually if needed"
.PHONY: uninstall-lib
uninstall-lib:
@for f in $(DESTDIR)$(PREFIX)/lib/sqm/*; do \
if [ -f "$$f" ]; then rm -vf "$$f"; fi; done
@rmdir -v $(DESTDIR)$(PREFIX)/lib/sqm