Browse Source

Build: fix build conf concept

A build variable is evaluated like:
1.) if the var is already defined in the shell env, use that.
2.) if the var is defined in the the build.conf, use that.
3. fallback to using the var default in Makefile.conf
usb_midi_launchpad
heck 7 months ago
parent
commit
5622a463a9
  1. 18
      Makefile.conf
  2. 10
      build.conf.example

18
Makefile.conf

@ -1,4 +1,5 @@
HERE:=$(dir $(lastword $(MAKEFILE_LIST))) HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
-include $(HERE)build.conf
# Project Name # Project Name
TARGET?=blink TARGET?=blink
@ -7,29 +8,20 @@ TARGET?=blink
# common configurations: # common configurations:
# use DEBUG = 1 and OPT = -Og for debugging # use DEBUG = 1 and OPT = -Og for debugging
# or DEBUG = 0 and OPT = -O3 for performance # or DEBUG = 0 and OPT = -O3 for performance
DEBUG=0 DEBUG?=0
OPT=-O3 OPT?=-O3
# (optional) Includes FatFS source files within project. # (optional) Includes FatFS source files within project.
#USE_FATFS = 1 #USE_FATFS = 1
# Relative to dir 'src' # Relative to dir 'src'
LIBDAISY_DIR=../../heck_libDaisy LIBDAISY_DIR?=../../heck_libDaisy
DAISYSP_DIR=../../heck_DaisySP DAISYSP_DIR?=../../heck_DaisySP
CXXFLAGS+=-Wall -Wno-unused -Wno-reorder-ctor -Wno-switch CXXFLAGS+=-Wall -Wno-unused -Wno-reorder-ctor -Wno-switch
######### Overrides from build.conf #########
-include $(HERE)build.conf
ifneq (,$(findstring g++,$(CXX))) ifneq (,$(findstring g++,$(CXX)))
CXXFLAGS+=-fdiagnostics-color=always CXXFLAGS+=-fdiagnostics-color=always
else ifneq (,$(findstring clang,$(CXX))) else ifneq (,$(findstring clang,$(CXX)))
CXXFLAGS+=-fcolor-diagnostics CXXFLAGS+=-fcolor-diagnostics
endif endif
ifeq ($(DEBUG),1)
CXXFLAGS+=-g -O0
else
CXXFLAGS+=-DNDEBUG=1 -O3
endif

10
build.conf.example

@ -3,11 +3,11 @@
# TARGET sets the program to compile and flash # TARGET sets the program to compile and flash
# the name of the main cxx file without the prefix 'main_' # the name of the main cxx file without the prefix 'main_'
TARGET=blink TARGET?=blink
#TARGET=testtone #TARGET?=testtone
DEBUG=0 DEBUG?=0
# Daisy dependencies relative to dir 'src' # Daisy dependencies relative to dir 'src'
LIBDAISY_DIR=../../heck_libDaisy LIBDAISY_DIR?=../../heck_libDaisy
DAISYSP_DIR=../../heck_DaisySP DAISYSP_DIR?=../../heck_DaisySP

Loading…
Cancel
Save