aboutsummaryrefslogtreecommitdiff
path: root/no_lib/Makefile.linux_static
blob: 16166399b085a0d2e75fdcc819a4dedcfe356ed1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
SHELL = /bin/sh

PREFIX=/usr/local
INSTDIR=$(DESTDIR)/$(PREFIX)/bin
MANDIR=$(DESTDIR)/$(PREFIX)/share/man

ifndef CC
CC = gcc
endif
LD = $(CC)

EXECS = sg_dd sgp_dd sgm_dd sg_read sg_map sg_scan sg_rbuf \
	sginfo sg_readcap sg_turs sg_inq sg_test_rwbuf \
	sg_start sg_reset sg_modes sg_logs sg_senddiag sg_opcodes \
	sg_persist sg_write_long sg_read_long sg_requests sg_ses \
	sg_verify sg_emc_trespass sg_luns sg_sync sg_prevent \
	sg_get_config sg_wr_mode sg_rtpg sg_reassign sg_format \
	sg_rmsn sg_ident sg_map26 sg_rdac sg_vpd

MAN_PGS = sg_dd.8 sgp_dd.8 sgm_dd.8 sg_read.8 sg_map.8 sg_scan.8 sg_rbuf.8 \
	sginfo.8 sg_readcap.8 sg_turs.8 sg_inq.8 sg_test_rwbuf.8 \
	sg_start.8 sg_reset.8 sg_modes.8 sg_logs.8 sg_senddiag.8 \
	sg_opcodes.8 sg_persist.8 sg_write_long.8 sg_read_long.8 \
	sg_requests.8 sg_ses.8 sg_verify.8 sg_emc_trespass.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_map26.8 sg_rdac.8 sg_vpd.8 sg3_utils.8
MAN_PREF = man8

OS_FLAGS = -DSG3_UTILS_LINUX
###  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 -W -DSG_KERNEL_INCLUDES $(EXTRA_FLAGS)
# CFLAGS = -g -O2 -Wall -W -pedantic -std=c99 $(EXTRA_FLAGS)

CFLAGS_PTHREADS = -D_REENTRANT

LDFLAGS = -static 
# 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_dd: sg_dd.o sg_lib.o sg_cmds.o sg_pt_linux.o sg_io_linux.o llseek.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_scan: sg_scan.o sg_io_linux.o sg_lib.o
	$(LD) -o $@ $(LDFLAGS) $^ 

sginfo: sginfo.o sg_io_linux.o sg_lib.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_start: sg_start.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^ 

sg_rbuf: sg_rbuf.o sg_lib.o sg_io_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_readcap: sg_readcap.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sgp_dd.o: sgp_dd.c
	$(CC) $(INCLUDES) $(CFLAGS) $(CFLAGS_PTHREADS) -c $<

sgp_dd: sgp_dd.o sg_lib.o sg_cmds.o sg_pt_linux.o sg_io_linux.o llseek.o
	$(LD) -o $@ $(LDFLAGS) $^ -lpthread

sgm_dd: sgm_dd.o sg_lib.o sg_cmds.o sg_pt_linux.o sg_io_linux.o llseek.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_map: sg_map.o sg_lib.o sg_cmds.o sg_pt_linux.o sg_io_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_turs: sg_turs.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_test_rwbuf: sg_test_rwbuf.o sg_lib.o sg_io_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_inq: sg_inq.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_read: sg_read.o sg_lib.o sg_io_linux.o llseek.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_reset: sg_reset.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_modes: sg_modes.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_logs: sg_logs.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_senddiag: sg_senddiag.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_opcodes: sg_opcodes.o sg_lib.o sg_cmds.o sg_pt_linux.o sg_io_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_persist: sg_persist.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_write_long: sg_write_long.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_read_long: sg_read_long.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_requests: sg_requests.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_ses: sg_ses.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_verify: sg_verify.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_emc_trespass: sg_emc_trespass.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_luns: sg_luns.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_sync: sg_sync.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_prevent: sg_prevent.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_get_config: sg_get_config.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_wr_mode: sg_wr_mode.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_rtpg: sg_rtpg.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_reassign: sg_reassign.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_format: sg_format.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_rmsn: sg_rmsn.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_ident: sg_ident.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_map26: sg_map26.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_rdac: sg_rdac.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

sg_vpd: sg_vpd.o sg_vpd_vendor.o sg_lib.o sg_cmds.o sg_pt_linux.o
	$(LD) -o $@ $(LDFLAGS) $^

install: $(EXECS)
	install -d $(INSTDIR)
	for name in $^; \
	 do install -s -o root -g root -m 755 $$name $(INSTDIR); \
	done
	install -d $(MANDIR)/$(MAN_PREF)
	for mp in $(MAN_PGS); \
	 do install -o root -g root -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

ifeq (.depend,$(wildcard .depend))
include .depend
endif