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