A device-file manager and filesystem for *nix
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

117 lines
3.2 KiB

  1. include ../buildconf.mk
  2. ACTIONS := $(wildcard actions/*.act)
  3. ACTIONS_BUILD := $(patsubst actions/%.act,$(BUILD_VDEV_CONFIG)/actions/%.act,$(ACTIONS))
  4. ACTIONS_INSTALL := $(patsubst actions/%.act,$(INSTALL_VDEV_CONFIG)/actions/%.act,$(ACTIONS))
  5. IFNAMES_BUILD := $(BUILD_VDEV_CONFIG)/ifnames.conf
  6. IFNAMES_INSTALL := $(INSTALL_VDEV_CONFIG)/ifnames.conf
  7. CONF_BUILD := $(BUILD_VDEV_CONFIG)/vdevd.conf
  8. CONF_INSTALL := $(INSTALL_VDEV_CONFIG)/vdevd.conf
  9. INITSCRIPT_BUILD := $(BUILD_VDEV_INITSCRIPT)/vdev
  10. INITSCRIPT_INSTALL := $(INSTALL_VDEV_INITSCRIPT)/vdev
  11. INITRAMFS_FILES := $(wildcard initramfs/hooks/*) \
  12. $(wildcard initramfs/scripts/init-bottom/*) \
  13. $(wildcard initramfs/scripts/init-top/*) \
  14. $(wildcard initramfs/init)
  15. INITRAMFS_BUILD := $(patsubst initramfs/%,$(BUILD_VDEV_INITRAMFS)/%,$(INITRAMFS_FILES))
  16. INITRAMFS_INSTALL := $(patsubst initramfs/%,$(INSTALL_VDEV_INITRAMFS)/%,$(INITRAMFS_FILES))
  17. VDEV_CONFIG_BUILD := $(CONF_BUILD) $(ACTIONS_BUILD) $(IFNAMES_BUILD) $(INITSCRIPT_BUILD) $(INITRAMFS_BUILD)
  18. VDEV_CONFIG_INSTALL := $(CONF_INSTALL) $(ACTIONS_INSTALL) $(IFNAMES_INSTALL) $(INITSCRIPT_INSTALL)
  19. TOOLS := ../tools/
  20. VDEVD := ../vdevd/
  21. GEN_IFNAMES := $(BUILD_VDEVD_HELPERS)/gen-ifnames.sh
  22. MKINITRAMFS := make-initramfs.sh
  23. VDEV_INSTALL_SCRIPT := vdev-install.sh
  24. # debugging
  25. print-%: ; @echo $*=$($*)
  26. all: $(VDEV_CONFIG_BUILD)
  27. $(CONF_BUILD): vdevd.conf.in
  28. @mkdir -p $(shell dirname "$@")
  29. @cat "$<" | \
  30. sed -e 's~@PREFIX@~$(PREFIX)~g;' \
  31. -e 's~@CONF_DIR@~$(ETCDIR_VDEV)~g;' \
  32. -e 's~@RUN_DIR@~$(RUNDIR_VDEV)~g;' \
  33. -e 's~@LOG_DIR@~$(LOGDIR_VDEV)~g;' > "$@"
  34. $(IFNAMES_BUILD): ifnames.conf.in
  35. @mkdir -p $(shell dirname "$@")
  36. @rm -f "$@"
  37. @cat "$<" > "$@"
  38. $(GEN_IFNAMES) >> "$@"
  39. $(INITSCRIPT_BUILD): sysv-initscript.sh
  40. @mkdir -p $(shell dirname "$@")
  41. @cp -a "$<" "$@"
  42. $(BUILD_VDEV_CONFIG)/actions/%: actions/%
  43. @mkdir -p $(shell dirname "$@")
  44. @rm -f "$@"
  45. @cat "$<" > "$@"
  46. $(BUILD_VDEV_INITRAMFS)/%: initramfs/%
  47. @mkdir -p $(shell dirname "$@")
  48. @cp -a "$<" "$@"
  49. $(CONF_INSTALL): $(CONF_BUILD)
  50. @mkdir -p $(shell dirname "$@")
  51. @rm -f "$@"
  52. @cat "$<" > "$@"
  53. $(IFNAMES_INSTALL): $(IFNAMES_BUILD)
  54. @mkdir -p $(shell dirname "$@")
  55. @rm -f "$@"
  56. @cat "$<" > "$@"
  57. $(INITSCRIPT_INSTALL): $(INITSCRIPT_BUILD)
  58. @mkdir -p $(shell dirname "$@")
  59. @cp -a "$<" "$@"
  60. $(INSTALL_VDEV_CONFIG)/actions/%: $(BUILD_VDEV_CONFIG)/actions/%
  61. @mkdir -p $(shell dirname "$@")
  62. @rm -f "$@"
  63. @cat "$<" > "$@"
  64. $(INSTALL_VDEV_INITRAMFS)/%: $(BUILD_VDEV_INITRAMFS)/%
  65. @mkdir -p $(shell dirname "$@")
  66. @cp -a "$<" "$@"
  67. .PHONY: initramfs
  68. initramfs: $(VDEV_CONFIG_INSTALL) $(INITSCRIPT_INSTALL)
  69. $(SHELL) ./$(MKINITRAMFS)
  70. .PHONY: install
  71. install: $(VDEV_CONFIG_INSTALL)
  72. .PHONY: install-initscript
  73. install-initscript: $(VDEV_CONFIG_INSTALL)
  74. $(SHELL) ./$(VDEV_INSTALL_SCRIPT) $(DESTDIR)$(PREFIX)
  75. .PHONY: clean
  76. clean:
  77. rm -f $(VDEV_CONFIG_BUILD)
  78. .PHONY: uninstall
  79. uninstall:
  80. rm -f $(VDEV_CONFIG_INSTALL)
  81. update-rc.d -f vdev remove || true
  82. @echo ""
  83. @echo "vdev configuration and init scripts have been removed."
  84. @echo "You will need to re-enable your previous device manager."
  85. @echo ""
  86. @echo "Example (on Debian systems):"
  87. @echo " $$ sudo update-rc.d udev defaults"
  88. @echo " $$ sudo update-rc.d udev-finish defaults"
  89. @echo " $$ sudo insserv"
  90. @echo ""