开发者

make issue on Linux

I'm trying to debug an issue with a makefile I am working on.. What is confusing is that the target works when I run it from the command line, but does not work in my makefile..

Here is the makefile:

DDS_OUT_DIR = $(PWD)

IDL_DIR=/opt/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) $(DDS开发者_开发技巧COMMON)/obj.$(CPUTYPE))

default:    ${IDL_TYPES} $(GENERATED_OBJS)

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

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

if I just do this:

make

The %.idl target is called fine, when that finishes I get this output:

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.

But then when I re-run it and everything compiles, so it works fine...

Why is this not working in one step?


commonSupport.cxx seems to depend on common.idl. Tell this to make.

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

Or, to ensure all dependencies are right:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜