質問

In my project i use a source generator. Now for the make dist target i don't want the end user to require the generator, so i decided to add pregenerated source files to the tarball by using

EXTRA_DIST = generated.cc

Unfortunately the Makefile in the creates tarball also contains the rule to generate generated.cc

generated.cc : input.txt
          scarygenerator input.txt > $(top_builddir)/generated.cc

As input.txt is not part of the tarball this rule is executed and fails.

It it possible that "make dist" omits this rule when generating the Makefile for the tarball?

役に立ちましたか?

解決

The autotools are designed to make compliance with the GPL easier (e.g. the corresponding source, which in this case might include input.txt and scarygenerator). However, since your project may not be bound by GPL restrictions, you can do this to not include index.txt in the tarball:

configure.ac

AC_MSG_CHECKING([for source generation])
AS_IF([test -f index.txt], [gen_source=yes], [gen_source=no])
AC_MSG_RESULT($gen_source)
AM_CONDITIONAL([GEN_SOURCE], [test x$gen_source = xyes])

Makefile.am

bin_PROGRAMS = foo
foo_SOURCES = ... generated.cc

if GEN_SOURCE

generated.cc : index.txt
    scarygenerator $< > $@
endif
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top