The Makefile for this part of the project looks as follows:
export TOP := $(CURDIR)
GPP = g++
GCC = gcc
MAKEDIR = mkdir -p
RM = rm
OUTPUT = bmac_server
INCLUDE = -I .
FLAGS := $(INCLUDE) -g3 -std=c++17 -U__STRICT_ANSI__
LIB := -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON
CPPFLAGS := $(FLAGS)
CFLAGS := -g3
CPP_SOURCES := $(wildcard *.cpp) $(wildcard devices/*.cpp)
CPP_OBJECTS := $(addprefix obj/,$(notdir) $(CPP_SOURCES:.cpp=.o))
all: makedir $(C_OBJECTS) $(CPP_OBJECTS) bin/$(OUTPUT)
obj/%.o: %.cpp
$(GPP) -c -o $@ $< $(CPPFLAGS)
bin/$(OUTPUT):
-rm -f $@
$(GPP) -o $@ $(C_OBJECTS) $(CPP_OBJECTS) $(LIB)
makedir:
$(MAKEDIR) bin
$(MAKEDIR) obj/devices
clean:
$(RM) $(CPP_OBJECTS)
This is a rather simple Makefile as we have no special demands. We gather the source files, determine the names of the resulting object files, and compile all of them before generating a binary out of these object files.