简体   繁体   中英

omniorb makefile server error

Im doing some adition simple program on omniorb 4.2 but the makefile for server gives me an error. Heres my makeserver file code:

CC            = gcc
CPPFLAGS      = -g -c
LDFLAGS       = -g
OMNI_HOME     = /opt/omniorb
OMNI_INCLUDES = -I$(OMNI_HOME)/include
OMNI_LIB_DIR  = $(OMNI_HOME)/lib
OMNIIDL       = $(OMNI_HOME)/bin/omniidl
INCLUDES      = $(OMNI_INCLUDES)
LIBS          = -lomniORB4 -lomnithread -lomniDynamic4
OBJECTS       = Data.o CServiceA.o Server.o

all Server: $(OBJECTS)
    $(CC) $(LDFLAGS) -o Server -L$(OMNI_HOME)/lib $(OBJECTS)         $(LIBPATH) $(LIBS)

Data.o: DataSK.cc Data.hh
    $(CC) $(CPPFLAGS) $(INCLUDES) DataSK.cc

Server.o: Server.cpp Data.hh
    $(CC) $(CPPFLAGS) $(INCLUDES) Server.cpp

CServiceA.o: CServiceA.cpp CServiceA.h Data.hh
    $(CC) $(CPPFLAGS) $(INCLUDES) CServiceA.cpp

DataSK.cc: Data.idl
    $(OMNI_HOME)/bin/omniidl -bcxx Data.idl

clean clean_all:
    rm -fr *.o
    rm -fr core
    rm -fr *.hh
    rm -fr *SK.cc
    rm -fr Server

And this is the error it gives me:

$ make -f MakeServer 
gcc -g -c -I/opt/omniorb/include DataSK.cc
gcc -g -c -I/opt/omniorb/include CServiceA.cpp
gcc -g -c -I/opt/omniorb/include Server.cpp
gcc -g -o Server -L/opt/omniorb/lib Data.o CServiceA.o Server.o  -        lomniORB4 -lomnithread -lomniDynamic4
gcc: error: Data.o: file or directory doesn't exist
MakeServer:13: fail in instructions for objective 'all'
make: *** [all] Error 1

The following rule is broken

Data.o: DataSK.cc Data.hh
    $(CC) $(CPPFLAGS) $(INCLUDES) DataSK.cc

You've told make that this rule creates Data.o , but it actually creates DataSK.o , so change the rule and OBJECTS

OBJECTS       = DataSK.o CServiceA.o Server.o

DataSK.o: DataSK.cc DataSK.hh
    $(CC) $(CPPFLAGS) $(INCLUDES) DataSK.cc

As as side note, a lot of your makefile is unnecessary, the built-in rules and gcc dependency generation can cover most of the work:

omni_home := /opt/omniorb

CPPFLAGS := -I$(omni_home)/include -MMD -MP
CXXFLAGS := -g
LDFLAGS  := -L$(omni_home)/lib
LDLIBS   := -lomniORB4 -lomnithread -lomniDynamic4

objs := DataSK.o CServiceA.o Server.o
deps := $(objs:.o=.d)

.PHONY: all clean

all: Server

Server: CC := g++
Server: $(objs)

DataSK.o: DataSK.cc
DataSK.cc DataSK.hh: Data.idl
    $(omni_home)/bin/omniidl -bcxx $<

clean: ; $(RM) $(objs) $(deps) DataSK.cc DataSK.hh Server

-include $(deps)

(The above may not work correctly as I haven't tested it.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM