Home | History | Annotate | Line # | Download | only in indent
Makefile revision 1.24
      1 #	$NetBSD: Makefile,v 1.24 2021/10/19 20:20:24 rillig Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 TESTSDIR=	${TESTSBASE}/usr.bin/indent
      6 TESTS_SH=	t_errors
      7 TESTS_SH+=	t_indent
      8 TESTS_SH+=	t_misc
      9 TESTS_SH+=	t_options
     10 
     11 FILESDIR=	${TESTSDIR}
     12 FILES=		block.0
     13 FILES+=		block.0.stdout
     14 FILES+=		declarations.0
     15 FILES+=		declarations.0.stderr
     16 FILES+=		declarations.0.stdout
     17 FILES+=		elsecomment.0
     18 FILES+=		elsecomment.0.stdout
     19 FILES+=		elsecomment.0.pro
     20 FILES+=		f_decls.0
     21 FILES+=		f_decls.0.stdout
     22 FILES+=		indent_off_on.c
     23 FILES+=		indent_variables.0
     24 FILES+=		indent_variables.0.pro
     25 FILES+=		indent_variables.0.stdout
     26 FILES+=		label.c
     27 FILES+=		lex.0
     28 FILES+=		lex.0.pro
     29 FILES+=		lex.0.stdout
     30 FILES+=		lex_char.0
     31 FILES+=		lex_char.0.pro
     32 FILES+=		lex_char.0.stdout
     33 FILES+=		lex_string.0
     34 FILES+=		lex_string.0.pro
     35 FILES+=		lex_string.0.stdout
     36 FILES+=		lineno.0
     37 FILES+=		lineno.0.pro
     38 FILES+=		lineno.0.stdout
     39 FILES+=		list_head.0
     40 FILES+=		list_head.0.stdout
     41 FILES+=		offsetof.0
     42 FILES+=		offsetof.0.stdout
     43 FILES+=		opt--version.0
     44 FILES+=		opt--version.0.pro
     45 FILES+=		opt--version.0.stdout
     46 FILES+=		opt-P.0
     47 FILES+=		opt-P.0.pro
     48 FILES+=		opt-P.0.stdout
     49 FILES+=		opt-T.0
     50 FILES+=		opt-T.0.pro
     51 FILES+=		opt-T.0.stdout
     52 FILES+=		opt-U.0
     53 FILES+=		opt-U.0.list
     54 FILES+=		opt-U.0.pro
     55 FILES+=		opt-U.0.stdout
     56 FILES+=		opt-bap+sob.0
     57 FILES+=		opt-bap+sob.0.pro
     58 FILES+=		opt-bap+sob.0.stdout
     59 FILES+=		opt-bl.0
     60 FILES+=		opt-bl.0.pro
     61 FILES+=		opt-bl.0.stdout
     62 FILES+=		opt-br.0
     63 FILES+=		opt-br.0.pro
     64 FILES+=		opt-br.0.stdout
     65 FILES+=		opt-c.0
     66 FILES+=		opt-c.0.pro
     67 FILES+=		opt-c.0.stdout
     68 FILES+=		opt-cd.0
     69 FILES+=		opt-cd.0.pro
     70 FILES+=		opt-cd.0.stdout
     71 FILES+=		opt-ci.0
     72 FILES+=		opt-ci.0.pro
     73 FILES+=		opt-ci.0.stdout
     74 FILES+=		opt-cli.0
     75 FILES+=		opt-cli.0.pro
     76 FILES+=		opt-cli.0.stdout
     77 FILES+=		opt-d.0
     78 FILES+=		opt-d.0.pro
     79 FILES+=		opt-d.0.stdout
     80 FILES+=		opt-di.0
     81 FILES+=		opt-di.0.pro
     82 FILES+=		opt-di.0.stdout
     83 FILES+=		opt-i.0
     84 FILES+=		opt-i.0.pro
     85 FILES+=		opt-i.0.stdout
     86 FILES+=		opt-l.0
     87 FILES+=		opt-l.0.pro
     88 FILES+=		opt-l.0.stdout
     89 FILES+=		opt-lc.0
     90 FILES+=		opt-lc.0.pro
     91 FILES+=		opt-lc.0.stdout
     92 FILES+=		opt-ldi.0
     93 FILES+=		opt-ldi.0.pro
     94 FILES+=		opt-ldi.0.stdout
     95 FILES+=		opt-npro.0
     96 FILES+=		opt-npro.0.pro
     97 FILES+=		opt-npro.0.stdout
     98 FILES+=		opt-ta.0
     99 FILES+=		opt-ta.0.pro
    100 FILES+=		opt-ta.0.stdout
    101 FILES+=		opt-ts.0
    102 FILES+=		opt-ts.0.pro
    103 FILES+=		opt-ts.0.stdout
    104 FILES+=		opt.0
    105 FILES+=		opt.0.pro
    106 FILES+=		opt.0.stdout
    107 FILES+=		opt_bacc.c
    108 FILES+=		opt_bad.c
    109 FILES+=		opt_badp.c
    110 FILES+=		opt_bap.c
    111 FILES+=		opt_bbb.c
    112 FILES+=		opt_bc.c
    113 FILES+=		opt_bs.c
    114 FILES+=		opt_cdb.c
    115 FILES+=		opt_ce.c
    116 FILES+=		opt_cs.c
    117 FILES+=		opt_dj.c
    118 FILES+=		opt_eei.c
    119 FILES+=		opt_ei.c
    120 FILES+=		opt_fbs.c
    121 FILES+=		opt_fc1.c
    122 FILES+=		opt_fcb.c
    123 FILES+=		opt_ip.c
    124 FILES+=		opt_lp.c
    125 FILES+=		opt_lpl.c
    126 FILES+=		opt_pcs.c
    127 FILES+=		opt_psl.c
    128 FILES+=		opt_sc.c
    129 FILES+=		opt_sob.c
    130 FILES+=		opt_ut.c
    131 FILES+=		opt_v.c
    132 FILES+=		parens.0
    133 FILES+=		parens.0.stdout
    134 FILES+=		parens.0.pro
    135 FILES+=		ps_ind_level.c
    136 FILES+=		struct.0
    137 FILES+=		struct.0.stdout
    138 FILES+=		surplusbad.0
    139 FILES+=		surplusbad.0.stdout
    140 FILES+=		surplusbad.0.pro
    141 FILES+=		t_options.awk
    142 FILES+=		token_binary_op.c
    143 FILES+=		token_case_label.c
    144 FILES+=		token_colon.c
    145 FILES+=		token_comma.c
    146 FILES+=		token_comment.c
    147 FILES+=		token_decl.c
    148 FILES+=		token_do_stmt.c
    149 FILES+=		token_end_of_file.c
    150 FILES+=		token_for_exprs.c
    151 FILES+=		token_form_feed.c
    152 FILES+=		token_funcname.c
    153 FILES+=		token_ident.c
    154 FILES+=		token_if_expr.c
    155 FILES+=		token_if_expr_stmt.c
    156 FILES+=		token_if_expr_stmt_else.c
    157 FILES+=		token_keyword_do.c
    158 FILES+=		token_keyword_do_else.c
    159 FILES+=		token_keyword_else.c
    160 FILES+=		token_keyword_for_if_while.c
    161 FILES+=		token_keyword_struct_union_enum.c
    162 FILES+=		token_lbrace.c
    163 FILES+=		token_lparen.c
    164 FILES+=		token_newline.c
    165 FILES+=		token_period.c
    166 FILES+=		token_postfix_op.c
    167 FILES+=		token_preprocessing.c
    168 FILES+=		token_question.c
    169 FILES+=		token_rbrace.c
    170 FILES+=		token_rparen.c
    171 FILES+=		token_semicolon.c
    172 FILES+=		token_stmt.c
    173 FILES+=		token_stmt_list.c
    174 FILES+=		token_storage_class.c
    175 FILES+=		token_string_prefix.c
    176 FILES+=		token_switch_expr.c
    177 FILES+=		token_type_def.c
    178 FILES+=		token_unary_op.c
    179 FILES+=		token_while_expr.c
    180 FILES+=		types_from_file.0
    181 FILES+=		types_from_file.0.stdout
    182 FILES+=		types_from_file.0.list
    183 FILES+=		types_from_file.0.pro
    184 FILES+=		wchar.0
    185 FILES+=		wchar.0.stdout
    186 
    187 add-test: .PHONY
    188 	@set -eu; \
    189 	test=${NAME:Q}.c; \
    190 	if [ "$$test" = ".c" ]; then \
    191 		echo "usage: ${MAKE} add-test NAME=<name>"; \
    192 		exit; \
    193 	fi; \
    194 	\
    195 	if [ -f "$$test" ]; then \
    196 		echo "error: test $$test already exists." 1>&2; \
    197 		exit 1; \
    198 	fi; \
    199 	\
    200 	echo "=> Adding test $$test"; \
    201 	printf '%s\n' \
    202 		'/* $$''NetBSD$$ */' \
    203 		'/* $$''FreeBSD$$ */' \
    204 		'' \
    205 		'/*' \
    206 		' * TODO: Explain the purpose of the test.' \
    207 		' */' \
    208 		'' \
    209 		'#indent input' \
    210 		'// TODO: add input' \
    211 		'#indent end' \
    212 		'' \
    213 		'#indent run [-options]' \
    214 		'// TODO: add expected output' \
    215 		'#indent end' \
    216 	> "$$test"; \
    217 	cvs add "$$test"; \
    218 	printf '%s\n' \
    219 		'/^FILES+=/i' \
    220 		"FILES+=		$$test" \
    221 		'.' 'w' 'q' \
    222 	| ed Makefile; \
    223 	${MAKE} sync-mi
    224 
    225 # Note: only works for adding tests.
    226 # To remove a test, the $$mi file must be edited manually.
    227 sync-mi: .PHONY
    228 	@set -eu;							\
    229 	cd "${MAKEFILE:tA:H}/../../..";					\
    230 	mi="distrib/sets/lists/tests/mi";				\
    231 	cvs update "$$mi";						\
    232 	fmt="./usr/tests/usr.bin/indent/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \
    233 	cat "$$mi" > "$$mi.tmp";					\
    234 	printf "$$fmt" ${FILES:M${NAME}*} >> "$$mi.tmp";		\
    235 	distrib/sets/fmt-list "$$mi.tmp";				\
    236 	mv "$$mi.tmp" "$$mi";						\
    237 	cvs diff "$$mi" || true
    238 
    239 .include <bsd.test.mk>
    240