1

My source code is in src directory and my object files go to the AS5 directory.

Here is my make file:

CC = g++
CFLAGS =-c -std=c99 -g -w -Wno-deprecated -D_FILE_OFFSET_BITS=64 -DATOMIC_BUILT_IN -DIB_USE_STD_STRING -Wall -Wno-switch
WORKING_DIR     = $(HOME)/JYOTI
PLATFORM        = AS5

BASICOBJS            = JYOTI.o OnixMDP3InputAdapter.o FixInputAdapter.o SGXInputAdapter.o SGXITCHProcess.o DGCXTBTInputAdapter.o DGCXMulticastInputAdapter.o NSECMDirectGateWay.o Profiler.o MCXXStreamInputAdapter.o MultipleConnectionReceiver.o EClientSocketBase.o EPosixClientSocket.o IBInputAdapter.o IDCInputAdapter.o NSEUdpInputAdapter.o InputAdapter.o BSEInputAdapter.o DGCXInputAdapter.o EmapiTagParser.o MCXInputAdapter.o OutputAdapter.o TBTProcess.o DataStructure.o NSETBTDataStructure.o LogQueue.o ServiceManager.o TCPSender.o PracticalSocket.o PriceMonitor.o Latency.o TCPInputAdapter.o AvgDiff.o MulticastInputAdapter.o MulticastOutputAdapter.o TBTInputAdapter.o LogStandard.o Common.o Event.o Utils.o MultipleIndexOutputAdapter.o DependendLib.o StringSplitter.o

OBJSWITHSYM     =SymExample.o SymFlusher.o SymInputAdapter.o

OBJWITHOADT     =  CFixGateWay.o DMA.o FixClient.o NSECMDirectGateWay.o MStrat2Way.o MStratOpt.o Basket.o IndexBasket.o RevBasket.o NSECDDirectGateWay.o BseGateWay.o Portfolio.o BasePortfolio.o MyPortfolio.o SLOFIX.o SLOFIXNEG.o SpreadBidding.o TwoLIOCSpd.o LatencyCheckPortfolio.o SLOSPR.o SLOSPRNEG.o SLO3WAY.o MStrat.o MulLegSynFut.o MAMR.o NSEFOGateWay.o NSECMGateWay.o SGXGateWay.o OrderAdapter.o OrderAdaptersInterface.o TCPListener.o FixGateWay.o DFixGateWay.o MAMRA.o FConBx.o

OBJMCXOADT      =MCXGateWay.o

OBJS    =$(BASICOBJS)

ifneq ($(AM),64)
        CC      +=-m32
        CFLAGS  += -march=i686
        SYME="::::      To Compile 64 bit binary, Usage: <make AM=64>"
endif


ifneq ($(SE),0)
        SE=1
        SYME+="::::      To Compile without flex, Usage: <make SE=0>"
else
        SE=0
endif

ifeq ($(SE),1)
        OBJS    += $(OBJSWITHSYM)
        CFLAGS  +=-DSYMAVAILABLE
endif

ifeq ($(ML),1)
        CFLAGS  +=-D_MESURE_LATENCY
else
        SYME+=" :::::  To Enable Latency Mesurement, Usage: <make ML=1>"
endif
ifeq ($(OADT),1)
        OBJS    +=$(OBJWITHOADT)
        CFLAGS +=-DISORDADPT
        LIB     += -lssl
else
        SYME+=" :::::  To Enable Order Adapter, Usage: <make OADT=1>"
endif

ifeq ($(MCXOADT),1)
        OBJS    +=$(OBJMCXOADT)
        CFLAGS  +=-DISMCXORDADPT
else
        SYME+=" :::::  To Enable MCX Order Adapter, Usage: <make MCXOADT=1>"
endif

ifeq ($(FIXADT),1)
        CFLAGS +=-DISFIXADPT
else
        SYME+=" :::::  To Enable Fix Adapter, Usage: <make OADT=1 FIXADT=1>"
endif

ifeq ($(COND),1)
        CFLAGS +=-DISCONDITION
else
        SYME+=" :::::  To Enable Condition variable, Usage: <make COND=1>"
endif

LDFLAGS =  -L"../../lib" -L"/usr/local/lib" -Wl,-rpath,../../lib  -Wl,-rpath=/usr/local/lib -Wl,-rpath=./lib -lboost_thread -lboost_system -lboost_atomic -L/usr/local/lib  -Wl,-rpath=/home/sys64/tbb2017_20161128oss/lib/intel64/gcc4.1/ -L/home/sys64/tbb2017_20161128oss/lib/intel64/gcc4.1/ #/usr/lib64/libonload_ext.so

INC      = -I$(FLEXSYS)/lzo-1.07/src
INC     += -I$(FLEXSYS)/lzo-1.07/include
INC     += -I$(FLEXAPP)/flex/apinew/include
INC     += -I$(WORKING_DIR)/inc
INC     += -I$(WORKING_DIR)/inc/IBinc
INC     += -I$(WORKING_DIR)/src
INC     += -I"/usr/include/"
INC     += -I"/usr/include/openssl/"
INC     += -I"../boost_1_55_0/"
INC     += -I"/usr/local/include"
INC     += -I"../tbb2017_20161128oss/include/"


LIB     += $(WORKING_DIR)/lib64/libsymproxy.a
LIB     += $(WORKING_DIR)/lib64/libflexapi.a
LIB     += $(WORKING_DIR)/lib/libACE.so
LIB     += $(WORKING_DIR)/lib/libOnixS.CmeMdp3HandlerCpp.so
LIB     += /usr/local/lib/libz.a
LIB     +=/usr/local/lib/liblzo.a
#LIB     +=$(WORKING_DIR)/lib/libqed.a
#LIB     +=$(WORKING_DIR)/lib/libconfig.a
LIB     += -lm -lstdc++ -z muldefs -lpthread -lrt -ltbb

DEF      = -DFOR_UNIX -DFOR_LINUX
DEF     += -D_REENTRANT
DEF     += -D_POSIX_PTHREAD_SEMANTICS
DEF     += -D__STL_PTHREADS

RM      = rm -rf

all: JYOTI

%.o : %.cpp

        -@if [ ! -d $(PLATFORM) ] ; then mkdir -p $(PLATFORM); fi;
        $(CC) $(CFLAGS) $(INC) $(DEF) $< -o $(PLATFORM)/$@

JYOTI: clean $(OBJS)
        cd $(PLATFORM);$(CC) $(LDFLAGS) $(OBJS) $(LIB) -o $@



clean:
        $(RM) log AS5/*
        @echo $(SYME)
        @echo

closed as unclear what you're asking by dhag, Kusalananda, Toby Speight, GAD3R, mdpc Feb 8 '17 at 1:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    What's the observed and expected behaviour? – Kusalananda Feb 7 '17 at 12:14
  • 1
    When making all (what redirects to JYOTI), you first call clean which then removes the contents of AS5, so all of your objects are deleted and have to be compiled again. And from where should make now your objects are in subdirectory AS5? Youl'd have to tell somwhere! – ridgy Feb 7 '17 at 15:00
  • how can i specify that the object is in AS5 directory – JyotiSankar Nayak Feb 8 '17 at 3:04
  • PLATFORM is the object directory – JyotiSankar Nayak Feb 8 '17 at 3:05
  • if i change some thing in a file in src folder all the objects are getting rebuild....i want only that file should rebuild.... also in JYOTI folder where the make file resides i have all the .cpp files sym link to src folder files – JyotiSankar Nayak Feb 8 '17 at 3:49
0

First, you have to remove the clean dependency from your JYOTI target. Otherwise, everything is always built from scratch.

Next, you need to include your object file directory in the pattern rule, e.g.:

$(PLATFORM)/%.o: %.cpp
        $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<

The simplest thing is to make sure that the $(PLATFORM) directory itself is always there and not deleted by the clean target.

For this to work you also need to specify the $(PLATFORM) directory in your object list, e.g.:

OBJS = $(BASICOBJS:%=$(PLATFORM)/%)

Not the answer you're looking for? Browse other questions tagged or ask your own question.