c++ - Adding a file to GNU dependency list? -


i made simple makefile compile avr code. have rule follows:

%.o: %.c     $(cc) -c -o $@ $<     $(cc) -m $(flags) $*.c > $*.d | sed -e ':?:? avr.rules ?' 

i'm trying make in test.d,

test.o: test.c test.h avr.rules 

i've done before similar sed command can't seem now. can give me pointer here?

you say

%.o: %.c     $(cc) -c -o $@ $<     $(cc) -m $(flags) $*.c > $*.d     echo '$@: avr.rules' >> $*.d 

there's no problem having multiple dependency-tracking targets (since none of them have recipe).

if insist on doing sed,

    $(cc) -m $(flags) $*.c | sed 's/:/: avr.rules/' > $*.d 

will work.

side note: use $< instead of $*.c.


Comments