diff options
author | Lee Duncan <lduncan@suse.com> | 2022-03-20 16:12:40 -0700 |
---|---|---|
committer | Lee Duncan <lduncan@suse.com> | 2022-03-20 16:12:40 -0700 |
commit | fd14dd8316b1317d3ee2ff28b9d013198be40d70 (patch) | |
tree | 285dc501850dd360dbd88dca962ec96059213ca8 /etc | |
parent | f64890f2b90b53389e528559115a726072f71844 (diff) | |
download | open-iscsi-fd14dd8316b1317d3ee2ff28b9d013198be40d70.tar.gz |
Clean up Makefile build system.
A major overdue overhaul of the Make layout, including
moving lots of lower-level things out of the top-level
Makefile into the Makefiles for the appropriate subdirectory,
renaming the template files (where @SBINDIR@ gets translated)
so that their purpose is more obvious, making the build more
idempotent (no need to install a file if it's not newer).
Should be no functional change, as no script or C file changed.
Main difference from before: now the udev rules gets made and
installed by default (as part of "make"/"make install"), and
the iscsiuio daemon is now installed for "make install".
One should now be able to go into any subdirectory and type
"make"/"make install" to build and install the targets from
that directory, at least for the etc, utils, and usr
subdirectories.
This change is in preparation for more template translations
coming.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/Makefile | 81 | ||||
-rw-r--r-- | etc/systemd/.gitignore | 4 | ||||
-rw-r--r-- | etc/systemd/iscsi-init.service.template (renamed from etc/systemd/iscsi-init.service) | 0 | ||||
-rw-r--r-- | etc/systemd/iscsi.service.template (renamed from etc/systemd/iscsi.service) | 0 | ||||
-rw-r--r-- | etc/systemd/iscsid.service.template (renamed from etc/systemd/iscsid.service) | 0 | ||||
-rw-r--r-- | etc/systemd/iscsiuio.service.template (renamed from etc/systemd/iscsiuio.service) | 0 |
6 files changed, 85 insertions, 0 deletions
diff --git a/etc/Makefile b/etc/Makefile new file mode 100644 index 0000000..8a7d7c0 --- /dev/null +++ b/etc/Makefile @@ -0,0 +1,81 @@ +# +# gnu Makefile for the etc subdirectory, including +# initd and systemd subdirectories +# + +prefix = /usr +DESTDIR ?= +SBINDIR ?= $(DESTDIR)/sbin + +systemddir ?= $(DESTDIR)$(prefix)/lib/systemd +etcdir = $(DESTDIR)/etc +initddir ?= $(etcdir)/init.d + +HOMEDIR ?= $(etcdir)/iscsi + +SED = /usr/bin/sed +INSTALL = install + +SYSTEMD_SOURCE_FILES = iscsid.socket iscsiuio.socket +SYSTEMD_SOURCES = $(addprefix systemd/,$(SYSTEMD_SOURCE_FILES)) +SYSTEMD_TEMPLATE_FILES = iscsi-init.service.template \ + iscsid.service.template \ + iscsi.service.template \ + iscsiuio.service.template +SYSTEMD_TEMPLATES = $(addprefix systemd/,$(SYSTEMD_TEMPLATE_FILES)) +SYSTEMD_GENERATED_SERVICE_FILES = $(SYSTEMD_TEMPLATES:.template=) +SYSTEMD_DEST_FILES = $(addprefix $(systemddir)/system/,$(notdir $(SYSTEMD_SOURCES))) \ + $(addprefix $(systemddir)/system/,$(notdir $(SYSTEMD_GENERATED_SERVICE_FILES))) +IFACE_FILES = iface.example +IFACE_DEST_FILES = $(addprefix $(HOMEDIR)/ifaces/,$(IFACE_FILES)) +ETC_FILES = iscsid.conf +ETC_DEST_FILES = $(addprefix $(HOMEDIR)/,$(ETC_FILES)) + +all: $(SYSTEMD_SOURCES) $(SYSTEMD_GENERATED_SERVICE_FILES) + +$(SYSTEMD_GENERATED_SERVICE_FILES): systemd/%.service: systemd/%.service.template + $(SED) -e 's:@SBINDIR@:$(SBINDIR):' $? > $@ + +install: install_systemd install_iface install_etc + +install_iface: $(IFACE_DEST_FILES) + +$(IFACE_DEST_FILES): $(HOMEDIR)/ifaces/%: % + $(INSTALL) -m 644 $? $@ + +install_etc: $(ETC_DEST_FILES) + +$(ETC_DEST_FILES): $(HOMEDIR)/%: % + $(INSTALL) -m 644 $? $@ + +install_initd_distro = $(INSTALL) -m 755 $(1) $(initddir)/open-iscsi/ + +install_initd: $(initddir)/open-iscsi + @if [ -f /etc/debian_version ]; then \ + $(call install_initd_distro,initd/initd.redhat) ; \ + elif [ -f /etc/redhat-release ]; then \ + $(call install_initd_distro,initd/initd.debian) ; \ + fi + +$(initddir)/open-iscsi: + [ -d $@ ] || $(INSTALL) -d $@ + +install_initd_redhat: $(initddir)/open-iscsi + $(call install_initd_distro,initd/initd.redhat) + +install_initd_debian: $(initddir)/open-iscsi + $(call install_initd_distro,initd/initd.debian) + +install_systemd: $(systemddir)/system $(SYSTEMD_DEST_FILES) + +$(systemddir)/system: + [ -d $@ ] || $(INSTALL) -d -m 775 $@ + +$(SYSTEMD_DEST_FILES): $(systemddir)/system/%: systemd/% + $(INSTALL) $? $@ + +clean: + $(RM) $(SYSTEMD_GENERATED_SERVICE_FILES) + +.PHONY: all clean install install_iface install_initd install_initd_redhat \ + install_initd_debian install_systemd diff --git a/etc/systemd/.gitignore b/etc/systemd/.gitignore new file mode 100644 index 0000000..2b3a64e --- /dev/null +++ b/etc/systemd/.gitignore @@ -0,0 +1,4 @@ +iscsi-init.service +iscsi.service +iscsid.service +iscsiuio.service diff --git a/etc/systemd/iscsi-init.service b/etc/systemd/iscsi-init.service.template index 8f9a8aa..8f9a8aa 100644 --- a/etc/systemd/iscsi-init.service +++ b/etc/systemd/iscsi-init.service.template diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service.template index 6becab4..6becab4 100644 --- a/etc/systemd/iscsi.service +++ b/etc/systemd/iscsi.service.template diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service.template index e2a50d3..e2a50d3 100644 --- a/etc/systemd/iscsid.service +++ b/etc/systemd/iscsid.service.template diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service.template index 2e721fe..2e721fe 100644 --- a/etc/systemd/iscsiuio.service +++ b/etc/systemd/iscsiuio.service.template |