This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: automatic dependencies for gcc
Tom Tromey wrote:
"Richard" == Richard Guenther <richard.guenther@gmail.com> writes:
Richard> It seems that changes in builtins.def or builtin-types.def do
Richard> not cause re-builds of their dependencies.
A while back I was thinking, "I wish I got more response to my patches".
I'm kind of regretting that now.
Back to the subject of automatic dependencies for GCC my MELT branch
http://gcc.gnu.org/wiki/MiddleEndLispTranslator has similar needs.
See http://gcc.gnu.org/ml/gcc/2008-03/msg00839.html
http://gcc.gnu.org/ml/gcc/2008-03/msg00810.html
http://gcc.gnu.org/ml/gcc/2008-03/msg00668.html
http://gcc.gnu.org/ml/gcc/2008-03/msg00549.html
http://gcc.gnu.org/ml/gcc/2008-03/msg00524.html
http://gcc.gnu.org/ml/gcc/2008-03/msg00152.html
http://gcc.gnu.org/ml/gcc/2008-02/msg00682.html
http://gcc.gnu.org/ml/gcc/2008-02/msg00632.html
http://gcc.gnu.org/ml/gcc/2008-02/msg00419.html
and other messages in the referenced threads
MELT is able to generate C code and to tldl_dlopenext (almost like
dlopen-ing a dynamic library) the binary dynamically loadable stuff (a
*.so ELF shared object on Linux & Solaris...) obtained from the
generated code. Notice that this code generation and dynamic loading may
happen within cc1 (for some peculiar long-lasting passes and compile flags).
Each such generated C code needs include files internal to GCC. They are
all wrapped in one particular include gcc/run-basilys.h which is the
only #include in such generated C code.
So I need to copy all the files needed by this gcc/run-basilys.h in a
suitable place. At the moment I have the following (near the end of) my
gcc/Makefile.in (in MELT branch):
#########################
# we want to generate all the direct (non system) dependencies of
#run-basilys.h
# the following should work if $(CC) is some recent version of GCC
#(probably >= 4.x)
# we first generate the make-dependencies using -MMD
# this should write into run-basilys.d some stuff like
## run-basilys-deps: srcdir.../gcc/run-basilys.h config.h auto-host.h ....
# with the srcdir... replaced by the source directory
# however, there are also config/ files in the dependency list
# config/ files should be handled specially since they are the only
#include-d files
# which are not flat, ie in a subdirectory, like
srcdir.../gcc/config/i386/x86-64.h
# there is also a dependency on tm.h (in objdir) which contains stuff
like #include "config/i386/x86-64.h"
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
## perhaps this should really use depcomp, because this works only if
## CC is some gcc 4.x since it use the precompiled headers feature
$(CC) -MT run-basilys-deps -MMD -MF $@ $(ALL_CFLAGS) $(ALL_CPPFLAGS) $<
-o run-basilys.h.gch
.PHONY: run-basilys-deps
## the include below defines the dependencies of run-basilys-deps
## included file run-basilys.d is generated above
-include run-basilys.d
## copy all the file in the dependency of run-basilys-deps into
#$(melt_build_include_dir)
## but handle the $(srcdir)/config/ files specially by copying them
#within a config/ directory
run-basilys-deps:
# echo '***' IN run-basilys-deps TARGET '***'
$(mkinstalldirs) $(melt_build_include_dir); \
for f in $^ ; do \
cf=`echo $$f | sed
"s:$(srcdir)/config/:$(melt_build_include_dir)/config/:"`; \
if [ "x$$f" != "x$$cf" ] ; then \
$(mkinstalldirs) `dirname $$cf` ; \
cp -p $$f $$cf ; \
else \
cp -p $$f $(melt_build_include_dir)/ ; \
fi; \
done
########################
it sort of works on my Debian system, but it is definitely not
satisfactory (it probably should break on any non Linux/Gcc system).
Maybe using depcomp could help, but I don't know how.
Comments and suggestions (or even patches in to the latest of MELT
branch) are appreciated.
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} ***