diff --git a/Makefile b/Makefile index 27b1040e1..9433a20d0 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,7 @@ all: BIN RES UI WIDGETS # ---------------------------------------------------------------------------------------------------------------------------- # Binaries (native) -BIN: backend discovery bridges-plugin bridges-ui plugin theme -# interposer +BIN: backend discovery bridges-plugin bridges-ui interposer plugin theme # ---------------------------------------------------------------------------------------------------------------------------- @@ -137,8 +136,12 @@ bridges-ui: libs discovery: libs @$(MAKE) -C source/discovery -interposer: libs +ifeq ($(LINUX),true) +interposer: @$(MAKE) -C source/interposer +else +interposer: +endif plugin: backend bridges-plugin bridges-ui discovery @$(MAKE) -C source/plugin diff --git a/source/bridges-plugin/Makefile b/source/bridges-plugin/Makefile index b5587a175..ecdf73528 100644 --- a/source/bridges-plugin/Makefile +++ b/source/bridges-plugin/Makefile @@ -126,8 +126,8 @@ endif # ---------------------------------------------------------------------------------------------------------------------------- -NATIVE_BUILD_FLAGS = "" -NATIVE_LINK_FLAGS = "" +NATIVE_BUILD_FLAGS = +NATIVE_LINK_FLAGS = ifeq ($(HAVE_FLUIDSYNTH),true) NATIVE_BUILD_FLAGS += $(FLUIDSYNTH_FLAGS) diff --git a/source/discovery/Makefile b/source/discovery/Makefile index d3d6f7cd2..4319a284a 100644 --- a/source/discovery/Makefile +++ b/source/discovery/Makefile @@ -44,8 +44,8 @@ endif # ---------------------------------------------------------------------------------------------------------------------------- -NATIVE_BUILD_FLAGS = "" -NATIVE_LINK_FLAGS = "" +NATIVE_BUILD_FLAGS = +NATIVE_LINK_FLAGS = ifeq ($(HAVE_FLUIDSYNTH),true) NATIVE_BUILD_FLAGS += $(FLUIDSYNTH_FLAGS) diff --git a/source/interposer/Makefile b/source/interposer/Makefile index c101c509e..bdafa961a 100644 --- a/source/interposer/Makefile +++ b/source/interposer/Makefile @@ -1,40 +1,68 @@ #!/usr/bin/make -f -# Makefile for carla interposer # +# Makefile for carla-interposer # # ----------------------------- # # Created by falkTX # CWD=.. -include ../Makefile.mk +include $(CWD)/Makefile.mk -# -------------------------------------------------------------- +# ---------------------------------------------------------------------------------------------------------------------------- + +BINDIR := $(CWD)/../bin + +ifeq ($(DEBUG),true) +OBJDIR := $(CWD)/../build/interposer/Debug +MODULEDIR := $(CWD)/../build/modules/Debug +else +OBJDIR := $(CWD)/../build/interposer/Release +MODULEDIR := $(CWD)/../build/modules/Release +endif + +# ---------------------------------------------------------------------------------------------------------------------------- BUILD_CXX_FLAGS += -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils -# -------------------------------------------------------------- +# ---------------------------------------------------------------------------------------------------------------------------- + +OBJS = $(OBJDIR)/interposer.cpp.o ifeq ($(LINUX),true) -TARGETS = ../../bin/libcarla_interposer.so +TARGETS = $(BINDIR)/libcarla_interposer$(LIB_EXT) +else +TARGETS = endif -# -------------------------------------------------------------- +ifeq ($(UNIX),true) +LINK_FLAGS += -ldl +endif + +# ---------------------------------------------------------------------------------------------------------------------------- all: $(TARGETS) +# ---------------------------------------------------------------------------------------------------------------------------- + clean: - $(RM) $(TARGETS) *.o + rm -f $(OBJDIR)/*.o $(TARGETS) debug: $(MAKE) DEBUG=true -# -------------------------------------------------------------- +# ---------------------------------------------------------------------------------------------------------------------------- + +$(BINDIR)/libcarla_interposer$(LIB_EXT): $(OBJS) + -@mkdir -p $(BINDIR) + @echo "Linking libcarla_interposer$(LIB_EXT)" + @$(CXX) $< $(SHARED) $(LINK_FLAGS) -o $@ -interposer.cpp.o: interposer.cpp - $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ +# ---------------------------------------------------------------------------------------------------------------------------- -# -------------------------------------------------------------- +$(OBJDIR)/%.cpp.o: %.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $<" + @$(CXX) $< $(BUILD_CXX_FLAGS) -MMD -c -o $@ -../../bin/libcarla_interposer.so: interposer.cpp.o - $(CXX) $< $(SHARED) $(LINK_FLAGS) -ldl -o $@ +-include $(OBJS:%.o=%.d) -# -------------------------------------------------------------- +# ----------------------------------------------------------------------------------------------------------------------------