Imported Upstream version 2.5.2
[debian/dds2tar] / Makefile
1 # Makefile for dds2tar
2 #
3 #--------------------------------------------------------
4 # To compile everything:                     make
5 # To install the executables and man pages:  make install
6 #--------------------------------------------------------
7
8 V=2.5.2
9
10 # Here are some configurable options:
11 ################################################################
12
13 # To enable the use of the log pages of an HPDAT,
14 # uncomment the following line :
15 HPDAT=-DHPDAT
16
17 # Default tape device is: /dev/nst0
18 # edit or uncomment the following line to change the default device
19 DEVICE=/dev/rmt0
20
21 # Enable trace mode -- for debugging only
22 # TRACE=-DDDS_TRACE=1
23
24 # The tape blocks are read into a buffer, so the buffer of dds2tar
25 # should be in the same size as the one in /usr/src/linux/driver/scsi/st.c
26 # of the kernel code. Set ST_BUFFER_BLOCKS to zero, in order to take the
27 # size from the kernel source directly.
28 #
29 # The number is halved, if EOVERFLOW is detected.
30 # The value of the kernel is normally ST_BUFFER_BLOCKS=32.
31 #
32 # To configure the buffer size of dds2tar
33 # change or uncomment the following line :
34 # BUFFER=-DST_BUFFER_BLOCKS=32
35 BUFFER=-DST_BUFFER_BLOCKS=0
36
37 # To include some experimental stuff
38 # uncomment the following line :
39 # EXP_STUFF=-DEXP_STUFF
40
41 # change this to where you want to install:
42 BINDIR=/usr/bin
43 MANDIR=/usr/man
44 MANEXT=1
45
46 # place here your favorite C compiler and options
47 CC=cc -g
48 CCOPT=$(HPDAT) $(HPDAT4) $(EXP_STUFF) $(MATCH) $(BUFFER) \
49       -DDEVICE=\"$(DEVICE)\" -O4 -Wall $(TRACE)
50
51 #        -Wall \
52 #        -Wstrict-prototypes \
53 #        -Wshadow \
54 #        -Wwrite-strings \
55 #        -Wpointer-arith \
56 #        -Wcast-qual \
57 #        -Wenum-clash \
58 #        -Wcast-align \
59 #        -Wtraditional \
60 #        -Wmissing-prototypes \
61 #        -Wnested-externs \
62 #        -Winline \
63 #        -pedantic \
64  
65
66 # nothing configurable below this line
67 ################################################################
68
69 .SUFFIXES: .c .o .man .$(MANEXT) .ps .s
70
71 D=dds2tar-${V}
72
73 CCFLAGS=-DVERSION=\"$V\"
74
75 TAR=tar
76 ARCHIVE=\
77 $(D)/Makefile \
78 $(D)/Changes \
79 $(D)/README \
80 $(D)/dds2tar.man \
81 $(D)/dds2index.man \
82 $(D)/mt-dds.man \
83 $(D)/dds-dd.man \
84 $(D)/dds2tar.ps \
85 $(D)/dds2index.ps \
86 $(D)/mt-dds.ps \
87 $(D)/dds-dd.ps \
88 $(D)/dds2tar.h \
89 $(D)/dds2tar.c \
90 $(D)/dds_extract.c \
91 $(D)/zf-cre-open.h \
92 $(D)/zf-cre-open.c \
93 $(D)/dds_index.c \
94 $(D)/dds_tape.h \
95 $(D)/dds_tape.c \
96 $(D)/dds_chkhdr.c \
97 $(D)/dds_quote.c \
98 $(D)/scsi_vendor \
99 $(D)/tar-1.11.2.patch \
100 $(D)/tar-1.11.8.patch \
101 $(D)/tar-1.12.patch \
102 $(D)/tar-1.13.patch \
103 $(D)/tar-1.11.2-sparse-files.patch \
104 $(D)/tar-1.11.2-sparse-files.README \
105 $(D)/dds2tar-test.sh \
106 $(D)/index-of-tar \
107 $(D)/index-of-tar-v \
108 $(D)/index-of-tar-t \
109 $(D)/index-of-dds2index \
110 $(D)/.indent.pro \
111 $(D)/dds2tar.lsm \
112 $(D)/COPYING \
113 $(D)/ddstool \
114
115
116 OBJ= dds_index.o dds_extract.o dds_tape.o dds_quote.o \
117      zf-cre-open.o dds_chkhdr.o
118
119
120 all: dds2tar dds2tar.1 dds2index.1 mt-dds.1 dds-dd.1
121
122 dds2tar: dds2tar.o $(OBJ)
123         $(CC) dds2tar.o $(OBJ)  -o dds2tar
124         ln -f dds2tar dds2index
125         ln -f dds2tar mt-dds
126         ln -f dds2tar dds-dd
127
128 tar2tar: tar2tar.c
129         $(CC) tar2tar.c -o tar2tar
130
131 dds2index: dds2index.o $(OBJ)
132         $(CC) dds2index.o $(OBJ)  -o dds2index
133
134 mt-dds: mt-dds.o $(OBJ)
135         $(CC) mt-dds.o $(OBJ)  -o mt-dds
136
137 dds-dd: dds-dd.o $(OBJ)
138         $(CC) dds-dd.o $(OBJ)  -o dds-dd
139
140 install: dds2tar ddstool \
141         dds2tar.$(MANEXT) mt-dds.$(MANEXT) dds2index.$(MANEXT) dds-dd.$(MANEXT)
142         install -c -s dds2tar $(BINDIR)
143         install scsi_vendor $(BINDIR)
144         install -c ddstool $(BINDIR)
145         ls -l $(BINDIR)/dds2tar $(BINDIR)/ddstool
146         install -c dds2tar.$(MANEXT)   $(MANDIR)/man$(MANEXT)
147         install -c dds2index.$(MANEXT) $(MANDIR)/man$(MANEXT)
148         install -c mt-dds.$(MANEXT)    $(MANDIR)/man$(MANEXT)
149         install -c dds-dd.$(MANEXT)    $(MANDIR)/man$(MANEXT)
150         ln -f $(BINDIR)/dds2tar  $(BINDIR)/dds2index
151         ln -f $(BINDIR)/dds2tar  $(BINDIR)/mt-dds
152         ln -f $(BINDIR)/dds2tar  $(BINDIR)/dds-dd
153
154 T=tar-1.13
155 tar: dds2tar.ps dds2index.ps mt-dds.ps dds-dd.ps ${T}.patch
156         -cd .. ; echo ' ' ; \
157                 $(TAR) -R -c -f $(D).tar -v $(ARCHIVE) ;
158                 echo ' '
159         ls -l ../$(D).tar
160         gzip -9 -f ../$(D).tar
161         ls -l ../$(D).tar.gz | awk '{print $$5}' > archive_length
162         sed s/LENGTH/`cat archive_length`/ <dds2tar.lsm |\
163            sed s/VERSION/$(V)/ > ../$(D).lsm
164         ls -l ../dds2tar*z ../dds2tar*.lsm
165         -rm -f ../dds2tar archive_length
166         cd .. ; ln -s $(D) dds2tar
167         echo ' '
168         cd .. ; tar zfc ${T}.1.tar.gz --totals ${T}.1
169         cd .. ; tar cf archive.tar ${D}.lsm ${D}.tar.gz ${T}.1.tar.gz
170
171 tar-patch tar-1.13.patch: 
172         ls -l tar-*patch
173         cd ..; diff -ru ${T} ${T}.1 |grep -v 'Only in '> $(D)/${T}.patch ;true
174         ls -l tar-*patch
175
176 .c.o:
177         $(CC) -c $< $(CCOPT) $(CCFLAGS)
178
179 .c.s:
180         $(CC) -S -c $< $(CCOPT) $(CCFLAGS)
181
182 .man.1:
183         umask 022 ; sed -e 's?/dev/tape?$(DEVICE)?' $< >$@
184
185 .man.ps:
186         umask 022 ; sed -e 's?/dev/tape?$(DEVICE)?' $< >$*.1
187         umask 022 ; groff -man $*.$(MANEXT)   > $*.ps
188
189 clean:
190         -rm -f $(OBJ) dds2tar.o dds2index.o mt-dds.o dds-dd.o *.BAK *.s
191         -rm -f dds2tar dds2index mt-dds dds-dd fio_test 
192         -rm -f *~ *.$(MANEXT) *.ps
193         -rm -f tags *.bak
194         chmod 644 *
195
196 doc:
197                         a2ps -p -nP    [A-Z]* *.h *.c *.lsm > a.ps
198         man dds2tar   | a2ps -p -nP -m -Hdds2tar            > b.ps
199         man dds2index | a2ps -p -nP -m -Hdds2index          > c.ps
200         man mt-dds    | a2ps -p -nP -m -Hmt-dds.man.ps      > d.ps
201         man dds-dd    | a2ps -p -nP -m -Hdds-dd.man.ps      > d.ps
202
203 psman: dds2tar.$(MANEXT) mt-dds.$(MANEXT) dds2index.$(MANEXT) dds-dd.$(MANEXT)
204         groff -man dds2tar.$(MANEXT)   > dds2tar.ps
205         groff -man dds2index.$(MANEXT) > dds2index.ps
206         groff -man mt-dds.$(MANEXT)    > mt-dds.ps
207         groff -man dds-dd.$(MANEXT)    > dds-dd.ps
208
209 dds_quote.o:dds_quote.c dds2tar.h
210 dds_extract.o:dds_extract.c dds2tar.h dds_tape.h
211 dds_index.o:dds_index.c dds2tar.h dds_tape.h
212 dds_quote.o:dds_quote.c dds2tar.h
213 dds_tape.o:dds_tape.c dds2tar.h dds_tape.h
214 zf-cre-open.o:zf-cre-open.c zf-cre-open.h
215
216 INC=dds2tar.h dds_tape.h zf-cre-open.h
217 dds2tar.o:dds2tar.c $(INC)
218         $(CC) -c dds2tar.c $(CCOPT) $(CCFLAGS) -DPROGRAM=DDS2TAR -o dds2tar.o
219 dds2index.o:dds2tar.c $(INC)
220         $(CC) -c dds2tar.c $(CCOPT) $(CCFLAGS) -DPROGRAM=DDS2INDEX -o dds2index.o
221 mt-dds.o:dds2tar.c $(INC)
222         $(CC) -c dds2tar.c $(CCOPT) $(CCFLAGS) -DPROGRAM=MTDDS -o mt-dds.o
223 dds-dd.o:dds2tar.c $(INC)
224         $(CC) -c dds2tar.c $(CCOPT) $(CCFLAGS) -DPROGRAM=MTDDS -o dds-dd.o
225
226 fio_test:zf-cre-open.c zf-cre-open.h
227         cc zf-cre-open.c -DTEST -o fio_test
228
229 tags:
230         ctags -stv *.c
231