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