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