2 Convert a date/time string to linear time.
5 doc/parse-datetime.texi
35 # The Automake generated .y.c rule is broken: When executed in a VPATH build,
36 # - The .c file gets generated in the build directory. But since it requires
37 # special tools to rebuild it, we need to distribute it in the tarballs,
38 # and by the GNU Coding Standards
39 # <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>
40 # the file should be generated in the source directory.
41 # - The #line numbers in the .c file refer to a nonexistent file once it
42 # has been moved from the build directory to the source directory. This
43 # leads to error if 'lcov' is used later.
44 # Additionally, here we assume GNU Bison and therefore don't need the ylwrap
46 # Therefore we override this rule.
47 # Since this is a rule that produces multiple files, we apply the idiom from
48 # <https://lists.gnu.org/archive/html/bug-make/2020-09/msg00008.html>, so that
49 # it works also in parallel 'make'.
50 generate-parse-datetime:
51 $(AM_V_YACC)$(PARSE_DATETIME_BISON) -d $(YFLAGS) $(AM_YFLAGS) $(srcdir)/parse-datetime.y \
52 && test ':' = '$(PARSE_DATETIME_BISON)' || { \
53 sed -e 's|".*/parse-datetime\.y"|"parse-datetime.y"|' \
54 -e 's|"parse-datetime\.tab\.c"|"parse-datetime.c"|' \
55 -e 's|"parse-datetime\.tab\.h"|"parse-datetime-gen.h"|' \
56 < parse-datetime.tab.c > parse-datetime.c-tmp \
57 && sed -e 's|".*/parse-datetime\.y"|"parse-datetime.y"|' \
58 -e 's|"parse-datetime\.tab\.h"|"parse-datetime-gen.h"|' \
59 < parse-datetime.tab.h > parse-datetime-gen.h-tmp \
60 && rm -f parse-datetime.tab.c parse-datetime.tab.h \
61 && mv parse-datetime.c-tmp $(srcdir)/parse-datetime.c \
62 && mv parse-datetime-gen.h-tmp $(srcdir)/parse-datetime-gen.h; \
64 .PHONY: generate-parse-datetime
65 # The above rule will generate files with time stamp order
66 # parse-datetime.y <= parse-datetime.c <= parse-datetime-gen.h.
67 parse-datetime.c: parse-datetime.y
68 @{ test -f $(srcdir)/parse-datetime.c && test ! $(srcdir)/parse-datetime.c -ot $(srcdir)/parse-datetime.y; } || $(MAKE) generate-parse-datetime
69 parse-datetime-gen.h: parse-datetime.c
70 @{ test -f $(srcdir)/parse-datetime-gen.h && test ! $(srcdir)/parse-datetime-gen.h -ot $(srcdir)/parse-datetime.c; } || $(MAKE) generate-parse-datetime
71 lib_SOURCES += parse-datetime.y
72 BUILT_SOURCES += parse-datetime.c parse-datetime-gen.h
73 MOSTLYCLEANFILES += parse-datetime.tab.c parse-datetime.tab.h parse-datetime.c-tmp parse-datetime-gen.h-tmp
74 MAINTAINERCLEANFILES += parse-datetime.c parse-datetime-gen.h
75 EXTRA_DIST += parse-datetime.c parse-datetime-gen.h