Makefile
author František Kučera <franta-hg@frantovo.cz>
Sun, 01 Jun 2025 13:18:29 +0200
branchv_0
changeset 21 476a295bfcc9
parent 14 f02473035a66
permissions -rw-r--r--
Added tag v0.2 for changeset a08e30243b95
     1 # DJM-Fix
     2 # Copyright © 2025 František Kučera (Frantovo.cz, GlobalCode.info)
     3 #
     4 # This program is free software: you can redistribute it and/or modify
     5 # it under the terms of the GNU General Public License as published by
     6 # the Free Software Foundation, version 3 of the License.
     7 #
     8 # This program is distributed in the hope that it will be useful,
     9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 # GNU General Public License for more details.
    12 #
    13 # You should have received a copy of the GNU General Public License
    14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
    15 
    16 CXX ?= g++
    17 CXXFLAGS ?= -O2 -g3 -ggdb -Wall -Wno-sign-compare
    18 CXXFLAGS += --std=c++20
    19 # CXXFLAGS += -Wextra
    20 LIBS = alsa
    21 CXXFLAGS += $(shell pkg-config --cflags $(LIBS))
    22 LDFLAGS  += $(shell pkg-config --libs   $(LIBS))
    23 LDFLAGS  += -lpthread
    24 
    25 ifeq ($(MODE), dev)
    26 CXXFLAGS += -fsanitize=undefined -fsanitize=address
    27 endif
    28 # TODO: provide debug symbols in separate files
    29 
    30 BIN = build/djm-fix
    31 SRC =     $(shell find -maxdepth 1 -name '*.cpp')
    32 HEADERS = $(shell find -maxdepth 1 -name '*.h')
    33 
    34 all: $(BIN)
    35 
    36 .PHONY: all clean run
    37 
    38 clean:
    39 	$(RM) -r build
    40 
    41 run: $(BIN)
    42 	$(<)
    43 
    44 $(BIN): $(SRC) $(HEADERS)
    45 	mkdir -p build
    46 	$(CXX) $(CXXFLAGS) -o $(@) $(SRC) $(LDFLAGS)