Ralf Wildenhues wrote:
Hello Basile,

A mere quick portability review:

A big thanks


* Basile STARYNKEVITCH wrote on Thu, Feb 28, 2008 at 05:39:47PM CET:
compile-basilys-defs:   
        echo '#generated compile-basilys-defs' > $@
        echo 'ALL_CFLAGS="' $(ALL_CFLAGS) '"' >> $@
        echo 'ALL_CPPFLAGS="' -I$(PWD) $(ALL_CPPFLAGS) '"' >> $@

You should output to a temporary file and mv that to the target.
That avoids incomplete (yet seemingly up to date) files when the
user aborts with CTRL-\.  See other targets that do similar.

run-basilys.d: run-basilys.h \
   $(CONFIG_H) $(SYSTEM_H) $(TIMEVAR_H) $(TM_H)  $(TREE_H)  $(GGC_H)  \
   tree-pass.h basilys.h gt-basilys.h
      $(CC) -MT run-basilys-deps -MMD  $(ALL_CFLAGS) $(ALL_CPPFLAGS) $<

The build compiler may not be gcc and may not understand -MT and -MMD.

Yes, I know. But how can I avoid that?


Wasn't there a proposal to use depcomp in gcc a while ago?

What is depcomp exactly? Apparently there is a depcomp file at top of GCC sourcedir. What exactly for? It appears in libcpp/Makefile.in but I am not sure to understand fully how to use it.

Anyway, I do not plain to run my MELT when host compiler is not GCC...

Actually, it could happen that MELT generated C files uses GCC extension (they don't use them yet)


run-basilys-deps:
        mkdir -p $(melt_build_include_dir); \

mkdir -p is not portable, use $(mkinstalldirs).

Is $(mkinstalldirs) usable for non-installed directories? (in other words, it does not do any chown or chmod?

        for f in $^ ; do \

                cf=$(echo $$f | sed -q 
":^$(srcdir)/config/:$(melt_build_include_dir)/config:"); \

Did you mean `echo ... ` here?  make will interpret $(echo ...) wrongly,
Yes!
I think this command will do nothing.  Also, I think two spaces extra
indentation is normal in the GCC Makefile command lines.

"sed -q" is not portable, but "sed -n" is.  Also, your sed script looks
very weird.  Did you mean to use the 's' command?  If yes, you rely on
"$(srcdir)/config/" not containing any colons nor any other characters
special to sed.  You might want to use '|' as delimiter instead of ':'.

                if [ -n "$$cf" ] ;  then  \
                        cp -va $$f $$cf ; \

"cp -va" is not portable.  You can use cp -pR.

Actually -p is enough; I'm copying files only!


                else  \
                        cp -va $$f $(melt_build_include_dir)/ ; \

Likewise.


Thanks for your input. It helps a lot.

Regards.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

Reply via email to