Makefile revision 1.28
1#	$NetBSD: Makefile,v 1.28 2021/10/23 20:01:14 rillig Exp $
2
3.include <bsd.own.mk>
4
5TESTSDIR=	${TESTSBASE}/usr.bin/indent
6TESTS_SH=	t_errors
7TESTS_SH+=	t_indent
8TESTS_SH+=	t_misc
9TESTS_SH+=	t_options
10
11FILESDIR=	${TESTSDIR}
12FILES=		fmt_block.c
13FILES+=		fmt_decl.c
14FILES+=		fmt_else_comment.c
15FILES+=		indent_off_on.c
16FILES+=		label.c
17FILES+=		lex_ident.c
18FILES+=		lex_char.c
19FILES+=		lex_string.c
20FILES+=		list_head.0
21FILES+=		list_head.0.stdout
22FILES+=		offsetof.0
23FILES+=		offsetof.0.stdout
24FILES+=		opt--version.0
25FILES+=		opt--version.0.pro
26FILES+=		opt--version.0.stdout
27FILES+=		opt-U.0
28FILES+=		opt-U.0.list
29FILES+=		opt-U.0.pro
30FILES+=		opt-U.0.stdout
31FILES+=		opt-bap+sob.0
32FILES+=		opt-bap+sob.0.pro
33FILES+=		opt-bap+sob.0.stdout
34FILES+=		opt-npro.0
35FILES+=		opt-npro.0.pro
36FILES+=		opt-npro.0.stdout
37FILES+=		opt.0
38FILES+=		opt.0.pro
39FILES+=		opt.0.stdout
40FILES+=		opt_P.c
41FILES+=		opt_T.c
42FILES+=		opt_bacc.c
43FILES+=		opt_bad.c
44FILES+=		opt_badp.c
45FILES+=		opt_bap.c
46FILES+=		opt_bbb.c
47FILES+=		opt_bc.c
48FILES+=		opt_bl_br.c
49FILES+=		opt_bs.c
50FILES+=		opt_c.c
51FILES+=		opt_cd.c
52FILES+=		opt_cdb.c
53FILES+=		opt_ce.c
54FILES+=		opt_ci.c
55FILES+=		opt_cli.c
56FILES+=		opt_cs.c
57FILES+=		opt_d.c
58FILES+=		opt_di.c
59FILES+=		opt_dj.c
60FILES+=		opt_eei.c
61FILES+=		opt_ei.c
62FILES+=		opt_fbs.c
63FILES+=		opt_fc1.c
64FILES+=		opt_fcb.c
65FILES+=		opt_i.c
66FILES+=		opt_ip.c
67FILES+=		opt_l.c
68FILES+=		opt_lc.c
69FILES+=		opt_ldi.c
70FILES+=		opt_lp.c
71FILES+=		opt_lpl.c
72FILES+=		opt_pcs.c
73FILES+=		opt_psl.c
74FILES+=		opt_sc.c
75FILES+=		opt_sob.c
76FILES+=		opt_ta.c
77FILES+=		opt_ts.c
78FILES+=		opt_ut.c
79FILES+=		opt_v.c
80FILES+=		ps_ind_level.c
81FILES+=		t_options.awk
82FILES+=		token_binary_op.c
83FILES+=		token_case_label.c
84FILES+=		token_colon.c
85FILES+=		token_comma.c
86FILES+=		token_comment.c
87FILES+=		token_decl.c
88FILES+=		token_do_stmt.c
89FILES+=		token_end_of_file.c
90FILES+=		token_for_exprs.c
91FILES+=		token_form_feed.c
92FILES+=		token_funcname.c
93FILES+=		token_ident.c
94FILES+=		token_if_expr.c
95FILES+=		token_if_expr_stmt.c
96FILES+=		token_if_expr_stmt_else.c
97FILES+=		token_keyword_do.c
98FILES+=		token_keyword_do_else.c
99FILES+=		token_keyword_else.c
100FILES+=		token_keyword_for_if_while.c
101FILES+=		token_keyword_struct_union_enum.c
102FILES+=		token_lbrace.c
103FILES+=		token_lparen.c
104FILES+=		token_newline.c
105FILES+=		token_period.c
106FILES+=		token_postfix_op.c
107FILES+=		token_preprocessing.c
108FILES+=		token_question.c
109FILES+=		token_rbrace.c
110FILES+=		token_rparen.c
111FILES+=		token_semicolon.c
112FILES+=		token_stmt.c
113FILES+=		token_stmt_list.c
114FILES+=		token_storage_class.c
115FILES+=		token_string_prefix.c
116FILES+=		token_switch_expr.c
117FILES+=		token_type_def.c
118FILES+=		token_unary_op.c
119FILES+=		token_while_expr.c
120FILES+=		types_from_file.0
121FILES+=		types_from_file.0.stdout
122FILES+=		types_from_file.0.list
123FILES+=		types_from_file.0.pro
124
125add-test: .PHONY
126	@set -eu; \
127	test=${NAME:Q}.c; \
128	if [ "$$test" = ".c" ]; then \
129		echo "usage: ${MAKE} add-test NAME=<name>"; \
130		exit; \
131	fi; \
132	\
133	if [ -f "$$test" ]; then \
134		echo "error: test $$test already exists." 1>&2; \
135		exit 1; \
136	fi; \
137	\
138	echo "=> Adding test $$test"; \
139	printf '%s\n' \
140		'/* $$''NetBSD$$ */' \
141		'/* $$''FreeBSD$$ */' \
142		'' \
143		'/*' \
144		' * TODO: Explain the purpose of the test.' \
145		' */' \
146		'' \
147		'#indent input' \
148		'// TODO: add input' \
149		'#indent end' \
150		'' \
151		'#indent run [-options]' \
152		'// TODO: add expected output' \
153		'#indent end' \
154	> "$$test"; \
155	cvs add "$$test"; \
156	printf '%s\n' \
157		'/^FILES+=/i' \
158		"FILES+=		$$test" \
159		'.' 'w' 'q' \
160	| ed Makefile; \
161	${MAKE} sync-mi
162
163# Note: only works for adding tests.
164# To remove a test, the $$mi file must be edited manually.
165sync-mi: .PHONY
166	@set -eu;							\
167	cd "${MAKEFILE:tA:H}/../../..";					\
168	mi="distrib/sets/lists/tests/mi";				\
169	cvs update "$$mi";						\
170	fmt="./usr/tests/usr.bin/indent/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \
171	cat "$$mi" > "$$mi.tmp";					\
172	printf "$$fmt" ${FILES:M${NAME}*} >> "$$mi.tmp";		\
173	distrib/sets/fmt-list "$$mi.tmp";				\
174	mv "$$mi.tmp" "$$mi";						\
175	cvs diff "$$mi" || true
176
177.include <bsd.test.mk>
178