1# Copyright (C) 2013-2020 Assaf Gordon <assafgordon@gmail.com> 2# 3# This file is free software; as a special exception the author gives 4# unlimited permission to copy and/or distribute it, with or without 5# modifications, as long as this notice is preserved. 6# 7# This program is distributed in the hope that it will be useful, but 8# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 9# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 11ACLOCAL_AMFLAGS = -I m4 12 13AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src 14 15EXTRA_DIST = \ 16 build-aux/make_bin_dist.sh \ 17 build-aux/prerelease-checks.sh \ 18 build-aux/git-log-fix \ 19 build-aux/create_small_file_system.sh \ 20 build-aux/create_corrupted_file_system.sh \ 21 contrib/bash-completion/datamash \ 22 m4/gnulib-cache.m4 23 24SUBDIRS = po 25 26## 27## Main Program 28## 29bin_PROGRAMS = datamash decorate 30 31datamash_SOURCES = src/system.h \ 32 src/die.h \ 33 src/text-options.c src/text-options.h \ 34 src/utils.c src/utils.h \ 35 src/text-lines.c src/text-lines.h \ 36 src/column-headers.c src/column-headers.h \ 37 src/op-defs.c src/op-defs.h \ 38 src/op-scanner.c src/op-scanner.h \ 39 src/op-parser.c src/op-parser.h \ 40 src/field-ops.c src/field-ops.h \ 41 src/crosstab.c src/crosstab.h \ 42 src/double-format.c src/double-format.h \ 43 src/datamash.c 44 45datamash_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(MINGW_CFLAGS) 46datamash_LDADD = \ 47 lib/lib$(PACKAGE).a \ 48 $(CEIL_LIBM) \ 49 $(CEILL_LIBM) \ 50 $(EXP_LIBM) \ 51 $(EXPL_LIBM) \ 52 $(FABS_LIBM) \ 53 $(FABSL_LIBM) \ 54 $(FLOOR_LIBM) \ 55 $(FLOORL_LIBM) \ 56 $(FREXP_LIBM) \ 57 $(FREXPL_LIBM) \ 58 $(ISNANL_LIBM) \ 59 $(LDEXP_LIBM) \ 60 $(LDEXPL_LIBM) \ 61 $(LIB_CRYPTO) \ 62 $(LIB_HARD_LOCALE) \ 63 $(LIB_MBRTOWC) \ 64 $(LIB_SETLOCALE_NULL) \ 65 $(LIBICONV) \ 66 $(LIBINTL) \ 67 $(LOG_LIBM) \ 68 $(LOGL_LIBM) \ 69 $(MODF_LIBM) \ 70 $(MODFL_LIBM) \ 71 $(ROUND_LIBM) \ 72 $(ROUNDL_LIBM) \ 73 $(SQRT_LIBM) \ 74 $(SQRTL_LIBM) \ 75 $(TRUNC_LIBM) \ 76 $(TRUNCL_LIBM) 77 78decorate_SOURCES = src/decorate.c \ 79 src/key-compare.c src/key-compare.h \ 80 src/decorate-functions.c src/decorate-functions.h 81decorate_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(MINGW_CFLAGS) 82decorate_CPPFLAGS = $(AM_CPPFLAGS) \ 83 -DKEY_COMPARE_DECORATION \ 84 -DKEY_COMPARE_HUMAN_NUMERIC \ 85 -DKEY_COMPARE_NONPRINTING \ 86 -DKEY_COMPARE_MONTH \ 87 -DKEY_COMPARE_RANDOM \ 88 -DKEY_COMPARE_REVERSE \ 89 -DKEY_COMPARE_VERSION 90 91decorate_LDADD = lib/lib$(PACKAGE).a \ 92 $(LIBICONV) \ 93 $(LIBINTL) 94 95# Add LOCALDIR for gettext 96localedir = $(datadir)/locale 97DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ 98 99 100## 101## Man Page 102## 103 104man_MANS = datamash.1 decorate.1 105EXTRA_DIST += $(man_MANS) \ 106 man/datamash.x \ 107 man/decorate.x \ 108 man/help2man 109 110CLEANFILES = 111 112## Re-generate the man-page from the --help screen only if building from 113## a GIT repository (implying developers). 114## When building from tar-ball, the manpage should already exist. 115## (This conditional is defined in 'configure.ac') 116## NOTE: 117## If user is building from GIT *and* cross-compiling, 118## the manpage would be required, but can't be generated. 119## 'make' will fail with an error. 120## If this is ever a real-world issue, deal with it... 121if BUILD_FROM_GIT 122datamash.1: datamash $(top_srcdir)/man/datamash.x 123 PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'$$PATH \ 124 perl $(abs_top_srcdir)/man/help2man \ 125 --include=$(top_srcdir)/man/datamash.x \ 126 datamash -o $@-t 127 chmod u=rw,go=r $@-t 128 mv -f $@-t $@ 129 130decorate.1: decorate $(top_srcdir)/man/decorate.x 131 PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'$$PATH \ 132 perl $(abs_top_srcdir)/man/help2man \ 133 --include=$(top_srcdir)/man/decorate.x \ 134 decorate -o $@-t 135 chmod u=rw,go=r $@-t 136 mv -f $@-t $@ 137 138CLEANFILES += $(man_MANS) 139endif 140 141## 142## Tests 143## 144TEST_EXTENSIONS = .pl .sh 145if PERL_FOUND 146PL_LOG_COMPILER=$(PERL) 147else 148PL_LOG_COMPILER=$(SHELL) $(top_srcdir)/tests/no-perl 149endif 150 151 152TESTS = \ 153 tests/datamash-show-env.sh \ 154 tests/datamash-tests.pl \ 155 tests/datamash-tests-2.pl \ 156 tests/datamash-parser.pl \ 157 tests/datamash-error-msgs.pl \ 158 tests/datamash-md5.pl \ 159 tests/datamash-sha.pl \ 160 tests/datamash-rand.sh \ 161 tests/datamash-stats.pl \ 162 tests/datamash-transpose.pl \ 163 tests/datamash-crosstab.pl \ 164 tests/datamash-check.pl \ 165 tests/datamash-pair-tests.pl \ 166 tests/datamash-check-tabular.pl \ 167 tests/datamash-output-format.pl \ 168 tests/datamash-sort-header.sh \ 169 tests/datamash-sort-errors.sh \ 170 tests/datamash-io-errors.sh \ 171 tests/datamash-strbin.sh \ 172 tests/datamash-valgrind.sh \ 173 tests/decorate-tests.pl \ 174 tests/decorate-errors.pl \ 175 tests/decorate-sort-tests.pl 176 177EXTRA_DIST += \ 178 tests/no-perl \ 179 tests/Coreutils.pm \ 180 tests/CuSkip.pm \ 181 tests/CuTmpdir.pm \ 182 tests/init.sh \ 183 init.cfg \ 184 $(TESTS) 185 186# Note: the "9>&2" redirection is part of Automake's parallel-tests. 187# see also stderr_fileno in 'init.cfg' 188TESTS_ENVIRONMENT = \ 189 top_srcdir=$(abs_top_srcdir) \ 190 PERL5LIB='$(abs_top_srcdir)/tests$(PATH_SEPARATOR)'"$$PERL5LIB" \ 191 PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'$$PATH \ 192 DATAMASH=`echo datamash | sed '$(transform)'` \ 193 DECORATE=`echo decorate | sed '$(transform)'` \ 194 test_dir='$(abs_top_srcdir)/tests' ; \ 195 export top_srcdir PERL5LIB PATH DATAMASH DECORATE test_dir ; \ 196 9>&2 197 198## 199## For 'make syntax-check' 200## 201EXTRA_DIST += \ 202 cfg.mk 203 204 205 206## 207## Examples 208## 209 210## These example files will be installed in the 211## "{prefix}/share/APPNAME/examples" directory 212## (default "/usr/local/share/datamash/examples") 213examplesdir = $(pkgdatadir)/examples 214 215dist_examples_DATA = examples/readme.md \ 216 examples/scores.txt examples/scores_h.txt \ 217 examples/genes.txt examples/genes_h.txt 218 219EXTRA_DIST += $(dist_examples_DATA) 220 221if ENABLE_BASH_COMPLETION 222dist_bashcomp_DATA = contrib/bash-completion/datamash 223endif 224 225 226 227 228## 229## PO/gettext check 230## 231 232# Verify that all source files using _() are listed in po/POTFILES.in. 233# The idea is to run this before making pretests, as well as official 234# releases, so that translators will be sure to have all the messages. 235# (From coreutils.) 236po-check: 237 if test -f po/POTFILES.in; then \ 238 grep -E -v '^(#|$$)' po/POTFILES.in \ 239 | grep -v '^src/false\.c$$' | sort > $@-1; \ 240 files=; \ 241 for file in $$($(CVS_LIST_EXCEPT)) `find * -name '*.[ch]'`; do \ 242 case $$file in \ 243 gnulib/* | man/*) continue;; \ 244 esac; \ 245 case $$file in \ 246 *.[ch]) \ 247 base=`expr " $$file" : ' \(.*\)\..'`; \ 248 { test -f $$base.l || test -f $$base.y; } && continue;; \ 249 esac; \ 250 files="$$files $$file"; \ 251 done; \ 252 grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files \ 253 | sort -u > $@-2; \ 254 diff -u $@-1 $@-2 || exit 1; \ 255 rm -f $@-1 $@-2; \ 256 fi 257 258## 259## GnuLib 260## 261 262LOG_COMPILER = 263MAINTAINERCLEANFILES= 264noinst_LIBRARIES = 265MOSTLYCLEANFILES = 266MOSTLYCLEANDIRS = 267BUILT_SOURCES = 268 269## 270## Documentation, using Gnulib's 'gendocs' module 271## 272gendocs = build-aux/gendocs.sh 273gendocs_envvars = GENDOCS_TEMPLATE_DIR=doc 274# 275manual = datamash 276manual_title=GNU datamash 277email = $(PACKAGE_BUGREPORT) 278gendocs_args = --email $(email) $(manual) $(manual_title) 279 280# This will affect the result of 'make web-manual' 281# all generated HTML files will contain the embedded CSS statements. 282# 'gendocs_options_' is used in the 'web-manual' target in 'maint.mk'. 283gendocs_options_=\ 284 --html "--css-include=$(abs_top_srcdir)/doc/datamash-texinfo.css" 285 286 287include $(top_srcdir)/lib/local.mk 288include $(top_srcdir)/doc/local.mk 289 290## 291## Compute program's code complexity 292## using gnulib's pmccabe2html module 293 294cyclo_sources = ${top_srcdir}/src/*.[ch] 295svweburl="https://git.savannah.gnu.org/cgit/" 296 297cyclo-$(PACKAGE).html: $(cyclo_sources) 298 $(PMCCABE) $(cyclo_sources) \ 299 | sort -nr \ 300 | $(AWK) -f ${top_srcdir}/build-aux/pmccabe2html \ 301 -v lang=html -v name="$(PACKAGE_NAME)" \ 302 -v vcurl="$(svweburl)/$(PACKAGE).git/tree/%FILENAME%" \ 303 -v url="https://www.gnu.org/software/$(PACKAGE)/" \ 304 -v css=${top_srcdir}/build-aux/pmccabe.css \ 305 -v cut_dir=${top_srcdir}/ \ 306 > $@-tmp 307 mv $@-tmp $@ 308 309## 310## 311## 312 313dist-hook: gen-ChangeLog 314 $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version 315 316gen_start_date = 2011-12-17 317.PHONY: gen-ChangeLog 318gen-ChangeLog: 319 $(AM_V_GEN)if test -d .git; then \ 320 $(top_srcdir)/build-aux/gitlog-to-changelog \ 321 --amend=$(srcdir)/build-aux/git-log-fix \ 322 --since=$(gen_start_date) > $(distdir)/cl-t; \ 323 rm -f $(distdir)/ChangeLog; \ 324 mv $(distdir)/cl-t $(distdir)/ChangeLog; \ 325 fi 326 327# Shortcut targets to make it easier to run (very) expensive tests. 328check-expensive: 329 $(MAKE) check RUN_EXPENSIVE_TESTS=yes 330check-very-expensive: 331 $(MAKE) check-expensive RUN_VERY_EXPENSIVE_TESTS=yes 332