summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2022-03-23 09:46:34 -0700
committerGitHub <noreply@github.com>2022-03-23 09:46:34 -0700
commitec7eae680c2d6bc2f1852091cafce45e00e93f45 (patch)
tree03dc2ccce55c085a19ae48bc52ef8c33415e3848 /usr
parent53c51a7525435c539697da128081e54fad13df09 (diff)
parentfd14dd8316b1317d3ee2ff28b9d013198be40d70 (diff)
downloadopen-iscsi-ec7eae680c2d6bc2f1852091cafce45e00e93f45.tar.gz
Merge pull request #324 from gonzoleeman/cleanup_build_system_and_templates
Clean up Makefile build system.
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)