|
Home > Archive > Unix questions > September 2005 > Makefile dependency Issue
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Makefile dependency Issue
|
|
| liam_herron 2005-09-13, 6:02 pm |
| I am currently having an issue getting the following Makefile commands
to work:
COMMONUTSOURCES= $(addprefix ./,$(shell ls $(COMMONUTDIR)/*.cpp))
COMMONUTOBJECTS = $(COMMONUTSOURCES:%.cpp=%.o)
$(COMMONUTOBJECTS): $(@:.o=.cpp)
$(MAKE) -C $(COMMONUTDIR)
App: $(COMMONUTOBJECTS)
<BUILD APPLICATION>
My main issue is trying to get the object to build when the .cpp
file has been updated. (e.g. I have a file named DateRangeTest.cpp)
when I do a "make -p", I do not see that the "$(@:.o=.cpp)" statement
above does anything. It shows up with no dependencies in the output of
the "make -p" command. Any ideas on how I can do this? I am running
Intel/Linux (RH). Here is the version
information:
-------------------------------------------------------------
make -v
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-linux-gnu
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Report bugs to <bug-make@gnu.org>.
-------------------------------------------------------------
Any help would be greatly appreciated.
| |
| Gianni Mariani 2005-09-14, 2:50 am |
| liam_herron wrote:
> I am currently having an issue getting the following Makefile commands
> to work:
>
Start with the default target as the first target in the Makefile.
App:
> COMMONUTSOURCES= $(addprefix ./,$(shell ls $(COMMONUTDIR)/*.cpp))
COMMONUTSOURCES= $(wildcard $(COMMONUTDIR)/*.cpp)
- why add the ./ prefix ?
> COMMONUTOBJECTS = $(COMMONUTSOURCES:%.cpp=%.o)
>
>
>
> $(COMMONUTOBJECTS): $(@:.o=.cpp)
> $(MAKE) -C $(COMMONUTDIR)
$(COMMONUTOBJECTS): $(COMMONUTSOURCES)
$(MAKE) -C $(COMMONUTDIR)
I don't really know what you're doing there, why not just do :
..PHONY : App_all
App_all :
$(MAKE) -C $(COMMONUTDIR)
>
> App: $(COMMONUTOBJECTS)
> <BUILD APPLICATION>
App: $(COMMONUTOBJECTS) App_all
<BUILD APPLICATION>
Did you try MakeXS ? It does all this stuff for you.
>
>
> My main issue is trying to get the object to build when the .cpp
> file has been updated. (e.g. I have a file named DateRangeTest.cpp)
....
|
|
|
|
|