diff --git a/Makefile.conf b/Makefile.conf deleted file mode 100644 index fdb69af..0000000 --- a/Makefile.conf +++ /dev/null @@ -1,27 +0,0 @@ -HERE:=$(dir $(lastword $(MAKEFILE_LIST))) --include $(HERE)build.conf - -# Project Name -TARGET?=perkons - -# Configure for debugging -# common configurations: -# use DEBUG = 1 and OPT = -Og for debugging -# or DEBUG = 0 and OPT = -O3 for performance -DEBUG?=0 -OPT?=-O3 - -# (optional) Includes FatFS source files within project. -#USE_FATFS = 1 - -# Relative to dir 'src' -LIBDAISY_DIR?=../../heck_libDaisy -DAISYSP_DIR?=../../heck_DaisySP - -CXXFLAGS+=-Wall -Wno-unused -Wno-reorder-ctor -Wno-switch - -ifneq (,$(findstring g++,$(CXX))) - CXXFLAGS+=-fdiagnostics-color=always -else ifneq (,$(findstring clang,$(CXX))) - CXXFLAGS+=-fcolor-diagnostics -endif diff --git a/build.conf.example b/build.conf.example index 8f67bd4..a6f88ca 100644 --- a/build.conf.example +++ b/build.conf.example @@ -1,12 +1,13 @@ -# Build config -# also, infos for the build system about the dev environment +# Dev environment build config +# This is a template, make a local copy called 'build.conf', remove this line, and tweak the values as you develop # The program to compile and flash # the name of the main cxx file without the prefix 'main_' -TARGET?=perkons +TARGET ?= perkons -DEBUG?=0 +DEBUG ?= 0 + +# dependencies relative to dir 'src' +LIBDAISY_DIR ?= ../../heck_libDaisy +DAISYSP_DIR ?= ../../heck_DaisySP -# Daisy dependencies Relative to dir 'src' -LIBDAISY_DIR?=../../heck_libDaisy -DAISYSP_DIR?=../../heck_DaisySP diff --git a/src/Makefile b/src/Makefile index 27149d7..f266621 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,19 +1,21 @@ -include ../Makefile.conf +-include ../build.conf -ALL_SRC=$(wildcard *.cc) -TARGET_SRC=main_$(TARGET).cc -MODULES_SRC=$(filter-out main_%,$(ALL_SRC)) -CXX_SRC=$(MODULES_SRC) $(TARGET_SRC) +TARGET ?= perkons +DEBUG ?= 0 +LIBDAISY_DIR ?= ../../heck_libDaisy +DAISYSP_DIR ?= ../../heck_DaisySP -$(info CXXFLAGS: $(CXXFLAGS)) -$(info SOURCES: $(ALL_SRC)) -$(info MODULES: $(MODULES_SRC)) -$(info TARGET_SRC: $(TARGET_SRC)) -$(info CXX_SRC: $(CXX_SRC)) +CXX_STANDARD ?= -std=c++17 +CXXFLAGS += -Wall -Wno-unused -Wno-reorder-ctor -Wno-switch +CXXFLAGS += -fdiagnostics-color=always -# libDaisy Makefile variables -CFLAGS=$(CXXFLAGS) -SYSTEM_FILES_DIR=$(LIBDAISY_DIR)/core -CPP_SOURCES=$(CXX_SRC) -include $(SYSTEM_FILES_DIR)/Makefile +# Eval all sources with exactly one main() based on TARGET +ALL_SRC = $(wildcard *.cc) +TARGET_SRC = main_$(TARGET).cc +MODULES_SRC = $(filter-out main_%,$(ALL_SRC)) +CXX_SRC = $(MODULES_SRC) $(TARGET_SRC) + +CXX_SOURCES = $(CXX_SRC) + +include $(LIBDAISY_DIR)/core/Makefile \ No newline at end of file