# MediaMtx (C++) - make CFG=Release (default) or make CFG=Debug # # Needs: live555 (pkg-config live555, as for la_mojo), libdatachannel (>= 0.20, installed in /usr/local), # OpenSSL, nlohmann-json (header only). # Other locations: make LIVE555_CFLAGS=... LIVE555_LIBS=... DATACHANNEL_CFLAGS=-I... DATACHANNEL_LIBS="-L... -ldatachannel" CFG ?= Release ifeq ($(CFG),Debug) OUTDIR = Debug OPT = -O0 -g -DDEBUG else OUTDIR = Release OPT = -O2 endif LIVE555_CFLAGS ?= $(shell pkg-config --cflags live555 2>/dev/null) LIVE555_LIBS ?= $(shell pkg-config --libs live555 2>/dev/null || echo -lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment) DATACHANNEL_CFLAGS ?= DATACHANNEL_LIBS ?= -ldatachannel CXX ?= g++ CXXFLAGS += -std=c++17 -Wall -Wextra -Wno-unused-parameter $(OPT) $(LIVE555_CFLAGS) $(DATACHANNEL_CFLAGS) LIBS = $(DATACHANNEL_LIBS) $(LIVE555_LIBS) -lssl -lcrypto -lpthread TARGET = $(OUTDIR)/mediamtx SRCS = main.cpp \ internal/logger/logger.cpp \ internal/conf/conf.cpp \ internal/codecs/h264/h264.cpp \ internal/stream/stream.cpp \ internal/staticsources/rtsp/rtspSource.cpp \ internal/protocols/httpp/httpServer.cpp \ internal/core/path.cpp \ internal/core/pathManager.cpp \ internal/core/core.cpp \ internal/recorder/fmp4Writer.cpp \ internal/recorder/recorder.cpp \ internal/servers/webrtc/session.cpp \ internal/servers/webrtc/webrtcServer.cpp \ internal/api/api.cpp OBJS = $(patsubst %.cpp,$(OUTDIR)/obj/%.o,$(SRCS)) DEPS = $(OBJS:.o=.d) all: $(TARGET) $(TARGET): $(OBJS) $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) $(OUTDIR)/obj/%.o: %.cpp @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@ clean: rm -rf $(OUTDIR) -include $(DEPS) .PHONY: all clean