diff -r 334b727f7516 -r f02473035a66 Makefile --- a/Makefile Mon Jan 04 17:11:57 2021 +0100 +++ b/Makefile Tue Apr 15 22:44:24 2025 +0200 @@ -1,5 +1,5 @@ # DJM-Fix -# Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info) +# Copyright © 2025 František Kučera (Frantovo.cz, GlobalCode.info) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,18 +13,34 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -CXXFLAGS=-fno-omit-frame-pointer -fsanitize=address -g -lpthread $$(pkg-config --libs --cflags alsa) +CXX ?= g++ +CXXFLAGS ?= -O2 -g3 -ggdb -Wall -Wno-sign-compare +CXXFLAGS += --std=c++20 +# CXXFLAGS += -Wextra +LIBS = alsa +CXXFLAGS += $(shell pkg-config --cflags $(LIBS)) +LDFLAGS += $(shell pkg-config --libs $(LIBS)) +LDFLAGS += -lpthread -all: build/djm-fix +ifeq ($(MODE), dev) +CXXFLAGS += -fsanitize=undefined -fsanitize=address +endif +# TODO: provide debug symbols in separate files -clean: - rm -rf build +BIN = build/djm-fix +SRC = $(shell find -maxdepth 1 -name '*.cpp') +HEADERS = $(shell find -maxdepth 1 -name '*.h') -run: build/djm-fix - build/djm-fix +all: $(BIN) .PHONY: all clean run -build/djm-fix: DJMFix.cpp DJMFix.h AlsaBridge.cpp AlsaBridge.h Logger.cpp Logger.h djm-fix.cpp +clean: + $(RM) -r build + +run: $(BIN) + $(<) + +$(BIN): $(SRC) $(HEADERS) mkdir -p build - g++ -o $@ DJMFix.cpp AlsaBridge.cpp Logger.cpp djm-fix.cpp $(CXXFLAGS) + $(CXX) $(CXXFLAGS) -o $(@) $(SRC) $(LDFLAGS)