[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to add specified lib path in the dependency file
From: |
sgu |
Subject: |
How to add specified lib path in the dependency file |
Date: |
29 Dec 2004 10:21:56 -0800 |
User-agent: |
G2/0.2 |
Hi All,
I am involved in Vxworks OS related projects in WinXP OS.
but the original makefile is hard to use.
My project's architecture is like folows:
c:/project/source/xxx/xxx.c
c:/project/lib/objxxx/objxxx.o
c:/project/config/all/makefile
c:/project/config/all/xxx/makefile
c:/project/config/all/xxx/xxx.d
I use "CC -MD" produce the xxx.d file automatically.
and include the dependency file in makefile.
but it still can not work, since the xxx.d is like the follows:
xxx.o: a.c b.c d.h
The rule take no actions, it should be like follows:
c:/project/lib/objxxx/xxx.o: a.c b.c d.h ...
I know the prefix path, but how to insert it to dependency file
automatically?
I tried to use sed as follows:
$(LIBDIR)/%.o : %.c
$(CC) -MD $(CFLAGS) $@ $<
sed -e s/$(@F)/$(LIBDIR)\$(@F)/ $(patsubst %.o,%.d,$(@F))> $(patsubst
%.o,%.d,$(@F)).tmp
$(MV) $(patsubst %.o,%.d,$(@F)).tmp $(patsubst %.o,%.d,$(@F))
but it failed, since the sed command run as follows:
sed -e s/aaa.o/c:/project/lib/objaaa/aaa.o/ aaa.d > aaa.d.tmp
"/" will be ignored,
so it will be:
c:projectlibobjxxxobjxxx.o: a.c b.c d.h
Any good comments about my puzzle is very appreciated.
P.S.
Is there a variable can be set in GNU makefile, that can add a
specified prefix path for the target in dependency file?
Regards!
Sailor
- How to add specified lib path in the dependency file,
sgu <=