Re: GTK+ (embarrassing) Makefile question...



From: Christian Seberino <seberino spawar navy mil>
>
> This Makefile will recreate GTK+ object file if header file
> is "touched" with touch command which is good....
>
> It will NOT recreate object file when *.cpp file is 
> "touched" the same way.
>
> WHY IS the "%.o: %.h" rule working
> but the "%.o: %.cpp" rule IS NOT!!??!?!?
>
> Here is makefile...

<snip>

> %.o:		%.h
> 		$(CPPC) $(FLAGS) -c $*.cpp
>
> %.o:		%.cpp
> 		$(CPPC) $(FLAGS) -c $<

While you are allowed to have more than one dependency for a file, you are not
allowed to have more than one rule on how to build that file. What you need is:

%.o:		%.h %.cpp
		$(CPPC) $(FLAGS) -c $*.cpp

BTW, this isn't really a gtk+ specific question. This would be more
appropriate on a discussion list for "make".

Ron Steinke



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]