MakeFile example for Linux x64 shared build

Hello Wyatt,

Is there an example on building a project using shared library "libTurboActivate.so" on linux x64?I see the makefile examples for static library only.

The next version of TurboActivate will have more makefiles. Here's the x64 one for the Example.c:

CXXFLAGS = -Os -s -ffunction-sections -fdata-sections -DNDEBUG -m64 -L../../amd64LDFLAGS = -Wl,--gc-sections -Wl,-rpath='$$ORIGIN'

example: example.o g++ $(CXXFLAGS) $(LDFLAGS) -o ../../amd64/example.out example.o -lTurboActivate -lrt

example.o: g++ -c $(CXXFLAGS) $(LDFLAGS) Example.c -o example.o

Thanks for the prompt response Wyatt. This will help me.

My project uses CMake for builds, and I have kept all licensing code in a single "License.cpp" file.So, how can I specify these CPPFLAGS,LDFLAGS so that they are used only while compiling "License.cpp" and not for other source files?

It's all there in the makefile:

example.o:g++ -c $(CXXFLAGS) $(LDFLAGS) Example.c -o example.o

See the variables? See how they're use for compiling Example.c? Do that for your License.cpp.

Hi,

Yes, I understood that. My question was in relation to CMake. There if i specify flags like this then they will be common to all the files while compiling. I want to avoid that.

We define those variables at the top of the script. You can change them to anything. It's entirely up to you.

Ok 🙂 Thanks.