3 # hash - combined shs and md5 makefile
5 # @(#) $Revision: 13.5 $
6 # @(#) $Id: Makefile,v 13.5 2010/10/12 21:08:53 chongo Exp $
7 # @(#) $Source: /usr/local/src/cmd/hash/RCS/Makefile,v $
9 # This file was written by Landon Curt Noll.
11 # This makefile has been placed in the public domain. Please do not
12 # copyright this makefile.
14 # LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
15 # THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
16 # CHANTABILITY AND FITNESS. IN NO EVENT SHALL LANDON CURT
17 # NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
18 # DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
19 # USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 # chongo (was here) /\oo/\
24 # http://www.isthe.com/chongo/index.html
26 # Share and enjoy! :-)
28 # See shsdrvr.c, shs1drvr.c and md5drvr.c for version and modification history.
37 # where to install binary files
39 BINDIR
= /usr
/local
/bin
41 #BINDIR= /usr/contrib/bin
43 # where to install the shs, shs1 and md5 test file dirs
45 # ${TOPDIR} is the directory under which the shs and md5 dirs will be placed.
46 # ${SHSLIB} is where the readonly shs and shs1 test files are kept
47 # ${MD5LIB} is where the readonly md5 test files are kept
49 TOPDIR
= /usr
/local
/lib
56 # where man pages are installed
58 # Use MANDIR= to disable installation of the calc man (source) page.
61 MANDIR
=/usr
/local
/man
/man1
63 #MANDIR=/usr/share/man/man1
64 #MANDIR=/usr/man/u_man/man1
65 #MANDIR=/usr/contrib/man/man1
67 # extenstion to add on to the calc man page filename
69 # This is ignored if MANDIR is empty.
74 # select the proper compiler
76 # If you use a non-ANSI cc, you may have to edit md5.c to change the
77 # UL constant suffixes in MD5Transform() to just L and see if test works.
79 # Under BSD/OS 2.0, we cannot compile with -ansi because <sys/resource.h>
80 # uses struct timeval which is not defined by <sys/time.h> under -ansi.
84 #CC= gcc -ansi -fcaller-saves
85 #CC= gcc2 -ansi -fcaller-saves
87 #CC= gcc -fcaller-saves
88 #CC= gcc2 -fcaller-saves
90 # select the proper optimization or debug level
95 #OPT_DEBUG= -g3 -DDEBUG
96 #OPT_DEBUG= -g3 -DDEBUG -DDETAILED_DEBUG
98 #OPT_DEBUG= -O -DDEBUG
100 #OPT_DEBUG= -O -g3 -DDEBUG
102 #OPT_DEBUG= -O2 -DDEBUG
104 #OPT_DEBUG= -O2 -g3 -DDEBUG
106 #OPT_DEBUG= -O3 -DDEBUG
108 #OPT_DEBUG= -O3 -g3 -DDEBUG
110 CFLAGS
= ${OPT_DEBUG} -Wall
-W
111 #CFLAGS= ${OPT_DEBUG} -Wall -W -Werror
113 # Some architectures such as Sparc do not allow one to access long that
114 # are not alligned. If make test dumpds core or fails to produce no
115 # output, use only -DMUST_ALIGN.
117 # ALIGN= let must_align.c figure out if alignment is needed
118 # ALIGN=-DMUST_ALIGN force alignment (at the cost of performance}
119 # ALIGN=-UMUST_ALIGN allow non-aligment (usually at a performance gain}
125 all: shs sha shs1 sha1 md5
127 shs
: shsdrvr.o shsio.o shsdual.o shs.o
128 ${CC} ${CFLAGS} -o shs shsdrvr.o shsio.o shsdual.o shs.o
134 shs1
: shs1drvr.o shs1io.o shs1dual.o shs1.o
135 ${CC} ${CFLAGS} -o shs1 shs1drvr.o shs1io.o shs1dual.o shs1.o
141 md5
: md5drvr.o md5io.o md5dual.o md5.o
142 ${CC} ${CFLAGS} -o md5 md5drvr.o md5io.o md5dual.o md5.o
145 test: shs shs1 md5 shstest shs1test md5test
147 # perform the shs1 test
148 shs1test
: shs1 file1 file2 file3 shs1.data shs1.ddata mega Makefile
149 @echo This shs1
test should produce no output
150 @.
/shs1
-x |
${DIFF} -u
- shs1.data
151 @.
/shs1 shs1.data | \
152 sed
'/^407a65c1b4c95c5dd19da3c22b5d7357eadc2aeb shs1.data$$/d'
154 sed
'/^34aa973cd4c4daa4f61eeb2bdbad27316534016f$$/d'
155 @.
/shs1
-q
-c file3 | \
156 sed
'/^0xa2ecae1924928cfebf7bbb01ee0974063e845824$$/d'
157 @.
/shs1
-p abc
-c file2 | \
158 sed
'/^0xa2ecae1924928cfebf7bbb01ee0974063e845824 file2$$/d'
159 @.
/shs1
-P file1 file2 | \
160 sed
'/^a2ecae1924928cfebf7bbb01ee0974063e845824 file2$$/d'
161 @.
/shs1 shs1.ddata | \
162 sed
'/^a32cb7757f15c922f5466c279f12803d5848c21b shs1.ddata$$/d'
163 @.
/shs1
-d
-x
-q |
${DIFF} -u
- shs1.ddata
164 @echo End of shs1
test
166 # perform the old extended shs digest test
167 shstest
: shs file1 file2 file3 shs.data shs.ddata Makefile
168 @echo This old shs
test should produce no output
169 @.
/shs
-x |
${DIFF} -u
- shs.data
171 sed
'/^6789cc089b94c3a950745071a8ecf5b5b61bfc3c shs.data$$/d'
172 @.
/shs
-q
-c file3 | \
173 sed
'/^0xa9f2c8b901a7c8628133694a105fc760bdccad2c$$/d'
174 @.
/shs
-p abc
-c file2 | \
175 sed
'/^0xa9f2c8b901a7c8628133694a105fc760bdccad2c file2$$/d'
176 @.
/shs
-P file1 file2 | \
177 sed
'/^a9f2c8b901a7c8628133694a105fc760bdccad2c file2$$/d'
179 sed
'/^c0e05434119fec847d91fe981dafda58a7a97e5d shs.ddata$$/d'
180 @.
/shs
-d
-x
-q |
${DIFF} -u
- shs.ddata
181 echo End of old shs
test
183 # perform the extended md5 digest test
184 md5test
: md5 file1 file2 file3 md5.data md5.ddata Makefile
185 @echo This md5
test should produce no output
186 @.
/md5
-x |
${DIFF} -u
- md5.data
188 sed
'/^9638425fd6b565e9fddf642fa4889125 md5.data$$/d'
189 @.
/md5
-q
-c file3 | \
190 sed
'/^0x68cfe1a8e5242c8e1e8152d0bc710631$$/d'
191 @.
/md5
-p abc
-c file2 | \
192 sed
'/^0x68cfe1a8e5242c8e1e8152d0bc710631 file2$$/d'
193 @.
/md5
-P file1 file2 | \
194 sed
'/^68cfe1a8e5242c8e1e8152d0bc710631 file2$$/d'
196 sed
'/^e1ac664dddab5c1b0d987a3d6ab0be9b md5.ddata$$/d'
197 @.
/md5
-d
-x
-q |
${DIFF} -u
- md5.ddata
198 @echo End of md5
test
202 echo abc |
${TR} -d
'\012' > file1
206 cat file1 file2
> file3
208 shsdrvr.o
: shsdrvr.c shs.h Makefile
209 ${CC} ${CFLAGS} -DTLIB
=\"${SHSLIB}\" -c shsdrvr.c
211 shs1drvr.o
: shs1drvr.c shs1.h Makefile
212 ${CC} ${CFLAGS} -DTLIB
=\"${SHSLIB}\" -c shs1drvr.c
214 shsio.o
: shsio.c shs.h
215 ${CC} ${CFLAGS} -c shsio.c
217 shs1io.o
: shs1io.c shs1.h
218 ${CC} ${CFLAGS} -c shs1io.c
220 shsdual.o
: shsdual.c shs.h Makefile
221 ${CC} ${CFLAGS} -DTLIB
=\"${SHSLIB}\" -c shsdual.c
223 shs1dual.o
: shs1dual.c shs1.h Makefile
224 ${CC} ${CFLAGS} -DTLIB
=\"${SHSLIB}\" -c shs1dual.c
226 shs.o
: shs.c shs.h align.h endian.h
227 ${CC} ${CFLAGS} -c shs.c
229 shs1.o
: shs1.c shs1.h align.h endian.h
230 ${CC} ${CFLAGS} -c shs1.c
232 md5drvr.o
: md5drvr.c md5.h Makefile
233 ${CC} ${CFLAGS} -DTLIB
=\"${MD5LIB}\" -c md5drvr.c
235 md5io.o
: md5io.c md5.h
236 ${CC} ${CFLAGS} -c md5io.c
238 md5dual.o
: md5dual.c md5.h Makefile
239 ${CC} ${CFLAGS} -DTLIB
=\"${MD5LIB}\" -c md5dual.c
241 md5.o
: md5.c md5.h align.h endian.h
242 ${CC} ${CFLAGS} -c md5.c
246 -.
/must_align
> align.h
2>/dev
/null
248 must_align
: must_align.c Makefile
249 ${CC} ${ALIGN} must_align.c
-o must_align
256 ${CC} ${CFLAGS} endian.c
-o endian
259 ${CC} ${CFLAGS} mega.c
-o mega
261 install: all file1 file2 shs1.data shs.data shs1.ddata shs.ddata \
264 ${INSTALL} -c
-m
0555 shs
${BINDIR}
266 ${INSTALL} -c
-m
0555 sha
${BINDIR}
267 -rm -f
${BINDIR}/shs1
268 ${INSTALL} -c
-m
0555 shs1
${BINDIR}
269 -rm -f
${BINDIR}/sha1
270 ${INSTALL} -c
-m
0555 sha1
${BINDIR}
272 ${INSTALL} -c
-m
0555 md5
${BINDIR}
273 -@if
[ ! -d
"${TOPDIR}" ]; then \
274 echo
"mkdir ${TOPDIR}"; \
277 -@if
[ ! -d
"${SHSLIB}" ]; then \
278 echo
"mkdir ${SHSLIB}"; \
281 ${INSTALL} -c
-m
0444 file1
${SHSLIB}
282 ${INSTALL} -c
-m
0444 file2
${SHSLIB}
283 ${INSTALL} -c
-m
0444 shs1.data shs.data
${SHSLIB}
284 ${INSTALL} -c
-m
0444 shs1.ddata shs.ddata
${SHSLIB}
285 -@if
[ ! -d
"${MD5LIB}" ]; then \
286 echo
"mkdir ${MD5LIB}"; \
289 ${INSTALL} -c
-m
0444 file1
${MD5LIB}
290 ${INSTALL} -c
-m
0444 file2
${MD5LIB}
291 ${INSTALL} -c
-m
0444 md5.data
${MD5LIB}
292 -@if
[ -z
"${MANDIR}" ]; then \
293 echo
"man pages are not installed, $${MANDIR} is empty"; \
295 echo
"rm -f ${MANDIR}/md5.${MANEXT}"; \
296 rm -f
${MANDIR}/md5.
${MANEXT}; \
297 echo
"rm -f ${MANDIR}/shs.${MANEXT} ${MANDIR}/shs1.${MANEXT}"; \
298 rm -f
${MANDIR}/shs.
${MANEXT} ${MANDIR}/shs1.
${MANEXT}; \
299 echo
"rm -f ${MANDIR}/sha.${MANEXT} ${MANDIR}/sha1.${MANEXT}"; \
300 rm -f
${MANDIR}/sha.
${MANEXT} ${MANDIR}/sha1.
${MANEXT}; \
301 echo
"cp shs.1 ${MANDIR}/shs.${MANEXT}"; \
302 cp shs
.1 ${MANDIR}/shs.
${MANEXT}; \
303 echo
"cp shs.1 ${MANDIR}/shs1.${MANEXT}"; \
304 cp shs
.1 ${MANDIR}/shs1.
${MANEXT}; \
305 echo
"cp shs.1 ${MANDIR}/sha.${MANEXT}"; \
306 cp shs
.1 ${MANDIR}/sha.
${MANEXT}; \
307 echo
"cp shs.1 ${MANDIR}/sha1.${MANEXT}"; \
308 cp shs
.1 ${MANDIR}/sha1.
${MANEXT}; \
309 echo
"cp md5.1 ${MANDIR}/md5.${MANEXT}"; \
310 cp md5.1
${MANDIR}/md5.
${MANEXT}; \
311 echo
"chmod 0444 ${MANDIR}/md5.${MANEXT}"; \
312 chmod
0444 ${MANDIR}/md5.
${MANEXT}; \
313 echo
"chmod 0444 ${MANDIR}/shs.${MANEXT}"; \
314 chmod
0444 ${MANDIR}/shs.
${MANEXT}; \
315 echo
"chmod 0444 ${MANDIR}/shs1.${MANEXT}"; \
316 chmod
0444 ${MANDIR}/shs1.
${MANEXT}; \
317 echo
"chmod 0444 ${MANDIR}/sha.${MANEXT}"; \
318 chmod
0444 ${MANDIR}/sha.
${MANEXT}; \
319 echo
"chmod 0444 ${MANDIR}/sha1.${MANEXT}"; \
320 chmod
0444 ${MANDIR}/sha1.
${MANEXT}; \
324 rm -f shs1.o shs1drvr.o shs1dual.o mega mega.o
325 rm -f shs.o shsdrvr.o shsdual.o
326 rm -f md5.o md5drvr.o md5dual.o
327 rm -f shsio.o shs1io.o md5io.o
330 rm -f endian.h endian.o endian
331 rm -f align.h must_align must_align.o
332 rm -f core core.must_align core.shs core.md5
335 rm -f shs md5 shs1 sha sha1
336 rm -rf endian.dSYM mega.dSYM