Makefile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. PREFIX:=/usr
  2. DESTDIR:=
  3. PLATFORM:=linux
  4. PKG_CONFIG:=$(shell which pkg-config 2>/dev/null)
  5. UNIT_DIR:=$(if $(PKG_CONFIG),\
  6. $(DESTDIR)$(shell $(PKG_CONFIG) --variable systemdsystemunitdir systemd),\
  7. $(DESTDIR)$(PREFIX)/lib/systemd/system)
  8. all:
  9. @echo "Run 'make install' to install."
  10. .PHONY: install
  11. install: install-$(PLATFORM)
  12. .PHONY: install-openwrt
  13. install-openwrt: install-lib
  14. install -m 0755 -d $(DESTDIR)/etc/hotplug.d/iface $(DESTDIR)/etc/config \
  15. $(DESTDIR)/etc/init.d
  16. install -m 0600 platform/openwrt/sqm-hotplug $(DESTDIR)/etc/hotplug.d/iface/11-sqm
  17. install -m 0755 platform/openwrt/sqm-init $(DESTDIR)/etc/init.d/sqm
  18. install -m 0644 platform/openwrt/sqm-uci $(DESTDIR)/etc/config/sqm
  19. install -m 0744 src/run-openwrt.sh $(DESTDIR)$(PREFIX)/lib/sqm/run.sh
  20. .PHONY: install-linux
  21. install-linux: install-lib
  22. install -m 0755 -d $(UNIT_DIR) $(DESTDIR)$(PREFIX)/lib/tmpfiles.d \
  23. $(DESTDIR)$(PREFIX)/bin
  24. install -m 0644 -C -b platform/linux/default.conf $(DESTDIR)/etc/sqm
  25. install -m 0644 platform/linux/sqm@.service $(UNIT_DIR)
  26. install -m 0644 platform/linux/sqm-tmpfiles.conf \
  27. $(DESTDIR)$(PREFIX)/lib/tmpfiles.d/sqm.conf
  28. install -m 0755 platform/linux/sqm-bin $(DESTDIR)$(PREFIX)/bin/sqm
  29. test -d $(DESTDIR)/etc/network/if-up.d && install -m 0755 platform/linux/sqm-ifup \
  30. $(DESTDIR)/etc/network/if-up.d/sqm || exit 0
  31. .PHONY: install-lib
  32. install-lib:
  33. install -m 0755 -d $(DESTDIR)/etc/sqm $(DESTDIR)$(PREFIX)/lib/sqm
  34. install -m 0644 -C -b platform/$(PLATFORM)/sqm.conf $(DESTDIR)/etc/sqm/sqm.conf
  35. install -m 0644 src/functions.sh src/defaults.sh \
  36. src/*.qos src/*.help $(DESTDIR)$(PREFIX)/lib/sqm
  37. install -m 0744 src/start-sqm src/stop-sqm src/update-available-qdiscs \
  38. $(DESTDIR)$(PREFIX)/lib/sqm
  39. .PHONY: uninstall
  40. uninstall: uninstall-$(PLATFORM)
  41. .PHONY: uninstall-openwrt
  42. uninstall-openwrt: uninstall-lib
  43. @for f in $(DESTDIR)/etc/hotplug.d/iface/11-sqm $(DESTDIR)/etc/init.d/sqm; do \
  44. if [ -f "$$f" ]; then rm -vf "$$f"; fi; done
  45. @echo "Not removing config in $(DESTDIR)/etc/sqm and $(DESTDIR)/etc/config/sqm - remove manually if needed"
  46. .PHONY: uninstall-linux
  47. uninstall-linux: uninstall-lib
  48. @for f in $(UNIT_DIR)/sqm@.service $(DESTDIR)$(PREFIX)/lib/tmpfiles.d/sqm.conf \
  49. $(DESTDIR)$(PREFIX)/bin/sqm $(DESTDIR)/etc/network/if-up.d/sqm; do \
  50. if [ -f "$$f" ]; then rm -vf "$$f"; fi; done
  51. @echo "Not removing config in $(DESTDIR)/etc/sqm - remove manually if needed"
  52. .PHONY: uninstall-lib
  53. uninstall-lib:
  54. @for f in $(DESTDIR)$(PREFIX)/lib/sqm/*; do \
  55. if [ -f "$$f" ]; then rm -vf "$$f"; fi; done
  56. @rmdir -v $(DESTDIR)$(PREFIX)/lib/sqm