blob: dae08b748873aea0d4b0a455a435a5f69b1c2749 [file] [log] [blame]
SHELL = /bin/sh
PREFIX=/usr/local
INSTDIR=$(DESTDIR)/$(PREFIX)/bin
MANDIR=$(DESTDIR)/$(PREFIX)/man
CC = gcc
LD = gcc
EXECS = sg_readcap sg_turs sg_inq sg_start sg_modes sg_logs sg_senddiag \
sg_persist sg_requests sg_ses sg_luns \
sg_sync sg_prevent sg_get_config sg_wr_mode \
sg_rtpg sg_reassign sg_format sg_rmsn sg_ident \
sg_read_long sg_write_long sg_verify sg_rdac sg_vpd \
sg_sat_identify sg_read_buffer sg_write_buffer sg_opcodes
MAN_PGS = sg_readcap.8 sg_turs.8 sg_inq.8 sg_start.8 sg_modes.8 sg_logs.8 \
sg_senddiag.8 sg_persist.8 sg_requests.8 sg_ses.8 sg_luns.8 \
sg_sync.8 sg_prevent.8 sg_get_config.8 sg_wr_mode.8 \
sg_rtpg.8 sg_reassign.8 sg_format.8 sg_rmsn.8 sg_ident.8 \
sg_read_long.8 sg_write_long.8 sg_verify.8 sg_rdac.8 sg_vpd.8 \
sg3_utils.8 sg_sat_identify.8 sg_read_buffer.8 sg_write_buffer.8 \
sg_opcodes.8
MAN_PREF = man8
OS_FLAGS = -DSG3_UTILS_FREEBSD
LARGE_FILE_FLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
EXTRA_FLAGS = $(OS_FLAGS) $(LARGE_FILE_FLAGS)
# CFLAGS = -O2 -Wall -W $(EXTRA_FLAGS)
CFLAGS = -g -O2 -Wall -W $(EXTRA_FLAGS)
# CFLAGS = -g -O2 -Wall -W -pedantic -std=c99 $(EXTRA_FLAGS)
O_FILES = sg_lib.o sg_cmds_basic.o sg_cmds_extra.o sg_pt_freebsd.o
O_BFILES = sg_lib.o sg_cmds_basic.o sg_pt_freebsd.o
LDFLAGS = -lcam
# LDFLAGS = -v -lm
all: $(EXECS)
depend dep:
for i in *.c; do $(CC) $(INCLUDES) $(CFLAGS) -M $$i; \
done > .depend
clean:
/bin/rm -f *.o $(EXECS) core* .depend *.a *.la *.lo
/bin/rm -rf .libs
sg_readcap: sg_readcap.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_turs: sg_turs.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_inq: sg_inq.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_start: sg_start.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_modes: sg_modes.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_logs: sg_logs.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_senddiag: sg_senddiag.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_persist: sg_persist.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_requests: sg_requests.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_ses: sg_ses.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_luns: sg_luns.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_sync: sg_sync.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_prevent: sg_prevent.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_get_config: sg_get_config.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_wr_mode: sg_wr_mode.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_rtpg: sg_rtpg.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_reassign: sg_reassign.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_format: sg_format.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_rmsn: sg_rmsn.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_ident: sg_ident.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_read_long: sg_read_long.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_write_long: sg_write_long.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_verify: sg_verify.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_rdac: sg_rdac.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
sg_vpd: sg_vpd.o sg_vpd_vendor.o $(O_BFILES)
$(LD) -o $@ $(LDFLAGS) $@.o sg_vpd_vendor.o $(O_BFILES)
sg_sat_identify: sg_sat_identify.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_read_buffer: sg_read_buffer.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_write_buffer: sg_write_buffer.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_FILES)
sg_opcodes: sg_opcodes.o $(O_FILES)
$(LD) -o $@ $(LDFLAGS) $@.o $(O_BFILES)
install: $(EXECS)
install -d $(INSTDIR)
for name in $(EXECS); \
do install -s -m 755 $$name $(INSTDIR); \
done
install -d $(MANDIR)/$(MAN_PREF)
for mp in $(MAN_PGS); \
do install -m 644 $$mp $(MANDIR)/$(MAN_PREF); \
gzip -9f $(MANDIR)/$(MAN_PREF)/$$mp; \
done
uninstall:
dists="$(EXECS)"; \
for name in $$dists; do \
rm -f $(INSTDIR)/$$name; \
done
for mp in $(MAN_PGS); do \
rm -f $(MANDIR)/$(MAN_PREF)/$$mp.gz; \
done