I have created a .so file using the bazel command:
bazel build -c opt --copt="-fPIC" :tensorFlow.so
Following is my makefile:
CFLAGS = -c -g -W -O3 -Wall -Wshadow \
-Wno-long-long -Wpointer-arith -D_REENTRANT \
-D_POSIX_PTHREAD_SEMANTICS -DLINUX2 \
-I ./acl/lib_acl_cpp/include
BASE_PATH=./acl
LDFLAGS = -L$(BASE_PATH)/lib_acl_cpp/lib -l_acl_cpp \
-L$(BASE_PATH)/lib_protocol/lib -l_protocol \
-L$(BASE_PATH)/lib_acl/lib -l_acl \
-lpthread -lprotobuf -ljsoncpp
redisConnection: redisConnection.o
g++ ./redisConnection.o ./UnifiedMetric.pb.o ./getMapFromFeatureDistribution.o ./featureStats.o $(LDFLAGS) -o redisConnection
redisConnection.o: redisConnection.cpp
g++ $(CFLAGS) redisConnection.cpp -o redisConnection.o
I went through various links but couldn't find any way. How do I include the .so file file created in the makefile and what other things have to be added?
Add the paths to header files in INCLUDEPATH.
This might be the exact replica for your problem.
Related
Vulkan SDK hosts a C++ header-only C-wrapped library. Problem is, it is really a heavy header, so it wastes a lot of compilation time.
So I looked into using a make file for my Vulkan project, which I never did before. I decided to programatically generate all the dependencies. Probably I messed up this part as well, making it too difficult to understand.
It does kind of work, probably there is an easier way to do the same thing(s).
Here comes the part I can't really work out with:
I generated all the .o (object) files for my project along with the .gch (precompiled headers)
Then I did the same for the vulkan.hpp and the glfw3.h. (Remember, that's where most of my compilation time is going into).
... And here is where I have several problems about this procedure:
Can I, somehow, force the g++ compiler to use .gch files? The combination of -I, -include doesn't seem to work at all and I cannot even debug what is going on with -H/-M/-MM because i have no output whatsoever from this commands.
I am using MSYS2 MINGW_64 release, if it makes a difference.
I'd be glad if someone could give me a tip or two about make files and, in particular, if there is something I completely misunderstood about the compilation process.
# Methods
define uniq =
$(eval seen :=)
$(foreach _,$1,$(if $(filter $_,${seen}),,$(eval seen += $_)))
${seen}
endef
# Compilation flags
_COMPILER := g++ -std=c++17
_FLAGS_WARNING := -Wall -Wextra -Wshadow
_FLAGS_COMPILE := -g -O0
_FLAGS_VULKAN := -lglfw3 -lvulkan
# Custom Flags
_FLAGS_DEBUG := -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0
# Output
_OUTPUT_NAME := test
# Directories
_TMP_DIR := _tmp
_O_DIR := ${_TMP_DIR}\.o
_GCH_DIR := ${_TMP_DIR}\.gch
_SOURCE_DIR := src
_BUILD_DIR := build
_DEBUG_DIR := ${_BUILD_DIR}\debug
_RELEASE_DIR := ${_BUILD_DIR}\release
# Files
_VULKAN_HPP := C:/VulkanSDK/1.2.148.1/Include/vulkan/vulkan.hpp
_GLFW_HPP := C:/msys64/mingw64/include/GLFW/glfw3.h
# Grouping Files
# .cpp & .o
_CPP_LIST := ${wildcard ${_SOURCE_DIR}/*.cpp ${_SOURCE_DIR}/*/*.cpp}
_CPP_LIST_NAME := ${notdir ${_CPP_LIST}}
_O_LIST := ${addprefix ${_O_DIR}/, ${patsubst %.cpp, %.o, ${_CPP_LIST_NAME}}}
# .hpp & .gch
_HPP_LIST := ${wildcard ${_SOURCE_DIR}/*.hpp ${_SOURCE_DIR}/*/*.hpp} ${_VULKAN_HPP}
_HPP_LIST_NAME := ${notdir ${_HPP_LIST}}
_GCH_LIST := ${addprefix ${_GCH_DIR}/, ${patsubst %.hpp, %.gch, ${_HPP_LIST_NAME}}}
# .h & .gch
_H_LIST := ${_GLFW_HPP}
_H_LIST_NAME := ${notdir ${_H_LIST}}
_C_GCH_LIST := ${addprefix ${_GCH_DIR}/, ${patsubst %.h, %.gch, ${_H_LIST_NAME}}}
_COMPILATION_BUNDLE_CPP = ${_FLAGS_WARNING} ${_FLAGS_COMPILE} ${_FLAGS_VULKAN} ${_FLAGS_DEBUG} -I ${_GCH_DIR}
_COMPILATION_BUNDLE_HPP = ${_FLAGS_COMPILE} -x c++-header ${_FLAGS_DEBUG} -I ${_GCH_DIR}
${_DEBUG_DIR}/${_OUTPUT_NAME}: ${_GCH_LIST} ${_C_GCH_LIST} ${_O_LIST}
${_COMPILER} ${_COMPILATION_BUNDLE_CPP} ${_O_LIST} ${addprefix -include , ${_GCH_LIST}} ${addprefix -include , ${_C_GCH_LIST}} -o $#
vpath %.cpp $(call uniq, ${dir ${_CPP_LIST}})
${_O_DIR}/%.o: %.cpp
${_COMPILER} ${_COMPILATION_BUNDLE_CPP} -c $< -o $#
vpath %.hpp $(call uniq, ${dir ${_HPP_LIST}})
${_GCH_DIR}/%.gch: %.hpp
${_COMPILER} ${_COMPILATION_BUNDLE_HPP} $< -o $#
vpath %.h $(call uniq, ${dir ${_H_LIST}})
${_GCH_DIR}/%.gch: %.h
${_COMPILER} ${_COMPILATION_BUNDLE_HPP} $< -o $#
The execution on a clean project (thus easier to follow along):
g++ -std=c++17 -g -O0 -x c++-header -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch src/helper/helper.hpp -o _tmp\.gch/helper.gch
g++ -std=c++17 -g -O0 -x c++-header -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch src/renderer/renderer.hpp -o _tmp\.gch/renderer.gch
g++ -std=c++17 -g -O0 -x c++-header -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch C:/VulkanSDK/1.2.148.1/Include/vulkan/vulkan.hpp -o _tmp\.gch/vulkan.gch
g++ -std=c++17 -g -O0 -x c++-header -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch C:/msys64/mingw64/include/GLFW/glfw3.h -o _tmp\.gch/glfw3.gch
g++ -std=c++17 -Wall -Wextra -Wshadow -g -O0 -lglfw3 -lvulkan -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch -c src/main.cpp -o _tmp\.o/main.o
g++ -std=c++17 -Wall -Wextra -Wshadow -g -O0 -lglfw3 -lvulkan -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch -c src/helper/helper.cpp -o _tmp\.o/helper.o
g++ -std=c++17 -Wall -Wextra -Wshadow -g -O0 -lglfw3 -lvulkan -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch -c src/renderer/renderer.cpp -o _tmp\.o/renderer.o
g++ -std=c++17 -Wall -Wextra -Wshadow -g -O0 -lglfw3 -lvulkan -D _DEBUG -D _DEBUG_SEVERITY=0 -D _DEBUG_TYPE=0 -I _tmp\.gch _tmp\.o/main.o _tmp\.o/helper.o _tmp\.o/renderer.o -include _tmp\.gch/helper.gch -include _tmp\.gch/renderer.gch -include _tmp\.gch/vulkan.gch -include _tmp\.gch/glfw3.gch -o build\debug/test
Using pre-compiled headers is actually fairly straight forward. It might be easiest to break it down into manual steps. You can even retro fit to an existing project pretty easily. The steps could be:
Create a PCH file including a bunch of std libs or other headers you want to pre-compile. Note: Compile your PCH with the same flags as your other c++ code is compiled with, otherwise it may not work.
Add the include flags for the PCH in your makefile... and that is basically it.
So lets try a practical example:
Start with a source file, src1.cpp and compile it: g++ -I. <other flags> src1.cpp -o src1.o
Create your pch file, call it pch.hpp (or whatever)
Compile your PCH file: g++ -I. <other flags> pch.hpp (same flags as the previous compile). This generates the pch.hpp.gch file.
Now you can use your PCH file in your original compile line: g++ -I. <other flags> src1.cpp -o src1.o -Winvalid-pch -include pch.hpp
Couple of things to note:
If you use -Winvalid-pch warning flag this usually gives you enough information to figure out why the pch is not used (like its missing, bad path, bad options etc...).
Use -include pch.hpp not -include pch.hpp.gch since g++ will figure that out. You can see that retro fitting it is easy - since you just append the include flags to your compiler lines.
If your .gch file is not generated then the code should still compile using the pch.hpp header directly...
Makefile:
CFLAGS = -c -g -W -O3 -Wall -Werror -Wshadow \
-Wno-long-long -Wpointer-arith -D_REENTRANT \
-D_POSIX_PTHREAD_SEMANTICS -DLINUX2 \
-I ./acl/lib_acl_cpp/include
BASE_PATH=./acl
LDFLAGS = -L$(BASE_PATH)/lib_acl_cpp/lib -l_acl_cpp \
-L$(BASE_PATH)/lib_protocol/lib -l_protocol \
-L$(BASE_PATH)/lib_acl/lib -l_acl \
-lpthread
redisConnection: redisConnection.o
g++ -o $# $^ $(LDFLAGS)
redisConnection.o: redisConnection.cpp
g++ $(CFLAGS) redisConnection.cpp -o redisConnection.o
And I have generated the nrtprofile.pb.cc and nrtprofile.pb.h with the help of protoc command.
What changes must be made in the makefile because I am getting the following error in the class redisConnection.cpp when I am using the functions:
undefined reference to `google::protobuf::MessageLite::ParseFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
I have included nrtprofile.pb.h in the redisConnection.cpp
As here there are two things redisConnection and redisConnection.o, I am getting confused where should I write nrtprofile.pb.cc.
Add -lprotobuf to the LDFLAGS variable.
However, this assumes that the protobuf library is installed in a location where the linker finds it (e.g. /usr/lib). If you have it somewhere else, you can provide the additional search path by setting the LD_LIBRARY_PATH variable like this: export LD_LIBRARY_PATH=/my/special/path.
You can find the needed linker and compiler flags here. Basically, compiler and linker-related, you need to do something like c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf
I am working on a project where I am using boost::interprocess to create shared memory, when I compile the code in isolation and create a client it works fine:
Makefile for building .a :
$(info ETLIB_ROOT=$(ETLIB_ROOT) )
include $(ETLIB_ROOT)/.gmake_prologue
$(info BOOST_ROOT=$(BOOST_ROOT))
$(info BOOST_INC=$(BOOST_INC))
OBJDIR=obj
SRC=src
INCLUDE=include
LIB=lib
$(LIB)/libmetricsStore.a: $(OBJDIR)/MetricsStore.o
ar rcs $# $^
$(OBJDIR)/MetricsStore.o: $(SRC)/MetricsStore.cpp
g++ -g -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I$(INCLUDE) -c $(SRC)/MetricsStore.cpp -o $(OBJDIR)/MetricsStore.o
include $(ETLIB_ROOT)/.gmake_epilogue
Makefile for the test client:
include .gmake_prologue
OBJDIR=.
SRC=.
INCLUDE=../metricsstore/include
$(info BOOST_LIB=$(BOOST_LIB))
$(info BOOST_INC=$(BOOST_INC))
client: $(OBJDIR)/client.o
g++ $(OBJDIR)/client.o -o client -L$(BOOST_LIB) -lboost_filesystem-gcc44 -lboost_filesystem-gcc44-mt -L/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/boost_shared_mem/metricsstore/lib -lmetricsStore -lrt
$(OBJDIR)/client.o: $(SRC)/client.cpp
g++ -I$(BOOST_INC) -I $(INCLUDE) -c $(SRC)/client.cpp -o $(OBJDIR)/client.o
include .gmake_epilogue
The above two work fine and the test client gets built properly.
The gmake -n output of the test client is the following:
LIBDIR=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB
LIBDIR in prolouge=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB
BOOST_ROOT in prolouge=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53
BOOST_INC in prolouge=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include
CCFLAGS in prolouge=-g -mfpmath=sse -msse3 -I. -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include
BOOST_LIB=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/lib
BOOST_INC=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include
g++ -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I ../metricsstore/include -c ./client.cpp -o ./client.o
g++ ./client.o -o client -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/lib -lboost_filesystem-gcc44 -lboost_filesystem-gcc44-mt -L/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/boost_shared_mem/metricsstore/lib -lmetricsStore -lrt
However, when I try the same options with another existing project I get errors like following which I am not able to understand and fix:
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/os_file_functions.hpp: In function 'bool boost::interprocess::ipcdetail::open_or_create_directory(const char*)':
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/os_file_functions.hpp:681: error: expected unqualified-id before 'do'
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/os_file_functions.hpp:682: error: 'info' was not declared in this scope
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/tmp_dir_helpers.hpp: In function 'void boost::interprocess::ipcdetail::create_tmp_and_clean_old(std::string&)':
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/tmp_dir_helpers.hpp:135: error: expected unqualified-id before 'do'
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/tmp_dir_helpers.hpp:136: error: 'info' was not declared in this scope
I have read the following link and tried different things but to no avail:
http://www.drdobbs.com/tools/debugging-makefiles/197003338
The Makefile of the new project looks like the following:
include .gmake_prologue
INCS += \
-I$(EXTLIB_ROOT)/one_market_data/one_tick/linux/include \
-I$(EXTLIB_ROOT)/Linux-glibc-2.3-x86_64/include \
-I$(EXTLIB_ROOT)/pico \
-I$(EXTLIB_ROOT)/proto \
-I$(EXTLIB_ROOT)/google \
-I$(BOOST_INC) \
-I$(ETLIB_ROOT)/boost_shared_mem/metricsstore/include \
$(JMS_INCS)
ETLIBS = \
$(ETLIB_ROOT)/Util/libUtil.a \
$(ETLIB_ROOT)/FIXLib/src/libFIXLib.a
LIBS = \
$(ETLIBS) \
$(JMS_LIBS_DYNAMIC) \
-L$(EXTLIB_ROOT)/one_market_data/one_tick/linux/lib -lonetick \
-L$(EXTLIB_ROOT)/proto/lib -lprotobuf \
-L$(EXTLIB_ROOT)/poco-1.4.3p1/lib/Linux/x86_64 -lPocoFoundation -lPocoNet \
-L$(BOOST_LIB) -lboost_filesystem-gcc44 \
-L$(BOOST_LIB) -lboost_filesystem-gcc44-mt \
-L$(ETLIB_ROOT)/boost_shared_mem/metricsstore/lib -lmetricsStore \
-dynamic -lnsl -lm -ldl -lpthread -lrt
OBJS1 = \
ConfigReader.o \
proto/common/pricedistribution.pb.o \
proto/fxecn/fxvenue.pb.o \
AppBase.o \
SocketFeedPublisher.o
Here is the gmake -n output of the above Makefile:
BOOST_ROOT in prolouge=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53
BOOST_INC in prolouge=/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include
CCFLAGS in prolouge=-g -mfpmath=sse -msse3 -I. -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include
/usr/bin/c++ -pthread -fexceptions -DOS_LINUX -D_GNU_SOURCE -D_THREAD_SAFE -DBYTE_ORDER_LSB -DINBUILT_NEW -DSFC_REPLACES_TIBAPI -g -mfpmath=sse -msse3 -I. -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/one_market_data/one_tick/linux/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/Linux-glibc-2.3-x86_64/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/pico -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/proto -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/google -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/boost_shared_mem/metricsstore/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/rdgLib -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ems_cpp_wrapper/lincsg2-gcc3.0/2_2_0/EMS_CPP_WRAPPER/ -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/EMS_CLIENT_API/lincsg2-gcc3.0/4_4_1/EMS_CLIENT_API/ -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ems_cpp_wrapper/lincsg2-gcc3.0/2_2_0/EMS_CPP_WRAPPER//../Source/code -DJMS_IO -DRDG_BUILD -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ATHENA_EMS/LCD -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ATHENA_EMS/e4jms/Linux/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/JMSTools -c -o SocketFeedPublisher.o SocketFeedPublisher.cpp
/usr/bin/c++ -pthread -fexceptions -DOS_LINUX -D_GNU_SOURCE -D_THREAD_SAFE -DBYTE_ORDER_LSB -DINBUILT_NEW -DSFC_REPLACES_TIBAPI -g -g -mfpmath=sse -msse3 -I. -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/one_market_data/one_tick/linux/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/Linux-glibc-2.3-x86_64/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/pico -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/proto -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/google -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/boost_shared_mem/metricsstore/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/rdgLib -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ems_cpp_wrapper/lincsg2-gcc3.0/2_2_0/EMS_CPP_WRAPPER/ -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/EMS_CLIENT_API/lincsg2-gcc3.0/4_4_1/EMS_CLIENT_API/ -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ems_cpp_wrapper/lincsg2-gcc3.0/2_2_0/EMS_CPP_WRAPPER//../Source/code -DJMS_IO -DRDG_BUILD -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ATHENA_EMS/LCD -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ATHENA_EMS/e4jms/Linux/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/JMSTools -o SocketFeedPublisher ConfigReader.o AppBase.o SocketFeedPublisher.o /app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/Util/libUtil.a /app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/FIXLib/src/libFIXLib.a -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/EMS_CLIENT_API/lincsg2-gcc3.0/4_4_1/lib/64 -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/EMS_CLIENT_API/lincsg2-gcc3.0/4_4_1/lib -ltibems64 -lssl -lcrypto -lz -lxml2 -ltibjms64 -ltibemslookup64 -lldap -llber -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ems_cpp_wrapper/lincsg2-gcc3.0/2_2_0/lib/ -lemscppwrapper64_2.2 -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/one_market_data/one_tick/linux/lib -lonetick -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/proto/lib -lprotobuf -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/poco-1.4.3p1/lib/Linux/x86_64 -lPocoFoundation -lPocoNet -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/lib -lboost_filesystem-gcc44 -L/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/lib -lboost_filesystem-gcc44-mt -L/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/boost_shared_mem/metricsstore/lib -lmetricsStore -dynamic -lnsl -lm -ldl -lpthread -lrt
Linux machine details:
Linux usl20037465 2.6.18-308.8.1.el5 #1 SMP Fri May 4 16:43:02 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
Boost version used 1.53
I have tried all that I could, but could not solve the problem can someone please help me understand how would I debug this.
EDIT
Block that throws the error:
/usr/bin/c++ -pthread -fexceptions -DOS_LINUX -D_GNU_SOURCE -D_THREAD_SAFE -DBYTE_ORDER_LSB -DINBUILT_NEW -DSFC_REPLACES_TIBAPI -g -mfpmath=sse -msse3 -I. -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/one_market_data/one_tick/linux/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/Linux-glibc-2.3-x86_64/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/pico -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/proto -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/google -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/boost_shared_mem/metricsstore/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/rdgLib -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ems_cpp_wrapper/lincsg2-gcc3.0/2_2_0/EMS_CPP_WRAPPER/ -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/EMS_CLIENT_API/lincsg2-gcc3.0/4_4_1/EMS_CLIENT_API/ -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ems_cpp_wrapper/lincsg2-gcc3.0/2_2_0/EMS_CPP_WRAPPER//../Source/code -DJMS_IO -DRDG_BUILD -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ATHENA_EMS/LCD -I/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/ATHENA_EMS/e4jms/Linux/include -I/app/th/pkgs/omd/rates/development.deb/3.9.7/ETLIB/JMSTools -c -o SocketFeedPublisher.o SocketFeedPublisher.cpp
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/os_file_functions.hpp: In function 'bool boost::interprocess::ipcdetail::open_or_create_directory(const char*)':
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/os_file_functions.hpp:681: error: expected unqualified-id before 'do'
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/os_file_functions.hpp:682: error: 'info' was not declared in this scope
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/tmp_dir_helpers.hpp: In function 'void boost::interprocess::ipcdetail::create_tmp_and_clean_old(std::string&)':
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/tmp_dir_helpers.hpp:135: error: expected unqualified-id before 'do'
/app/th/pkgs/omd/rates/development.deb/3.9.7/EXTLIB/boost_1_53/include/boost/interprocess/detail/tmp_dir_helpers.hpp:136: error: 'info' was not declared in this scope
gmake: *** [SocketFeedPublisher.o] Error 1
Thanks and Regards,
-Deb
I have several very long compilation lines, and I want to make them a little more automatized and easier to use, by creating a script. I have found that makefile should be good for this purpose, however I am struggling with the file format.
My compilation line looks something like this:
g++ -std=c++11 -O3 -DNDEBUG \
-I /Users/whizzil/Desktop/proj/include \
-L /Users/whizzil/Desktop/proj/lib \
main.cpp \
-o program \
-lsdsl -ldivsufsort -ldivsufsort64 -Wno-inconsistent-missing-override
So I have several compiler flags, then include and lib parts, then linker options, and then ignore warnings flag.
I tried to write a makefile like this:
# what compiler to use
CC=g++
# options to the compiler
CFLAGS=-std=c++11 -03 -DNDEBUG
# include header files
INCLUDE=-I /Users/whizzil/Desktop/proj/include
# source lib files
LIB=-L /Users/whizzil/Desktop/proj/lib
# sources
SOURCES=main.cpp
#executable
EXECUTABLE=main
But I am not sure how to proceed. Could anyone help me out with the example makefile for this compile line, so I understand the concept?
Start with something simple and straightforward that works:
program:
g++ -std=c++11 -O3 -DNDEBUG \
-I /Users/whizzil/Desktop/proj/include \
-L /Users/whizzil/Desktop/proj/lib \
main.cpp \
-o program \
-lsdsl -ldivsufsort -ldivsufsort64 -Wno-inconsistent-missing-override
Then introduce a variable or two:
# what compiler to use
CC=g++
# options to the compiler
CFLAGS=-std=c++11 -03 -DNDEBUG
program:
$(CC) $(CFLAGS) \
-I /Users/whizzil/Desktop/proj/include \
-L /Users/whizzil/Desktop/proj/lib \
main.cpp \
-o program \
-lsdsl -ldivsufsort -ldivsufsort64 -Wno-inconsistent-missing-override
Then a few more:
# what compiler to use
CC=g++
# options to the compiler
CFLAGS=-std=c++11 -03 -DNDEBUG
# include header files
INCLUDE=-I /Users/whizzil/Desktop/proj/include
# source lib files
LIB=-L /Users/whizzil/Desktop/proj/lib
program:
$(CC) $(CFLAGS) $(INCLUDE) $(LIB) \
main.cpp \
-o program \
-lsdsl -ldivsufsort -ldivsufsort64 -Wno-inconsistent-missing-override
The variable LIB actually refers to a directory, so let's rename it LIBDIR and introduce LIBS:
# what compiler to use
CC=g++
# options to the compiler
CFLAGS=-std=c++11 -03 -DNDEBUG
# include header files
INCLUDE=-I /Users/whizzil/Desktop/proj/include
# source lib files
LIBDIR=-L /Users/whizzil/Desktop/proj/lib
LIBS = -lsdsl -ldivsufsort -ldivsufsort64
program:
$(CC) $(CFLAGS) $(INCLUDE) $(LIBDIR) main.cpp \
-o program $(LIBS) -Wno-inconsistent-missing-override
Further refinements are possible, once you have that much working.
I have did some reading on "Merging Makefiles", one suggest I should leave the two Makefiles separate in different folders [1]. For me this look counter intuitive, because I have the following situation:
I have 3 source files (main.cpp flexibility.cpp constraints.cpp) one of them (flexibility.cpp) is making use of the COIN-OR Linear Programming library (Clp) When installing this library on my computer it makes sample Makefiles, which I have adjust the Makefile and it currently makes a good working binary.
# Copyright (C) 2006 International Business Machines and others.
# All Rights Reserved.
# This file is distributed under the Eclipse Public License.
# $Id: Makefile.in 726 2006-04-17 04:16:00Z andreasw $
##########################################################################
# You can modify this example makefile to fit for your own program. #
# Usually, you only need to change the five CHANGEME entries below. #
##########################################################################
# To compile other examples, either changed the following line, or
# add the argument DRIVER=problem_name to make
DRIVER = main
# CHANGEME: This should be the name of your executable
EXE = clp
# CHANGEME: Here is the name of all object files corresponding to the source
# code that you wrote in order to define the problem statement
OBJS = $(DRIVER).o constraints.o flexibility.o
# CHANGEME: Additional libraries
ADDLIBS =
# CHANGEME: Additional flags for compilation (e.g., include flags)
ADDINCFLAGS =
# CHANGEME: Directory to the sources for the (example) problem definition
# files
SRCDIR = .
##########################################################################
# Usually, you don't have to change anything below. Note that if you #
# change certain compiler options, you might have to recompile the #
# COIN package. #
##########################################################################
COIN_HAS_PKGCONFIG = TRUE
COIN_CXX_IS_CL = #TRUE
COIN_HAS_SAMPLE = TRUE
COIN_HAS_NETLIB = #TRUE
# C++ Compiler command
CXX = g++
# C++ Compiler options
CXXFLAGS = -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD
# additional C++ Compiler options for linking
CXXLINKFLAGS = -Wl,--rpath -Wl,/home/martijn/Downloads/COIN/coin-Clp/lib
# C Compiler command
CC = gcc
# C Compiler options
CFLAGS = -O3 -pipe -DNDEBUG -pedantic-errors -Wimplicit -Wparentheses -Wsequence-point -Wreturn-type -Wcast-qual -Wall -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD
# Sample data directory
ifeq ($(COIN_HAS_SAMPLE), TRUE)
ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
CXXFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\"
CFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\"
else
CXXFLAGS += -DSAMPLEDIR=\"\"
CFLAGS += -DSAMPLEDIR=\"\"
endif
endif
# Netlib data directory
ifeq ($(COIN_HAS_NETLIB), TRUE)
ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
CXXFLAGS += -DNETLIBDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatanetlib`\"
CFLAGS += -DNETLIBDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatanetlib`\"
else
CXXFLAGS += -DNETLIBDIR=\"\"
CFLAGS += -DNETLIBDIR=\"\"
endif
endif
# Include directories (we use the CYGPATH_W variables to allow compilation with Windows compilers)
ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
INCL = `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --cflags clp`
else
INCL =
endif
INCL += $(ADDINCFLAGS)
# Linker flags
ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
LIBS = `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --libs clp`
else
ifeq ($(COIN_CXX_IS_CL), TRUE)
LIBS = -link -libpath:`$(CYGPATH_W) /home/martijn/Downloads/COIN/coin-Clp/lib` libClp.lib
else
LIBS = -L/home/martijn/Downloads/COIN/coin-Clp/lib -lClp
endif
endif
# The following is necessary under cygwin, if native compilers are used
CYGPATH_W = echo
# Here we list all possible generated objects or executables to delete them
CLEANFILES = clp \
main.o \
flexibility.o \
constraints.o \
all: $(EXE)
.SUFFIXES: .cpp .c .o .obj
$(EXE): $(OBJS)
bla=;\
for file in $(OBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \
$(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $# $$bla $(LIBS) $(ADDLIBS)
clean:
rm -rf $(CLEANFILES)
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCL) -c -o $# `test -f '$<' || echo '$(SRCDIR)/'`$<
.cpp.obj:
$(CXX) $(CXXFLAGS) $(INCL) -c -o $# `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`
.c.o:
$(CC) $(CFLAGS) $(INCL) -c -o $# `test -f '$<' || echo '$(SRCDIR)/'`$<
.c.obj:
$(CC) $(CFLAGS) $(INCL) -c -o $# `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`
The other Makefile compiles a lot of code and makes use of bison and flex. This one is also made by someone else. I am able to alter this Makefile when I want to add some code. This Makefile also makes a binary.
CFLAGS=-Wall
LDLIBS=-LC:/GnuWin32/lib -lfl -lm
LSOURCES=lex.l
YSOURCES=grammar.ypp
CSOURCES=debug.cpp esta_plus.cpp heap.cpp main.cpp stjn.cpp timing.cpp tmsp.cpp token.cpp chaining.cpp flexibility.cpp exceptions.cpp
HSOURCES=$(CSOURCES:.cpp=.h) includes.h
OBJECTS=$(LSOURCES:.l=.o) $(YSOURCES:.ypp=.tab.o) $(CSOURCES:.cpp=.o)
all: solver
solver: CFLAGS+=-g -O0 -DDEBUG
solver: $(OBJECTS) main.o debug.o
g++ $(CFLAGS) -o $# $^ $(LDLIBS)
solver.release: CFLAGS+=-O5
solver.release: $(OBJECTS) main.o
g++ $(CFLAGS) -o $# $^ $(LDLIBS)
%.o: %.cpp
g++ -c $(CFLAGS) -o $# $<
lex.cpp: lex.l grammar.tab.cpp grammar.tab.hpp
flex -o$# $<
%.tab.cpp %.tab.hpp: %.ypp
bison --verbose -d $<
ifneq ($(LSOURCES),)
$(LSOURCES:.l=.cpp): $(YSOURCES:.y=.tab.h)
endif
-include $(OBJECTS:.o=.d)
clean:
rm -f $(OBJECTS) $(OBJECTS:.o=.d) $(YSOURCES:.ypp=.tab.cpp) $(YSOURCES:.ypp=.tab.hpp) $(YSOURCES:.ypp=.output) $(LSOURCES:.l=.cpp) solver solver.release 2>/dev/null
.PHONY: all clean debug release
Both of these Makefiles are, for me, hard to understand. I don't know what they exactly do. What I want is to merge the two of them so I get only one binary. The code compiled in the second Makefile should be the result. I want to add flexibility.cpp and constraints.cpp to the second Makefile, but when I do. I get the problem following problem:
flexibility.h:4:26: fatal error: ClpSimplex.hpp: No such file or directory
#include "ClpSimplex.hpp"
So the compiler can't find the Clp library. I also tried to copy-paste more code from the first Makefile into the second, but it still gives me that same error.
Q: Can you please help me with merging the two makefiles or pointing out a more elegant way?
Q: In this case is it indeed better to merge the two Makefiles?
I also tried to use cmake, but I gave upon that one quickly, because I don't know much about flex and bison.
g++ -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\" `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --cflags clp` -c -o main.o `test -f 'main.cpp' || echo './'`main.cpp
g++ -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\" `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --cflags clp` -c -o constraints.o `test -f 'constraints.cpp' || echo './'`constraints.cpp
g++ -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\" `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --cflags clp` -c -o flexibility.o `test -f 'flexibility.cpp' || echo './'`flexibility.cpp
bla=;\
for file in main.o constraints.o flexibility.o; do bla="$bla `echo $file`"; done; \
g++ -Wl,--rpath -Wl,/home/martijn/Downloads/COIN/coin-Clp/lib -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\" -o clp $bla `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --libs clp`
This is coming out of the first Makefile, looks like there are some errors in it? Printing things like echo looks really stupid.
What I want is to merge the two of them so I get only one binary.
I believe you have a complete wrong understanding what make does and what a Makefile is good for and there is a big misunderstanding what the concept of libraries, modules and programs ( binaries ) is.
As a first hint:
You can have multiple Makefiles in one directory. They can have every name you want to give them! "Makefile" is only the standard name which is searched first from the make command. Typical names are *.mk for modules of makefiles.
The next thing is, that there is no problem to call a makefile directly from make with another name. Simply use make -f xyz.mk to get this makefile in action.
The next thing is, that you can also include one makefile from another with "include".
I have not enough time to create your makefiles at all. But you should start with a little analyses:
What are your sources
What are your intermediate products / libraries / object - files
which objects will be linked to final product or libraries
which are the final products build up.
After that you can simply build your makefile toolchain. But you have start with some basic reading and some experiments with make.
I have run the first Makefile and used the output on the terminal to edit the second Makefile. I also have added the -std=c++11 flag which solved a few errors. The thing is compiling with the included libraries. I should be able to move on without any problems.
The working result with a few warnings:
CFLAGS=-Wall
LDLIBS=-LC:/GnuWin32/lib -lfl -lm
LSOURCES=lex.l
YSOURCES=grammar.ypp
CSOURCES=debug.cpp esta_plus.cpp heap.cpp main.cpp stjn.cpp timing.cpp tmsp.cpp token.cpp chaining.cpp exceptions.cpp constraints.cpp flexibility.cpp
HSOURCES=$(CSOURCES:.cpp=.h) includes.h
OBJECTS=$(LSOURCES:.l=.o) $(YSOURCES:.ypp=.tab.o) $(CSOURCES:.cpp=.o)
# C++ Compiler options
CXXFLAGS = -std=c++11 -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD
EXTRAFLAG = -std=c++11 -Wl,--rpath -Wl,/home/martijn/Downloads/COIN/coin-Clp/lib -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\"
EXTRALIB = `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --libs clp`
all: solver
solver: CFLAGS+=-g -O0 -DDEBUG
solver: $(OBJECTS) main.o debug.o
g++ $(CFLAGS) $(EXTRAFLAG) -o $# $^ $(LDLIBS) $(EXTRALIB)
solver.release: CFLAGS+=-O5
solver.release: $(OBJECTS) main.o
g++ $(CFLAGS) -o $# $^ $(LDLIBS)
main.o: main.cpp
g++ $(CXXFLAGS) -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\" `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --cflags clp` -c -o main.o `test -f 'main.cpp' || echo './'`main.cpp
flexibility.o: flexibility.cpp
g++ $(CXXFLAGS) -DSAMPLEDIR=\"`PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --variable=datadir coindatasample`\" `PKG_CONFIG_PATH=/home/martijn/Downloads/COIN/coin-Clp/lib64/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/lib/pkgconfig:/home/martijn/Downloads/COIN/coin-Clp/share/pkgconfig: pkg-config --cflags clp` -c -o flexibility.o `test -f 'flexibility.cpp' || echo './'`flexibility.cpp
%.o: %.cpp
g++ -c $(CFLAGS) -o $# $<
lex.cpp: lex.l grammar.tab.cpp grammar.tab.hpp
flex -o$# $<
%.tab.cpp %.tab.hpp: %.ypp
bison --verbose -d $<
ifneq ($(LSOURCES),)
$(LSOURCES:.l=.cpp): $(YSOURCES:.y=.tab.h)
endif
-include $(OBJECTS:.o=.d)
clean:
rm -f $(OBJECTS) $(OBJECTS:.o=.d) $(YSOURCES:.ypp=.tab.cpp) $(YSOURCES:.ypp=.tab.hpp) $(YSOURCES:.ypp=.output) $(LSOURCES:.l=.cpp) solver solver.release 2>/dev/null
.PHONY: all clean debug release