help-make
[Top][All Lists]
Advanced

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

RE: Tricky suffix rule problem for Corba


From: Paul D. Smith
Subject: RE: Tricky suffix rule problem for Corba
Date: Mon, 13 Feb 2006 12:29:07 -0500

%% Regarding RE: Tricky suffix rule problem for Corba; you wrote:

  >> What directory is make in when it executes?  

  cdf> In one of the source dirs, e.g. w,x,y or z

  >> Where are the idl files (that was in your email, but please restate
  >> it in a complete context)?

  cdf> They are one directory up and in a directory called 'idl', i.e. relative
  cdf> to the source dir ../idl/a.idl

  >> Where do you want the output files generated?  

  cdf> Where they currently get generated - in the source dirs (w,x,y or
  cdf> z in my example).

  >> What are the prerequisites used to find the .idl files presumably
  >> foo.o depends on foo.cc and foo.h for example: where are the .o
  >> files?...

  cdf> We have:

  cdf> =====================================
  cdf> IDL_HEADERS := ../idl/a.idl ../idl/b.idl

  cdf> IDL: $(IDL_HEADERS)

  cdf> $(LIBRARY): $(IDL_HEADERS) $(LIB_OBJS)
  cdf>  blah
  cdf>  blah

??  Why does $(LIBRARY) depend on $(IDL_HEADERS) ??
Also, what's the value of LIB_OBJS?

  cdf> %.h %.cc: %.idl
  cdf>  $(MICOIDL) $(MICOIDL_OPTS) $<

  cdf> %.h %.cc: $(TOPDIR)/idl/%.idl
  cdf>  $(MICOIDL) $(MICOIDL_OPTS) $< 
  cdf> ======================================

  cdf> Sheesh! I just noticed two rules for idl :-( Things are now
  cdf> getting really bad.

That's ok with make.  Make just walks through the patterns in the order
the appeared in the makefile, and the first one that matches is the one
that's used.  In this case the second one will never be used because the
first one will always match anything the second one would, and match it
first.

  >> exactly does the target/prerequisite line look like (what pathnames
  >> are used, etc.)?

  cdf> Hopefully the lines about should show you that?

Nope.

Given the above makefile and requirements, the following will do exactly
what you want:

    %.h %.cc : ../idl/%.idl
            $(MICOIDL) $(MICOIDL_OPTS) $<

(assuming that $(MICOIDL) will generate its output in the current
directory, even if the IDL file is somewhere else).

If that's not happening then somewhere in your make environment you must
be explicitly defining some prerequisite relationships between the .o
and .cc/.h files... maybe you have some kind of automated dependency
generator or similar?

We need to know what those lines look like.  Somehow you have to be
hooking the library to the .idl files with a chain of prerequisites, and
that's the part you're not showing us.  If you are simply relying on the
default prerequisites that come with make and nothing else, then the
pattern I show above will work.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]