To build (using autotools):
---------------------------
The conventional pattern is:
    # ./autogen.sh
    # ./configure
    # make

To install (using autools) call:
 $ make install
This will most likely need superuser privilege. The executable is placed
in the /usr/local/bin directory while the man page is placed in the
/usr/local/man/man8 directory. The install directory are controlled by
the PREFIX variable in the Makefile. To install executable in the /usr/bin
directory use './configure --prefix=/usr ' instead.

To uninstall (using autotools) the executable and man pages call:
    # make uninstall

To clean out object and executable files from the working directory call:
    # make clean

To clean out prior to making a tarball (so ./configure needs to be run
on the target system):
    # make distclean

To build using cmake
--------------------
This is experimental: expect some rough edges.
    # cd {top_level_directory_of_lscsi_package}
    # cmake  .
    # cmake  --build .

The last cmake invocation needs root permissions. 'make clean' does
the same thing as it does in autotools. There is no 'make distclean'
so the above sequence leaves a lot of garbage "on the floor".
The ./cmake_del_artifacts.sh script cleans up most of that.
To build static executable(s) instead of 'cmake .' use
    # cmake . -DBUILD_SHARED_LIBS=OFF

The following places the executable in the /usr/bin directory, the man
pages in the /usr/share/man/man8 directory, and other documentation in
the /usr/share/doc/lsscsi directory.
    # sudo cmake  --install . --prefix=/usr

Rather than the last step (i.e. 'cmake --install . ') this invocation:
    # cpack .

will build a "deb" and a "rpm" package and place them in the current
directory. Root permissions are not required. The package that is
appropriate for the machine's Linux distribution can be installed with:
    # dpkg -i <package>.deb
or
    # rpm -iv <package>.rpm
and that will require root permissions.

Prebuild packages may also be available
---------------------------------------
Rpms are also available. A lsscsi.spec file is included in the tarball
to facilitate building rpms. One way of doing this on a RedHat system
is to place the tarball of the form 'lsscsi-%{version}.tar.gz' in the
/usr/src/redhat/SOURCE directory and the spec file in the
/usr/src/redhat/SPEC directory. Then execute 'rpmbuild -ba lsscsi.spec'
from the "SPEC" directory. [Specifying the
target may help (e.g. 'rpmbuild --target=x86_64 -ba lsscsi.spec') . If
successful that will deposit the binary rpm in the
/usr/src/redhat/RPMS/x86_64 directory and the source rpm in the
/usr/src/redhat/SRPMS directory. Building an rpm on Suse is similar
(although they use their name rather than "redhat" in the above paths).


To build a Linux debian "deb" (binary) package, first untar the tarball,
then change directory to the top level within the lsscsi source. Then:
    # chmod +x debian/rules
    # dpkg-buildpackage -b -rfakeroot
The binary deb packages will be placed in the parent directory (of
the lsscsi source directory) if all goes well.
There is a build_debian.sh script in the tarball's top level directory
that does the above.

Douglas Gilbert
20th June 2026
