gnu make - Makefile automatic rule dependency generation depends on another rule dependency generation -


i using 2 programming languages together. compiler takes program written first language (the source language) , translates them second language (the target language, me, c language). there few files generated way, , hand-written ones. finally, compile these file (in target language) executable code.

i managed generate automatically dependency files (classically named .d files) source language, tell makefile (i'm using gnu makefile) in order , when call first compiler. (order important compiler.) know how generate dependencies target language (using gcc). use include directive automatically include dependencies. makefile find rule call generate dependency files , include them.

makefile works in 3 phases. first, includes generated. second, generate missing includes if possible. third, tries build target.

now, generate automatically dependencies target language, first need generate files (since generated headers included) using first compiler.

here problem, in second phase: when makefile want generate dependency files target code, first try generate target code source code. but, if has generated dependency source code, didn't load these dependencies yet (dependencies read @ end of phase). fail compile source code, since dependent of order of compilation.

is there way solve problem ? can makefile instructed include generated dependencies generated ? there way alter "3 phase" behavior of makefile ?

suppose file in target language foo.c , generated foo.x. dependencies foo.c in file foo.d. suppose dependencies foo.x in foo.xd.

if run make foo.c, appears have rule building or rebuilding foo.d either appears in foo.d itself, or in main makefile. looks foo.d depends on foo.xd, doesn't exist yet (or foo.d depends on foo.c, depends on foo.xd.) if understand correctly, foo.xd cannot built reason (something order make processing makefile).

you might able build foo.d in different way doesn't depend on foo.xd. can depend on foo.c alone?

i'm not sure how relevant question, may worth noting dependency files not needed first time file built - if doesn't exist, has built , dependencies don't matter.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -