Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting a list of all dependencies in make
    primarykey
    data
    text
    <p>I'm trying to write an etags target in make based on the dependency information generated by gcc. Is there some way of getting at all the dependencies in one go? Or, failing that, how would I write a rule that is only executed when the "tags" target is made and that passes all the source and header files to etags? I only want to index the files actually compiled (including headers). I'm aware that I can sed around in the .d files myself but I'm trying to find a more elegant and less brittle solution.</p> <p>I have the following (excerpt)</p> <pre><code>DEPFILES = $(OBJFILES:.o=.d) %.o : %.c @echo "Compiling $&lt;" $(NO_ECHO) $(CC) $(CFLAGS) -MMD -MF $(@:.o=.d) -o $@ -c $&lt; %.o : %.S @echo "Compiling $&lt;" $(NO_ECHO) $(CC) $(ASFLAGS) -MMD -MF $(@:.o=.d) -o $@ -c $&lt; $(TARGET) : $(OBJFILES) @echo "Linking $@" $(NO_ECHO) $(LD) $(LDFLAGS) -o $@ $(OBJFILES) $(LIBS:%=-l%) .PHONY: clean # Order-only dependency to make Dep/obj-directories if they are not # present $(OBJFILES) : | $(ALLPATHS) $(ALLPATHS): $(NO_ECHO) mkdir -p $(ALLPATHS) # Depend on the makefiles $(OBJFILES) : $(SRC_PATH)/Makefile $(MAKECFG) $(BUILDCFG) # Include dependency files sinclude $(DEPFILES) </code></pre> <p>Edit : The following seems to work but I'd really like to find a more elegant solution (the double sort/uniq is just for performance).</p> <pre><code>tags : $(TARGET) cat $(DEPFILES) | sort | uniq | sed 's/.*:.*$$//' | tr -d '\\' | tr "\n" " " | xargs -n 1 readlink -f | sort | uniq | xargs etags -a </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload