[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Built sources and make distcheck
From: |
Tavian Barnes |
Subject: |
Re: Built sources and make distcheck |
Date: |
Mon, 23 Feb 2009 09:10:29 -0700 |
2009/2/23 Ralf Wildenhues <address@hidden>:
> Hello Tavian,
>
> * Tavian Barnes wrote on Mon, Feb 23, 2009 at 06:22:12AM CET:
>> EXTRA_PROGRAMS = generate
>> generate_SOURCES = generate.c
>>
>> generated.c: generate
>
> BTW, the prerequisite here would need to be generate$(EXEEXT).
Oh, right.
>> ./generate$(EXEEXT) >$@
>>
>> bin_PROGRAMS = lookup
>> lookup_SOURCES = lookup.c generated.c
>
> You need to use BUILT_SOURCES, and fake dependencies so that no
> distributed file depends on an undistributed one. Untested:
>
> EXTRA_PROGRAMS = generate
> BUILT_SOURCES = generate$(EXEEXT)
> generated.c: generate.c Makefile.in
> ./generate$(EXEEXT) >$@
> bin_PROGRAMS = lookup
> lookup_SOURCES = lookup.c generated.c
Great, thanks!
>> This is almost right, but because generated.c gets distributed but
>> `generate' doesn't, make sees generated.c as out-of-date in the
>> tarballs, and re-builds it. This is worse when `make distcheck' is
>> run, because of the VPATH build; $@ isn't even the right location to
>> write to,
>
> generated.c can live in the source or in the build tree. But given that
> different make implementations have slightly different VPATH semantics,
> it may be useful to require it to always live in the source tree;
> further, it may be useful to update it lazily (this shouldn't matter for
> read-only trees iff your dependencies are set up correctly, but it
> should make for faster rebuilds):
>
> $(srcdir)/generated.c: generate.c Makefile.in
> ./generate$(EXEEXT) > tmp-generated.c
> if diff tmp-generated.c $@ >/dev/null 2>&1; then \
> rm -f tmp-generated.c; \
> else \
> mv -f tmp-generated.c $@; \
> fi
>
> lookup_SOURCES = lookup.c $(srcdir)/generated.c
I've got it living in $(srcdir) now, thanks. I can't see why your
version of a lazy update would speed it up though. It still runs
./generate, and now it's running diff too, right?
>> and the source directory is read-only anyway, so a qualified
>> path wouldn't help. Is there any way to not build the `generate'
>> target if generated.c exists, but still build it when it doesn't?
>
> Hope that helps.
>
> Cheers,
> Ralf
>
It did. Thanks again.
--
Tavian Barnes