2011-05-02 102 views
0

我試圖調試與生成文件我正在處理的問題..什麼是令人困惑的是,目標工作時,我從命令行運行它,但不工作在我的生成文件..在Linux上發佈問題

這裏是生成文件:

DDS_OUT_DIR = $(PWD) 

IDL_DIR=/adapts/ad/irad-c2/idl_dds 
IDL_TYPES=common.idl 
GENERATED_SOURCES = $(IDL_TYPES:%.idl=%Support.cxx) $(IDL_TYPES:%.idl=%Plugin.cxx) $(IDL_TYPES:%.idl=%.cxx) 
GENERATED_HEADERS = $(IDL_TYPES:%.idl=%Support.h) $(IDL_TYPES:%.idl=%Plugin.h) $(IDL_TYPES:%.idl=%.h) 

OBJS_DIR  = obj.$(CPUTYPE) 

GENERATED_OBJS = $(GENERATED_SOURCES:%.cxx=$(OBJS_DIR)/%.o) 

LIBDIR = ../../lib.$(CPUTYPE) 
BINDIR = ../../../../bin.$(CPUTYPE) 
CC  = $(C_COMPILER) 
CXX  = $(CPP_COMPILER) 
OS  = $(shell uname) 
DDSCOMMON = ../../Common/src 

CFLAGS = -m32 -g 
CXXFLAGS = -m32 -g 
LDFLAGS = -m32 -static-libgcc 
SYSLIBS = -ldl -lnsl -lpthread -lm -lc 


DEFINES_ARCH_SPECIFIC = -DRTI_UNIX 

DEFINES = $(DEFINES_ARCH_SPECIFIC) $(cxx_DEFINES_ARCH_SPECIFIC) 

INCLUDES = -I. -I$(NDDSHOME)/include -I$(NDDSHOME)/include/ndds 
INCLUDES += -I$(DDSCOMMON) 

LIBS = -L$(NDDSLIBDIR) -L$(LIBDIR) -lrt \ 
     -lnddscppz -lnddscz -lnddscorez $(SYSLIBS) $(OS_SPECIFIC_LIBS) 

COMMONLIBSRC = $(DDSCOMMON)/dds_common.cxx 
COMMONLIBOBJS = $(DDSCOMMON)/obj.$(CPUTYPE)/%.o 

$(shell mkdir -p $(OBJS_DIR) $(DDSCOMMON)/obj.$(CPUTYPE)) 

default: ${IDL_TYPES} $(GENERATED_OBJS) 

$(OBJS_DIR)/%.o : %.cxx %.h $(DDSCOMMON)/dds_common.h 
    $(CPP_COMPILER) -o [email protected] $(DEFINES) $(INCLUDES) $(CXXFLAGS) -c $< 

%.idl: 
    @echo "Generating CXX from [email protected] ..." $(GENERATED_OBJS); \ 
    $(NDDSHOME)/scripts/rtiddsgen ${IDL_DIR}/[email protected] -d $(DDS_OUT_DIR) -I ${IDL_DIR} -replace -language C++; 

,如果我只是這樣做:

make 

的%的.idl目標被稱爲細,當完成我得到這個輸出:

Generating CXX from common.idl ... obj.Linux-i686/commonSupport.o obj.Linux-i686/commonPlugin.o obj.Linux-i686/common.o 
Running rtiddsgen version 4.5d, please wait ... 
Done 
make: *** No rule to make target `obj.Linux-i686/commonSupport.o', needed by `default'. Stop. 

但是當我重新運行它,一切都編譯,所以它工作正常...

這是爲什麼不一步到位的工作?

回答

2

commonSupport.cxx似乎取決於common.idl。告訴make

commonSupport.cxx: common.idl 
    @echo "Generating CXX from [email protected] ..." $(GENERATED_OBJS); \ 
    $(NDDSHOME)/scripts/rtiddsgen ${IDL_DIR}/[email protected] -d $(DDS_OUT_DIR) -I ${IDL_DIR} -replace -language C++; 

或者,以確保所有的依賴關係是正確的:

$(GENERATED_SOURCES): common.idl 
    .... steps to make GENERATED_SOURCES from common.idl