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: CARTER-HITCHIN, David, FM
Subject: RE: Tricky suffix rule problem for Corba
Date: Mon, 13 Feb 2006 18:08:21 -0000

Hi Paul,

I've managed to 50% fix this problem - but I need 100%!  If I do:

cp `basename address@hidden ../idl/

as part of the IDL rule the the resulting header get's copied to the idl
dir, 
so the next time make runs it finds this and says "Nothing to be done".
Hooray!
The problem is that when I do a clean it does not clean out
../idl/whatever.h.
I *could* add a clean rule to 'rm -f ../idl/*.h' but that will potentially
interfere with other modules that have IDL deps.

> ??  Why does $(LIBRARY) depend on $(IDL_HEADERS) ??

Not sure - I didn't write that one.  Presumably any library needs to check 
if IDL headers are needed (in most cases IDL_HEADERS will be blank).

> Also, what's the value of LIB_OBJS?

I think it's the .o's required for the particular part of the code we're
compiling,
I don't think it's relevant here...

> 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).

This doesn't work - the target is still considered as "../idl/a.h" so any
re-make
will consider that work needs to be done as it is looking in a place where
the 
headers were not generated. 
 
> 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?

I'll paste the whole of our rules file below, but there are no other 
rules which indicate any connection between .cc's and .h's - or at least
any that I've spotted.

> 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.

Here are the rules we use.  If this doesn't show you what the problem is
then 
I can do something else...   you're very kind for all your help, thank you.

David.
------------------

#---------------------------------------------------------------------------
---
#
#   The real rules...
#
#---------------------------------------------------------------------------
---

# For executable programs, this is the first rule of the makefile
# for the libraries, there is a line before the inclusion of this file
#    default: lib
# which becomes the first rule of the makefile, and hence build that.
# Personally I think that we should have the real target rule defined at the
# top of each makefile.  It has a tendancy to help people that actually
understand make.
#
bin: sharedir ml_prebuild $(BINARY)

# make the ml source files from the .ml files prior to publishing or
building the library
lib: sharedir ml_prebuild publish $(LIBRARY)

sharedir:
        @if [ ! -d $(SHARED_OBJ_DIR) ]; then mkdir -p $(SHARED_OBJ_DIR); fi
        @if [ ! -d $(ABACUS_LIB_DIR) ]; then mkdir -p $(ABACUS_LIB_DIR); fi

ml_prebuild: $(ML_SOURCES) $(ML_HEADERS)

$(BINARY): $(GDS_LIB_FILES) $(IDL_HEADERS) $(MOD_OBJS)
        @echo
"--------------------------------------------------------------"
        $(TOOL_COMMAND) $(CXX) $(LIB_FLAGS) -o $@ $(MOD_OBJS) $(LDFLAGS)
$(SHAUXLIBS) $(LINK_LIBS) $(WRAP_LIBS)
        @echo
"--------------------------------------------------------------"

# make the idl files prior to building the lib.
IDL: $(IDL_HEADERS)

# MYLIBDIR can be used instead of libsun4,
# which allows a single library to be built without having the full
directory structure

$(LIBRARY): $(IDL_HEADERS) $(LIB_OBJS)
        @echo
"--------------------------------------------------------------"
        $(LD) $(SHLDFLAGS) -o $(LOCAL_LIB)~ $(LIB_FLAGS) $(LIB_OBJS)
$(SHAUXLIBS) $(WRAP_LIBS)
        # if the library is still (not cleaned), remove it
        @if [ -f "$(LIBRARY)" ]; then rm $(LIBRARY); fi
        ln $(LOCAL_LIB)~ $(LIBRARY)
        @echo
"--------------------------------------------------------------"

# Ensure that the dependant dats are up to date
dat::
        @echo $(DATSPACING)Checking dependencies for $(MODULE)
\($(INCLUDE_DATS)\)
        @for inc in kluge $(INCLUDE_DATS); do\
                if [ $$inc != kluge ]; then \
                        cd ../$$inc;\
                        if [ ! -f $$inc.uptodate.tmp ]; then \
                                hmake dat DATSPACING=".$(DATSPACING)"; \
                        fi; \
                fi; \
        done;


$(MODULE:%=%.dat): $(RCS) $(INCLUDE_DATS:%=../%.dat)
        if [ -r ../$@ ]; then mv ../$@ ../last/; fi
        rm -f $@
        @echo ND_PATH=$(ND_PATH)
        $(RC) $(RCS)
        cp $(MODULE).dat ..

mtags: $(MOD_OBJS:%.o=%.tags) $(MOD_HDRS:%.h=%.htags)
        @rm -f tags
        @cat $(MOD_OBJS:%.o=%.tags) $(MOD_HDRS:%.h=%.htags) > tags

tags: $(LIB_OBJS:%.o=%.tags) $(MOD_HDRS:%.h=%.htags)
        @rm -f tags
        @cat $(LIB_OBJS:%.o=%.tags) $(MOD_HDRS:%.h=%.htags) > tags

wssb: sbrowsdir $(LIB_OBJS:%.o=%.sb) $(MOD_OBJS:%.o=%.sb)
        @echo done

cflow:: $(LIB_OBJS)
        cflow $(CFLAGS) $(INCL_FLAGS) $(SOURCES:$(MAIN_SOURCE)=) > cflow


$(HEADERS_TO_PUBLISH:%=$(ABACUS_INCL_DIR)/%):   $(HEADERS_TO_PUBLISH:%=%)
                cp ./address@hidden $@


publish:        $(HEADERS_TO_PUBLISH:%=$(ABACUS_INCL_DIR)/%)


sbrowsdir:
        @if [ -d $(TOPDIR)/.sb ]; then exit 0; else set -x; mkdir
$(TOPDIR)/.sb; fi
        @if [ -h .sb ]; then exit 0; else set -x; ln -s $(TOPDIR)/.sb .sb;
fi

clean:
        if [ -d $(SHARED_OBJ_DIR) ]; then rm -fr $(SHARED_OBJ_DIR)/*; fi
        rm -f *.tags *.htags tags TAGS HTAGS
        if [ -f "$(LIBRARY)" ]; then (rm -f $(LIBRARY)); fi
        $(if $(ALSO_CLEAN),-rm -f $(ALSO_CLEAN),)

cleandat:
        rm -f $(MODULE).dat $(MODULE).uptodate.tmp ../$(MODULE).dat

echo:
        @echo
"--------------------------------------------------------------"
        @echo $(MODULE)
        @echo
"--------------------------------------------------------------"

whatmod:
        @echo $(SHARED_OBJ_DIR)/$(MODULE)

reqlibs:
        @if [ "$(ABACUS_LINK_LIBS)x" = "x" ]; then \
                echo $(MODULE); \
        else \
                echo $(ABACUS_LINK_LIBS) $(NEEDLDAP:%=api_ldap); fi

############################################################################
##
# openedit.h
############################################################################
##

$(TOPDIR)/include/openedit.h: $(ND_HEADERS:%=$(ND_INCL_DIR)/%)

############################################################################
##
# SUFFIXES
############################################################################
##

.SUFFIXES: .o .c .C .cpp .cxx .h .H .y .l .tags .htags .sb .idl

# Let the make process work out how to make the chain
%.tab.h %.tab.c: %.y
        $(YACC) $(YFLAGS) -b $* $<

%.cpp: %.l
        $(LEX) $(LFLAGS) $< > $(subst .l,.cpp,$<)

$(SHARED_OBJ_DIR)/%.o: %.c
        $(CC) -c $< -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $(INCL_FLAGS)

$(SHARED_OBJ_DIR)/%.o: %.cpp
        $(CXX) -c $< -o $@ $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CXX_INCL_FLAGS)

$(SHARED_OBJ_DIR)/%.o: %.cc
        $(CXX) -c $< -o $@ $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CXX_INCL_FLAGS)

$(SHARED_OBJ_DIR)/%.o: %.cxx
        $(CXX) -c $< -o $@ $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CXX_INCL_FLAGS)

$(SHARED_OBJ_DIR)/%.o: %.C
        $(CXX) -c $< -o $@ $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(CXX_INCL_FLAGS)

#.c.tags:
$(SHARED_OBJ_DIR)/%.tags: %.c
        etags -C -o $@ $(<:%=`pwd`/%)

#.C.tags:
$(SHARED_OBJ_DIR)/%.tags: %.C
        etags -o $@ $(<:%=`pwd`/%)

#.cxx.tags:
$(SHARED_OBJ_DIR)/%.tags: %.cxx
        etags -o $@ $(<:%=`pwd`/%)

#.cpp.tags:
$(SHARED_OBJ_DIR)/%.tags: %.cpp
        etags -o $@ $(<:%=`pwd`/%)

#.cc.tags:
$(SHARED_OBJ_DIR)/%.tags: %.cc
        etags -o $@ $(<:%=`pwd`/%)

$(SHARED_OBJ_DIR)/%.htags: %.H
        etags -o $@ $(<:%=`pwd`/%)

$(SHARED_OBJ_DIR)/%.htags: %.h
        etags -o $@ $(<:%=`pwd`/%)

.ml.tags:
#       Don't know how to generate tags for ml files.
#       (Not really sure we even want to!)
        touch $@

.y.tags:
        etags -o $@ $(<:%=`pwd`/%)

.l.tags:
        etags -o $@ $(<:%=`pwd`/%)

# idl generates both h and cc.  Need to copy the resulting .h file into
../idl/ as the
# target for this rule is of the form ../idl/<file>.h - if we don't cp the
resulting
# header into ../idl/ then make can't see the header next time it runs -
i.e. it never
# thinks it has finsihed it's work.
%.h %.cc: %.idl
        @echo building IDL target $@, pre-requisite $<
        @echo IDL_HEADERS set to $(IDL_HEADERS)
        @echo SHARED_OBJ_DIR set to $(SHARED_OBJ_DIR)
        $(MICOIDL) $(MICOIDL_OPTS) $<
        @echo LIB_OBJS $(LIB_OBJS)
        cp `basename address@hidden ../idl/

%.cpp: %.ml
        $(ML_PARSER) -C -f $<
        mv $*.mladd.C $*.cpp

%.h: %.ml
        $(ML_PARSER) -h -f $<
        mv $*.mladd.h $*.h

# include all the new dependancy files
-include $(DFILES)


***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorized and regulated by the Financial Services Authority 
 
This e-mail message is confidential and for use by the 
addressee only. If the message is received by anyone other 
than the addressee, please return the message to the sender 
by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The 
Royal Bank of Scotland plc does not accept responsibility for 
changes made to this message after it was sent. 

Whilst all reasonable care has been taken to avoid the 
transmission of viruses, it is the responsibility of the recipient to 
ensure that the onward transmission, opening or use of this 
message and any attachments will not adversely affect its 
systems or data. No responsibility is accepted by The Royal 
Bank of Scotland plc in this regard and the recipient should carry 
out such virus and other checks as it considers appropriate. 
Visit our websites at: 
http://www.rbos.com
http://www.rbsmarkets.com 
********************************************************************************





reply via email to

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