Shared libraries C++ Makefile

Viewed 5423

I need to compile fat binary file to be able use it on another linux machine. But there are some libraries missing so as I understand I should compile it with some -shared options. But I don't understand how to configure a Makefile for that. Currently my makefile looks like this:

CC = g++
CC_FLAGS = -std=c++11 -O2 -static -Wall

EXEC = cpp_server
SOURCES = $(wildcard *.cpp)
OBJECTS = $(SOURCES:.cpp=.o)
LIBS = -lpthread -lmicrohttpd -lz

$(EXEC): $(OBJECTS)
    $(CC) $(OBJECTS) -o $(EXEC) $(LIBS)

%.o: %.cpp
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
    rm -f $(EXEC) $(OBJECTS)
1 Answers
Related