summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2022-03-20 16:12:40 -0700
committerLee Duncan <lduncan@suse.com>2022-03-20 16:12:40 -0700
commitfd14dd8316b1317d3ee2ff28b9d013198be40d70 (patch)
tree285dc501850dd360dbd88dca962ec96059213ca8 /usr
parentf64890f2b90b53389e528559115a726072f71844 (diff)
downloadopen-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 'usr')
-rw-r--r--usr/Makefile18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr/Makefile b/usr/Makefile
index fe7430a..e7ba803 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -4,6 +4,11 @@ ifeq ($(TOPDIR),)
TOPDIR = ..
endif
+INSTALL = install
+
+DESTDR ?=
+SBINDIR ?= $(DESTDIR)/sbin
+
OSNAME=$(shell uname -s)
# allow users to override these
@@ -46,7 +51,9 @@ LDFLAGS += $(shell $(PKG_CONFIG) --libs libsystemd)
else
CFLAGS += -DNO_SYSTEMD
endif
-PROGRAMS = iscsid iscsiadm iscsistart
+
+PROGRAMS = iscsid iscsiadm iscsistart
+PROGRAMS_DEST = $(addprefix $(SBINDIR)/,$(PROGRAMS))
# libc compat files
SYSDEPS_SRCS = $(sort $(wildcard ../utils/sysdeps/*.o))
@@ -77,6 +84,15 @@ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o mntcheck
iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
iscsistart.o statics.o
$(CC) $(CFLAGS) $^ -o $@ -lcrypto -lrt $(LDFLAGS) $(ISCSI_LIB)
+
+install: $(SBINDIR) $(PROGRAMS_DEST)
+
+$(SBINDIR):
+ [ -d $@ ] || $(INSTALL) -d $@
+
+$(PROGRAMS_DEST): $(SBINDIR)/%: %
+ $(INSTALL) -m 755 $? $@
+
clean:
rm -f *.o $(PROGRAMS) .depend $(LIBSYS)