1 # $NetBSD: Makefile,v 1.28 2021/10/23 20:01:14 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= fmt_block.c 13 FILES+= fmt_decl.c 14 FILES+= fmt_else_comment.c 15 FILES+= indent_off_on.c 16 FILES+= label.c 17 FILES+= lex_ident.c 18 FILES+= lex_char.c 19 FILES+= lex_string.c 20 FILES+= list_head.0 21 FILES+= list_head.0.stdout 22 FILES+= offsetof.0 23 FILES+= offsetof.0.stdout 24 FILES+= opt--version.0 25 FILES+= opt--version.0.pro 26 FILES+= opt--version.0.stdout 27 FILES+= opt-U.0 28 FILES+= opt-U.0.list 29 FILES+= opt-U.0.pro 30 FILES+= opt-U.0.stdout 31 FILES+= opt-bap+sob.0 32 FILES+= opt-bap+sob.0.pro 33 FILES+= opt-bap+sob.0.stdout 34 FILES+= opt-npro.0 35 FILES+= opt-npro.0.pro 36 FILES+= opt-npro.0.stdout 37 FILES+= opt.0 38 FILES+= opt.0.pro 39 FILES+= opt.0.stdout 40 FILES+= opt_P.c 41 FILES+= opt_T.c 42 FILES+= opt_bacc.c 43 FILES+= opt_bad.c 44 FILES+= opt_badp.c 45 FILES+= opt_bap.c 46 FILES+= opt_bbb.c 47 FILES+= opt_bc.c 48 FILES+= opt_bl_br.c 49 FILES+= opt_bs.c 50 FILES+= opt_c.c 51 FILES+= opt_cd.c 52 FILES+= opt_cdb.c 53 FILES+= opt_ce.c 54 FILES+= opt_ci.c 55 FILES+= opt_cli.c 56 FILES+= opt_cs.c 57 FILES+= opt_d.c 58 FILES+= opt_di.c 59 FILES+= opt_dj.c 60 FILES+= opt_eei.c 61 FILES+= opt_ei.c 62 FILES+= opt_fbs.c 63 FILES+= opt_fc1.c 64 FILES+= opt_fcb.c 65 FILES+= opt_i.c 66 FILES+= opt_ip.c 67 FILES+= opt_l.c 68 FILES+= opt_lc.c 69 FILES+= opt_ldi.c 70 FILES+= opt_lp.c 71 FILES+= opt_lpl.c 72 FILES+= opt_pcs.c 73 FILES+= opt_psl.c 74 FILES+= opt_sc.c 75 FILES+= opt_sob.c 76 FILES+= opt_ta.c 77 FILES+= opt_ts.c 78 FILES+= opt_ut.c 79 FILES+= opt_v.c 80 FILES+= ps_ind_level.c 81 FILES+= t_options.awk 82 FILES+= token_binary_op.c 83 FILES+= token_case_label.c 84 FILES+= token_colon.c 85 FILES+= token_comma.c 86 FILES+= token_comment.c 87 FILES+= token_decl.c 88 FILES+= token_do_stmt.c 89 FILES+= token_end_of_file.c 90 FILES+= token_for_exprs.c 91 FILES+= token_form_feed.c 92 FILES+= token_funcname.c 93 FILES+= token_ident.c 94 FILES+= token_if_expr.c 95 FILES+= token_if_expr_stmt.c 96 FILES+= token_if_expr_stmt_else.c 97 FILES+= token_keyword_do.c 98 FILES+= token_keyword_do_else.c 99 FILES+= token_keyword_else.c 100 FILES+= token_keyword_for_if_while.c 101 FILES+= token_keyword_struct_union_enum.c 102 FILES+= token_lbrace.c 103 FILES+= token_lparen.c 104 FILES+= token_newline.c 105 FILES+= token_period.c 106 FILES+= token_postfix_op.c 107 FILES+= token_preprocessing.c 108 FILES+= token_question.c 109 FILES+= token_rbrace.c 110 FILES+= token_rparen.c 111 FILES+= token_semicolon.c 112 FILES+= token_stmt.c 113 FILES+= token_stmt_list.c 114 FILES+= token_storage_class.c 115 FILES+= token_string_prefix.c 116 FILES+= token_switch_expr.c 117 FILES+= token_type_def.c 118 FILES+= token_unary_op.c 119 FILES+= token_while_expr.c 120 FILES+= types_from_file.0 121 FILES+= types_from_file.0.stdout 122 FILES+= types_from_file.0.list 123 FILES+= types_from_file.0.pro 124 125 add-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. 165 sync-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