automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way to get rid of -MP parameter to gcc for dependency creation?


From: Ralf Wildenhues
Subject: Re: Any way to get rid of -MP parameter to gcc for dependency creation?
Date: Sat, 8 Jan 2011 20:42:37 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

* Xan Lopez wrote on Sat, Jan 08, 2011 at 08:28:35PM CET:
> a) If we end up doing a gnu-make mode, would it be possible to fix
> this somehow in automake? (see old thread for reference
> http://www.mail-archive.com/address@hidden/msg02266.html)

Yes, probably, but it will be a bit more work on our end.

> b) Any suggestion to workaround it in the meanwhile? We are thinking
> of rewriting the link rule and passing ld a file with the list of
> objects, since that seems to be supported.

What are your portability requirements?  Which systems do you need to
support, which binutils and GCC versions can you assume, which other
compilers?  Which make implementation (never mind) and version?

If new-enough GCC/binutils, then you can use @FILE support; but it's
also tricky to get the list of files written out without hitting the
limit.  So, I refer again to the trick used in GCC, which Paolo referred
you to already: Setup:

# write_entries_to_file - writes each entry in a list
# to the specified file.  Entries are written in chunks of
# $(write_entries_to_file_split) to accomodate systems with
# severe command-line-length limitations.
# Parameters:
# $(1): variable containing entries to iterate over
# $(2): output file
write_entries_to_file_split = 50
write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
        $(foreach range, \
          $(shell i=1; while test $$i -le $(words $(1)); do \
             echo $$i; i=`expr $$i + $(write_entries_to_file_split)`; done), \
          $(shell echo "$(wordlist $(range), \
                          $(shell expr $(range) + 
$(write_entries_to_file_split) - 1), $(1))" \
             | tr ' ' '\012' >> $(2)))


Usage:

target: deps
        @: $(call write_entries_to_file,$(FILES),$(temp_file_name))
        do something with $(temp_file_name)

CLEANFILES += $(temp_file_name)


Note this breaks on EBCDIC systems (yeah, I knew you didn't care).

Cheers,
Ralf



reply via email to

[Prev in Thread] Current Thread [Next in Thread]