Makefile dependency Issue
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix questions > Makefile dependency Issue




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Makefile dependency Issue  
liam_herron


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-13-05 11: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.






[ Post a follow-up to this message ]



    Re: Makefile dependency Issue  
Gianni Mariani


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-14-05 07: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)

...





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:23 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register