You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4 KiB
Makefile

WARN_FLAGS := -Wall -Wextra -Werror=unused-result -Wimplicit-fallthrough \
-Wmissing-prototypes -Wno-missing-field-initializers -Wno-c99-designator \
-Wno-dangling-else # FFS
BASE_CXXFLAGS := -std=c++20 -MMD -MP $(WARN_FLAGS) \
-fPIC -fvisibility=hidden -fdata-sections -ffunction-sections
BASE_LDFLAGS := -Wl,--gc-sections,-z,defs
CXX := clang++
CXXFLAGS ?= -O2 -march=native -g
.PHONY : all clean make_sig
BINARIES := surroundize-converter surroundize-pipewire
BASE_O := decoder.o ffdshow/ffdshow_decoder.o ffdshow/firfilter.o freesurround/channelmaps.o freesurround/freesurround_decoder.o freesurround/kiss_fft.o freesurround/kiss_fftr.o freesurround_wrapper.o options.o
ALL_O := $(BASE_O) converter.o pipewire.o
all: $(BINARIES)
clean:
rm -f $(BINARIES) *.[do] ffdshow/*.[do] freesurround/*.[do] .sig
.sig: make_sig
@export X='$(CXX)|$(BASE_CXXFLAGS)|$(BASE_LDFLAGS)|$(CXXFLAGS)|$(LDFLAGS)'; \
echo "$$X" | cmp -s - $@ || echo "$$X" > $@
# outputs
surroundize-converter: $(BASE_O) converter.o
$(CXX) $(BASE_LDFLAGS) $(LDFLAGS) -o $@ $^
surroundize-pipewire: $(BASE_O) pipewire.o
$(CXX) $(BASE_LDFLAGS) $(LDFLAGS) $$(pkg-config --libs libpipewire-0.3) -o $@ $^
# files
%.o: %.cpp .sig
$(CXX) $(BASE_CXXFLAGS) $(CXXFLAGS) -c -o $@ $<
pipewire.o: pipewire.cpp .sig
$(CXX) $(BASE_CXXFLAGS) $(CXXFLAGS) $$(pkg-config --cflags libpipewire-0.3) -c -o $@ $<
-include $(ALL_O:.o=.d)