xref: /dragonfly/bin/dd/Makefile (revision 029e6489)
1#	@(#)Makefile	8.1 (Berkeley) 5/31/93
2# $FreeBSD: head/bin/dd/Makefile 337865 2018-08-15 19:46:13Z kevans $
3
4PROG=	dd
5SRCS=	args.c conv.c conv_tab.c dd.c misc.c position.c
6
7DPADD=	${LIBUTIL}
8LDADD=	-lutil
9
10.if defined(BOOTSTRAPPING)
11CFLAGS+= -DBOOTSTRAPPING
12.endif
13
14#
15# Test the character conversion functions.  We have to be explicit about
16# which LC_LANG we use because the definition of upper and lower case
17# depends on it.
18#
19
20CLEANFILES=	gen
21
22test: ${PROG} gen
23.for conv in ascii ebcdic ibm oldascii oldebcdic oldibm \
24    pareven parnone parodd parset \
25    swab lcase ucase
26	@${ECHO} testing conv=${conv}
27	@./gen | \
28	    LC_ALL=en_US.US-ASCII ./dd conv=${conv} 2>/dev/null | \
29	    LC_ALL=en_US.US-ASCII hexdump -C | \
30	    diff -I FreeBSD - ${.CURDIR}/ref.${conv}
31.endfor
32	@${ECHO} "testing sparse file (obs zeroes)"
33	@./gen 189284 | ./dd ibs=16 obs=8 conv=sparse of=obs_zeroes 2> /dev/null
34	@hexdump -C obs_zeroes | diff -I FreeBSD - ${.CURDIR}/ref.obs_zeroes
35
36	@${ECHO} "testing spase file (all zeroes)"
37	@./dd if=/dev/zero of=1M_zeroes bs=1048576 count=1 2> /dev/null
38	@./dd if=1M_zeroes of=1M_zeroes.1 bs=1048576 conv=sparse 2> /dev/null
39	@./dd if=1M_zeroes of=1M_zeroes.2 bs=1048576 2> /dev/null
40	@diff 1M_zeroes 1M_zeroes.1
41	@diff 1M_zeroes 1M_zeroes.2
42
43	@rm -f gen 1M_zeroes* obs_zeroes
44
45.include <bsd.prog.mk>
46