[squid-dev] [RFC] The situation with helpers/
Kinkie
gkinkie at gmail.com
Wed Jan 13 22:07:29 UTC 2016
On Wed, Jan 13, 2016 at 10:13 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:
> On 14/01/2016 2:12 a.m., Kinkie wrote:
>>
>> About build dependencies from src/ : while refactoring some helpers I
>> came across a recipe which seems reasonably clean and maintainable,
>> and I submit it for consideration until a more structured approach
>> (such as lifting helpers/ into src/) can be chosen:
>>
>> In each helper's Makefile.am, the following clauses must be added:
>>
>> IMPORTED_FILES = <list of files including paths relative to src/ to be
>> imported into the helper's directory from src>
>> nodist_<target>_SOURCES = $(IMPORTED_FILES)
>> <target>_DEPENDENCIES = $(IMPORTED_FILES)
>> CLEANFILES += $(IMPORTED_FILES)
>
> Okay on the above. "Nooooo..." on the below bit.
>
>>
>> $(IMPORTED_FILES): $(top_srcdir)/src/$@
>> test -d $(dir $@)|| mkdir -p $(dir $@)
>> cp $(top_srcdir)/src/$@ $@
>>
>
> ... doing it like that will make dozens of .am snippets of code that
> have to be maintained in-sync forever.
>
> Like I said on IRC this part needs to be in a src/ImportedFiles.am that
> gets included wherever its needed. Not copy-pasted everywhere.
> See how we use doc/manuals/Substitute.am if you want an example.
My bad, I thought your suggestion was to factor out the whole recipe,
and that wouldn't work.
This snippet alone will.
> All that the various Makefile.am should contain is the X=Y variable
> definitions followed by a "include src/ImportedFiles.am" statement.
>
>
> And for the love of all thats holy, avoid *_DEPENDENCIES variables.
Won't work without, unfortunately. Without _DEPENDENCIES, the
generated Makefile will copy the .cc files, but not the .h files.
> When DEPENDENCIES is *absent*, automake will take the SOURCES list and
> add dependency for each file listed, plus (compiler version dependent) a
> sub-dependency recursively for each file #include'd by those. It will
> also take the LDADD list and for all local tree objects will add a
> dependency. It is smart enough to filter out flags and system libraries
> nowdays (AFAICT that was the reason DEPENDENCIES was used to begin with
> back in Y2K).
>
> When DEPENDENCIES is present only objects explicitly listed in that
> variable are dependencies. *all* of the existing ones are broken and
> breaking Squid builds.
I hadn't understood htis, however I don't know how to force automake
to copy the .h files without :( Any idea?
>> <target> must be replaced with the executable's name. The need for
>> this replacement unfortunately means that this recipe must be copied
>> to each helper, and can't be factored out.
>
> The important part to factor away duplication of is:
>
>> $(IMPORTED_FILES): $(top_srcdir)/src/$@
>> test -d $(dir $@)|| mkdir -p $(dir $@)
>> cp $(top_srcdir)/src/$@ $@
>>
>
> which does not contain the "target" bit.
Agreed.
Thanks!
--
Francesco
More information about the squid-dev
mailing list