mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 06:02:33 +00:00
Keep source inventory, cleanup and shell lint helpers together. Update the Makefile, Debian packaging, scstadmin and the kernel, release and existing checkpatch callers in the same commit so each consumer uses a valid path. Keep run-shellcheck rooted at scripts/ after the move, preserving its coverage of all tracked Bash helpers. Source selection and the existing checkpatch exclusions are unchanged.
146 lines
4.5 KiB
Makefile
Executable File
146 lines
4.5 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
# See debhelper(7) (uncomment to enable)
|
|
# output every command that modifies files on the build system.
|
|
export DH_VERBOSE = 1
|
|
|
|
|
|
# see FEATURE AREAS in dpkg-buildflags(1)
|
|
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
|
|
|
# see ENVIRONMENT in dpkg-buildflags(1)
|
|
# package maintainers to append CFLAGS
|
|
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
|
|
# package maintainers to append LDFLAGS
|
|
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
|
|
|
# rules won't see variables unless they're using DEB_foo_SET syntax. So use that as
|
|
# an intermediary. Also, export variables for sub-makes to be able to see them.
|
|
export KVER=$(DEB_KVER_SET)
|
|
export KDIR=$(DEB_KDIR_SET)
|
|
export CC=$(DEB_CC_SET)
|
|
export QLA_DIR=$(DEB_QLA_DIR_SET)
|
|
export QLA_INI_DIR=$(DEB_QLA_INI_DIR_SET)
|
|
export PKG_BUILD_MODE=$(DEB_PKG_BUILD_MODE)
|
|
DEB_WERROR_SET?=n
|
|
export WERROR=$(DEB_WERROR_SET)
|
|
ifeq ($(WERROR),y)
|
|
ifeq ($(filter -Werror,$(CFLAGS)),)
|
|
override CFLAGS += -Werror
|
|
endif
|
|
ifeq ($(filter -Werror,$(KCFLAGS)),)
|
|
override KCFLAGS += -Werror
|
|
endif
|
|
export CFLAGS KCFLAGS
|
|
endif
|
|
|
|
# Default to building optional modules (override by changing specific ?=m to =n)
|
|
CONFIG_SCST_LOCAL?=m
|
|
CONFIG_SCST_SRPT?=m
|
|
CONFIG_SCST_TAPE?=m
|
|
CONFIG_SCST_CDROM?=m
|
|
CONFIG_SCST_MODISK?=m
|
|
CONFIG_SCST_CHANGER?=m
|
|
CONFIG_SCST_RAID?=m
|
|
CONFIG_SCST_PROCESSOR?=m
|
|
CONFIG_SCST_USER?=m
|
|
export CONFIG_SCST_LOCAL CONFIG_SCST_SRPT CONFIG_SCST_TAPE CONFIG_SCST_CDROM CONFIG_SCST_MODISK CONFIG_SCST_CHANGER CONFIG_SCST_RAID CONFIG_SCST_PROCESSOR CONFIG_SCST_USER
|
|
|
|
FCST=$(shell grep -qw '^CONFIG_LIBFC' /boot/config-$(KVER) && echo fcst)
|
|
ISCSI_SCST=iscsi-scst
|
|
SCST_LOCAL=$(shell [ "${CONFIG_SCST_LOCAL}" != "n" ] && echo scst_local)
|
|
SCST_SRPT=$(shell [ "${CONFIG_SCST_SRPT}" != "n" ] && echo srpt)
|
|
SUBDIRS=scst $(FCST) $(ISCSI_SCST) $(QLA_DIR) $(SCST_LOCAL) scstadmin $(SCST_SRPT)
|
|
DESTDIR=$(CURDIR)/debian/tmp
|
|
VERSION:=$(shell head -n1 debian/changelog | sed 's/.*(\([0-9.]*\).*).*/\1/')
|
|
|
|
%:
|
|
echo "*** dh $@ ***"
|
|
dh $@
|
|
|
|
clean:
|
|
dh_testdir && \
|
|
dh_prep -Xqla_isp/TAGS -Xdebian/changelog && \
|
|
scripts/source/clean-source-tree -x debian/changelog -x debian/compat -x debian/scst.preinst \
|
|
-x debian/scst.postinst
|
|
|
|
build:
|
|
[ -n "$(QLA_INI_DIR)" ] && \
|
|
make $(PKG_BUILD_MODE) && \
|
|
export BUILD_2X_MODULE=y && \
|
|
export CONFIG_SCSI_QLA_FC=y && \
|
|
export CONFIG_SCSI_QLA2XXX_TARGET=y && \
|
|
for d in $(SUBDIRS); do $(MAKE) -C $$d || exit $$?; done
|
|
|
|
build-indep: build
|
|
|
|
build-arch: build
|
|
|
|
install:
|
|
[ -n "$(VERSION)" ] && \
|
|
dh_testdir && \
|
|
export PREFIX=/usr && \
|
|
export DESTDIR="$(DESTDIR)" && \
|
|
export BUILD_2X_MODULE=y && \
|
|
export CONFIG_SCSI_QLA_FC=y && \
|
|
export CONFIG_SCSI_QLA2XXX_TARGET=y && \
|
|
for d in $(SUBDIRS); do \
|
|
if [ $$d = scst ]; then \
|
|
$(MAKE) -C $$d install || exit $$?; \
|
|
else \
|
|
INSTALL_MOD_PATH="$(DESTDIR)" $(MAKE) -C $$d install || \
|
|
exit $$?; \
|
|
fi; \
|
|
done && \
|
|
make $(PKG_BUILD_MODE) && \
|
|
rm -f "$(DESTDIR)"/lib/modules/*/[Mm]odule* && \
|
|
mkdir -p $(DESTDIR)/usr/src/scst-$(VERSION) && \
|
|
{ \
|
|
echo dkms.conf && \
|
|
echo Makefile && \
|
|
for d in fcst iscsi-scst $(QLA_INI_DIR) scst $(SCST_LOCAL) $(SCST_SRPT); do\
|
|
echo $$d; \
|
|
done; \
|
|
} | sed "s,^,usr/src/scst-$(VERSION)/," >debian/scst-dkms.install &&\
|
|
for f in scst.dkms scst-dkms.postinst scst-dkms.prerm; do \
|
|
sed "s/\$${PACKAGE_VERSION}/$(VERSION)/; \
|
|
s/\$${PKG_BUILD_MODE}/$(PKG_BUILD_MODE)/" \
|
|
< debian/$$f.in >debian/$$f || exit $?; \
|
|
done && \
|
|
cp debian/scst.dkms \
|
|
$(DESTDIR)/usr/src/scst-$(VERSION)/dkms.conf && \
|
|
scripts/source/list-source-files | \
|
|
grep -E '^Makefile$$|^(fcst|iscsi-scst|$(QLA_INI_DIR)|scst|$(SCST_LOCAL)|$(SCST_SRPT))/'|\
|
|
tar -T- -cf- | \
|
|
tar -C $(DESTDIR)/usr/src/scst-$(VERSION) -xf- && \
|
|
find $(DESTDIR) -type f -print0 | xargs -0 -r chmod 0644 && \
|
|
find $(DESTDIR) -type d -print0 | xargs -0 -r chmod 0755 && \
|
|
mv "$(DESTDIR)"/usr/man "$(DESTDIR)"/usr/share/man && \
|
|
dh_install && \
|
|
dh_installman && \
|
|
dh_installsystemd --name=scst --no-start && \
|
|
dh_installchangelogs && \
|
|
dh_compress && \
|
|
dh_fixperms && \
|
|
dh_strip && \
|
|
dh_makeshlibs && \
|
|
dh_shlibdeps && \
|
|
dh_installdeb && \
|
|
dh_gencontrol && \
|
|
dh_md5sums && \
|
|
dh_builddeb
|
|
|
|
binary-indep: install
|
|
|
|
binary-arch: install
|
|
|
|
binary: binary-indep binary-arch
|
|
|
|
override_dh_installinit:
|
|
dh_installinit --onlyscripts
|
|
|
|
override_dh_auto_configure:
|
|
true
|
|
|
|
.PHONY: clean binary binary-arch binary-indep build build-arch build-indep \
|
|
install
|