Unless otherwise noted, these install instructions are for the Linux operating system. See below for other operating systems. By default, the Makefile will build for Linux with a shared library. The invocation sequence is: make make install [may need root permission] Unless overridden or edited in the Makefile, INSTDIR places the executables in the /usr/local/bin directory, LIBDIR places libraries in the /usr/local/lib directory, MANDIR places the man pages in the /usr/local/share/man directory and INCLUDEDIR places header files in the /usr/local/include/scsi directory. For FreeBSD the default MANDIR is /usr/local/man . Other Makefile targets that might be useful: make clean # remove .o, executables, core and .depend file make depend # generate dependency hierarchy in .depend file make dep # same as 'make depend' make sg_inq # build a specific executable (e.g. 'sg_inq') make uninstall # removes executables, libraries and build remnants make -f no_lib/Makefile.linux # build without a library ./make_no_lib.sh sg_inq # is a simple script; in this case it expands to: # make -f no_lib/Makefile.linux sg_inq Note that the main Makefile does _not_ call the Makefiles in the subdirectories (i.e. archive, examples and utils directories). By default, this package now builds a shared library called libsgutils.so and the corresponding static library: libsgutils.a . The GNU "libtool" is required by sg3_utils to build its libraries. The 'make' will build those libraries and executables and put them in the ".libs" subdirectory (as libtool requires/enforces). The 'make' puts scripts in the main directory with the same names as the utilities (e.g. sg_dd, sg_inq etc) which set up an appropriate environment and call the "real" executable "hiding" in the ".libs" subdirectory. The "make install" will install the libraries in the /usr/local/lib directory. If an executable cannot find the libsgutils shared library (check with 'ldd sg_inq' for example) then the addition of "/usr/local/lib" to the /etc/ld.so.conf file may be required in some distributions. A "spec" file is included for building rpm packages. It is called sg3_utils.spec . To build binary and source rpms place a copy of the gzipped tarball in the "SOURCES" directory and place a copy of sg3_utils.spec in the "SPEC" directory. These directories are found under /usr/src/redhat on redhat/fedora distributions. Then from the "SPEC" directory execute "rpmbuild -ba sg3_utils.spec". If all goes well a source rpm should be found in the SRPMS directory and binary rpms in the RPMS/i386 directory (for i386 architecture). Note the spec file will only build those utilities found in the main directory. When the sg3_utils binary rpm is installed the executables and their associated man pages should be placed in appropriate places. The sg3_utils.spec file also builds a libsgutils shared object (shared library) and a libsgutils-*-devel shared object with a static library and the sg_lib.h, sg_cmds.h sg_cmds_basic.h, sg_cmds_extra.h and sg_pt.h header files. Binary rpms (at least in the RedHat distribution) tend to install executables in /usr/bin and libraries in /usr/lib . To build debian "deb" (binary) packages, first untar the tarball, then change directory to the top level within the sg3_utils source. Then: # chmod +x debian/rules # dpkg-buildpackage -b -rfakeroot The binary deb packages will be placed in the parent directory (of the sg3_utils source directory) if all goes well. There is now a script called build_debian.sh in the main directory which invokes those two commands. If the shared object (library) is troublesome or unwanted then a "no_lib" version of the Makefile and the sg3_utils.spec file can be found in the "no_lib" subdirectory. FreeBSD ======= In FreeBSD, the utilities can be built with "make -f Makefile.freebsd". This will build a shared object (i.e. libsgutils.so and friends) that the utilities depend on. To install use "make -f Makefile.freebsd install". These makes depend on libtool. To build without reliance on a shared library (and thus libtool) use "make -f no_lib/Makefile.freebsd" (or execute the "make_no_lib_freebsd.sh" script which does the same thing). Utilities that are linux specific (e.g. sg_map) are not built for FreeBSD. Tru64 (OSF) =========== In Tru64, the utilities can be built with "make -f Makefile.osf1". This will build a shared object (i.e. libsgutils.so and friends) that the utilities depend on. To install use "make -f Makefile.osf1 install". These makes depend on libtool. To build without reliance on a shared library (and thus libtool) use "make -f no_lib/Makefile.osf1" (or execute the "make_no_lib_osf1.sh" script which does the same thing). Utilities that are linux specific (e.g. sg_map) are not built for Tru64. Windows ======= In Windows only the Windows NT, 2000, 2003 and XP operating systems (and their variants) are currently supported. The various device names that the sg3_utils utilities will accept in Windows can be seen by running the sg_scan utility (and perhaps looking at its man page (i.e. sg_scan.8 or sg_scan.8w)). The source tarball can be built in a cygwin or MinGW environment on Windows. For cygwin see http://www.cygwin.com for more information. Various extras such as 'gcc' (the GNU C compiler) and 'make' need to be loaded as they are not in the minimal cygwin default distribution. The build command is "make -f Makefile.win32" and to install (for a cygwin environment) use "make -f Makefile.win32 install". Currently the make doesn't build a dll (cf shared libraries are built on Linux and FreeBSD) so the executable files are bigger than they need to be. Once built, the various ".exe" commands can either be executed in a cygwin shell (typically "bash") or a DOS shell. If cygwin has not been installed on the target machine then the "cygwin1.dll" (obtained from http://www.cygwin.com ) is required. There is also the "Minimalist Gnu for Windows" (MinGW) and its associated shell (MSYS) that can serve as a build environment for sg3_utils. This removes the dependence on the proprietary cygwin1.dll at the expense of some timing features. In a MSYS shell untar the sg3_utils tarball and in its top level directory use "make -f Makefile.mingw". The executables will be placed in that directory. They can be executed in a MSYS or "cmd" shell. 21st January 2007 Doug Gilbert