在 Linux 上发出问题

发布于 2024-11-04 06:22:36 字数 2024 浏览 5 评论 0原文

我正在尝试调试我正在处理的 makefile 的问题。令人困惑的是,当我从命令行运行目标时,目标可以工作,但在我的 makefile 中不起作用。

这是 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) $(DDSCOMMON)/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++;

如果我只需这样做:

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.

但是当我重新运行它并且一切都编译时,所以它工作正常......

为什么这一步不起作用?

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) $(DDSCOMMON)/obj.$(CPUTYPE))

default:    ${IDL_TYPES} $(GENERATED_OBJS)

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青巷忧颜 2024-11-11 06:22:36

commonSupport.cxx 似乎依赖于 common.idl。将此告诉 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++;

或者,确保所有依赖项都正确:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文