Re-organize and re-prefix the Makefile variables

This commit is contained in:
Romain Goyet
2018-02-01 15:39:52 +01:00
committed by EmilieNumworks
parent 0a3623421c
commit 489b26e813
24 changed files with 120 additions and 111 deletions

View File

@@ -1,53 +1,14 @@
include build/config.mak
VERSION ?= 1.3.0
ifndef USE_LIBA
$(error platform.mak should define USE_LIBA)
endif
ifndef EXE
$(error platform.mak should define EXE, the extension for executables)
endif
HOSTCC = gcc
HOSTCXX = g++
# Flags - Optimizations
SFLAGS += $(OPTIM_SFLAGS)
# Flags - Header search path
SFLAGS += -Ilib -I.
# Flags - Building options
SFLAGS += -Wall
# Flags - Header dependency tracking
SFLAGS += -MD -MP
# Language-specific flags
CFLAGS = -std=c99
CXXFLAGS = -std=c++11 -fno-exceptions -fno-rtti -fno-threadsafe-statics
products :=
default: app.$(EXE)
run: app_run
.PHONY: info
info:
@echo "========= BUILD SETTINGS ======"
@echo "DEBUG = $(DEBUG)"
@echo "PLATFORM = $(PLATFORM)"
@echo "CC = $(CC)"
@echo "CXX = $(CXX)"
@echo "LD = $(LD)"
@echo "CFLAGS = $(CFLAGS)"
@echo "CXXFLAGS = $(CXXFLAGS)"
@echo "SFLAGS = $(SFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "EPSILON_VERSION = $(EPSILON_VERSION)"
@echo "EPSILON_ONBOARDING_APP = $(EPSILON_ONBOARDING_APP)"
@echo "EPSILON_SOFTWARE_UPDATE_PROMPT = $(EPSILON_SOFTWARE_UPDATE_PROMPT)"
@echo "EPSILON_APPS = $(EPSILON_APPS)"
@echo "EPSILON_I18N_LANGUAGES = $(EPSILON_I18N_LANGUAGES)"
@echo "==============================="
@echo "EPSILON_I18N = $(EPSILON_I18N)"
# Each sub-Makefile can either add objects to the $(objs) variable or define a
# new executable target. The $(objs) variable lists the objects that will be
@@ -56,6 +17,8 @@ info:
# that could be generated during the build and that needs to be cleaned up
# afterwards.
products :=
# Library Makefiles
ifeq ($(USE_LIBA),0)
include liba/Makefile.bridge
@@ -86,23 +49,23 @@ $(all_objs): $(generated_headers)
.SECONDARY: $(objs)
%.$(EXE): $(objs)
@echo "LD $@"
@$(LD) $^ $(LDFLAGS) -o $@
$(Q) $(LD) $^ $(LDFLAGS) -o $@
%.o: %.c
@echo "CC $@"
@$(CC) $(SFLAGS) $(CFLAGS) -c $< -o $@
$(Q) $(CC) $(SFLAGS) $(CFLAGS) -c $< -o $@
%.o: %.s
@echo "AS $@"
@$(CC) $(SFLAGS) -c $< -o $@
$(Q) $(CC) $(SFLAGS) -c $< -o $@
%.o: %.cpp
@echo "CXX $@"
@$(CXX) $(SFLAGS) $(CXXFLAGS) -c $< -o $@
$(Q) $(CXX) $(SFLAGS) $(CXXFLAGS) -c $< -o $@
.PHONY: clean
clean:
@echo "CLEAN"
@rm -f $(products)
$(Q) rm -f $(products)
-include build/targets.$(PLATFORM).mak

View File

@@ -1,5 +1,3 @@
EPSILON_I18N_LANGUAGES ?= en fr es de pt
EPSILON_APPS ?= calculation graph sequence settings statistics probability regression code
include apps/shared/Makefile
include apps/home/Makefile
@@ -45,7 +43,7 @@ snapshot_includes = $(foreach i,$(snapshot_headers),-include $(i) )
apps/apps_container_storage.o apps/main.o: CXXFLAGS += $(snapshot_includes) -DAPPS_CONTAINER_SNAPSHOT_DECLARATIONS="$(snapshots_declaration)" -DAPPS_CONTAINER_SNAPSHOT_CONSTRUCTORS="$(snapshots_construction)" -DAPPS_CONTAINER_SNAPSHOT_LIST="$(snapshots_list)" -DAPPS_CONTAINER_SNAPSHOT_COUNT=$(snapshots_count)
i18n_files += $(addprefix apps/language_,$(addsuffix .universal.i18n, $(EPSILON_I18N_LANGUAGES)))
i18n_files += $(addprefix apps/language_,$(addsuffix .universal.i18n, $(EPSILON_I18N)))
i18n_files += $(addprefix apps/,\
shared.de.i18n\
shared.en.i18n\
@@ -68,7 +66,7 @@ i18n_files += $(addprefix apps/,\
apps/i18n.h: apps/i18n.cpp
apps/i18n.cpp: $(i18n_files)
@echo "I18N $@"
@python apps/i18n.py --header $(subst .cpp,.h,$@) --implementation $@ --locales $(EPSILON_I18N_LANGUAGES) --files $^
$(Q) @python apps/i18n.py --header $(subst .cpp,.h,$@) --implementation $@ --locales $(EPSILON_I18N) --files $^
$(app_objs): apps/i18n.h

View File

@@ -63,7 +63,7 @@ VariableBoxController * AppsContainer::variableBoxController() {
void AppsContainer::suspend(bool checkIfPowerKeyReleased) {
resetShiftAlphaStatus();
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
if (activeApp()->snapshot()!= onBoardingAppSnapshot() && GlobalPreferences::sharedGlobalPreferences()->showUpdatePopUp()) {
activeApp()->displayModalViewController(&m_updateController, 0.f, 0.f);
}
@@ -126,7 +126,7 @@ void AppsContainer::switchTo(App::Snapshot * snapshot) {
void AppsContainer::run() {
window()->setFrame(KDRect(0, 0, Ion::Display::Width, Ion::Display::Height));
#if OS_WITH_ONBOARDING_APP
#if EPSILON_ONBOARDING_APP
switchTo(onBoardingAppSnapshot());
#else
refreshPreferences();

View File

@@ -6,7 +6,7 @@ namespace OnBoarding {
LanguageController::LanguageController(Responder * parentResponder, LogoController * logoController, UpdateController * updateController) :
Shared::LanguageController(parentResponder, (Ion::Display::Height - I18n::NumberOfLanguages*Metric::ParameterCellHeight)/2),
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
m_updateController(updateController),
#endif
m_logoController(logoController)
@@ -20,7 +20,7 @@ void LanguageController::reinitOnBoarding() {
bool LanguageController::handleEvent(Ion::Events::Event event) {
if (Shared::LanguageController::handleEvent(event)) {
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
app()->displayModalViewController(m_updateController, 0.5f, 0.5f);
#else
AppsContainer * appsContainer = (AppsContainer *)app()->container();

View File

@@ -14,7 +14,7 @@ public:
void reinitOnBoarding();
bool handleEvent(Ion::Events::Event event) override;
private:
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
UpdateController * m_updateController;
#endif
LogoController * m_logoController;

View File

@@ -16,18 +16,18 @@ const SettingsMessageTree complexFormatChildren[2] = {SettingsMessageTree(I18n::
const SettingsMessageTree examChildren[1] = {SettingsMessageTree(I18n::Message::ActivateExamMode)};
const SettingsMessageTree aboutChildren[3] = {SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId)};
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
const SettingsMessageTree menu[8] =
#else
const SettingsMessageTree menu[7] =
#endif
{SettingsMessageTree(I18n::Message::AngleUnit, angleChildren, 2), SettingsMessageTree(I18n::Message::DisplayMode, FloatDisplayModeChildren, 3), SettingsMessageTree(I18n::Message::ComplexFormat, complexFormatChildren, 2),
SettingsMessageTree(I18n::Message::Brightness), SettingsMessageTree(I18n::Message::Language), SettingsMessageTree(I18n::Message::ExamMode, examChildren, 1),
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
SettingsMessageTree(I18n::Message::UpdatePopUp),
#endif
SettingsMessageTree(I18n::Message::About, aboutChildren, 3)};
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 8);
#else
const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp, menu, 7);
@@ -35,7 +35,7 @@ const SettingsMessageTree model = SettingsMessageTree(I18n::Message::SettingsApp
MainController::MainController(Responder * parentResponder) :
ViewController(parentResponder),
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
m_updateCell(I18n::Message::Default, KDText::FontSize::Large),
#endif
m_complexFormatCell(I18n::Message::Default, KDText::FontSize::Large),
@@ -72,7 +72,7 @@ void MainController::didBecomeFirstResponder() {
bool MainController::handleEvent(Ion::Events::Event event) {
if (m_messageTreeModel->children(selectedRow())->numberOfChildren() == 0) {
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::UpdatePopUp) {
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
GlobalPreferences::sharedGlobalPreferences()->setShowUpdatePopUp(!GlobalPreferences::sharedGlobalPreferences()->showUpdatePopUp());
@@ -135,7 +135,7 @@ HighlightCell * MainController::reusableCell(int index, int type) {
if (type == 2) {
return &m_brightnessCell;
}
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
if (type == 3) {
return &m_updateCell;
}
@@ -157,7 +157,7 @@ int MainController::typeAtLocation(int i, int j) {
if (j == 3) {
return 2;
}
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
if (j == 6) {
return 3;
}
@@ -197,7 +197,7 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
static_cast<MessageTableCellWithChevronAndMessage *>(cell)->setSubtitle(I18n::LanguageNames[index]);
return;
}
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
if (index == 6) {
MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell;
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();

View File

@@ -30,7 +30,7 @@ public:
void viewWillAppear() override;
private:
StackViewController * stackController() const;
#if OS_WITH_SOFTWARE_UPDATE_PROMPT
#if EPSILON_SOFTWARE_UPDATE_PROMPT
constexpr static int k_totalNumberOfCell = 8;
MessageTableCellWithSwitch m_updateCell;
#else

View File

@@ -1,25 +1,24 @@
# You can override those settings on the command line
PLATFORM ?= device
VERBOSE ?= 0
DEBUG ?= 0
# Do not edit below this
ifeq ($(DEBUG),1)
OPTIM_SFLAGS ?= -O0 -g
else
OPTIM_SFLAGS ?= -Os
endif
EPSILON_VERSION ?= 1.3.0
EPSILON_ONBOARDING_APP ?= 1
EPSILON_SOFTWARE_UPDATE_PROMPT ?= 1
EPSILON_APPS ?= calculation graph sequence settings statistics probability regression code
EPSILON_I18N ?= en fr es de pt
include build/defaults.mak
include build/platform.$(PLATFORM).mak
ifndef USE_LIBA
$(error platform.mak should define USE_LIBA)
endif
ifndef EXE
$(error platform.mak should define EXE, the extension for executables)
endif
include build/toolchain.$(TOOLCHAIN).mak
OS_WITH_ONBOARDING_APP ?= 1
OS_WITH_SOFTWARE_UPDATE_PROMPT ?= 1
QUIZ_USE_CONSOLE ?= 0
SFLAGS += -DDEBUG=$(DEBUG)
SFLAGS += -DOS_WITH_ONBOARDING_APP=$(OS_WITH_ONBOARDING_APP)
SFLAGS += -DOS_WITH_SOFTWARE_UPDATE_PROMPT=$(OS_WITH_SOFTWARE_UPDATE_PROMPT)
SFLAGS += -DQUIZ_USE_CONSOLE=$(QUIZ_USE_CONSOLE)
SFLAGS += -DEPSILON_ONBOARDING_APP=$(EPSILON_ONBOARDING_APP)
SFLAGS += -DEPSILON_SOFTWARE_UPDATE_PROMPT=$(EPSILON_SOFTWARE_UPDATE_PROMPT)

34
build/defaults.mak Normal file
View File

@@ -0,0 +1,34 @@
HOSTCC = gcc
HOSTCXX = g++
# Language-specific flags
CFLAGS = -std=c99
CXXFLAGS = -std=c++11 -fno-exceptions -fno-rtti -fno-threadsafe-statics
# Flags - Optimizations
ifeq ($(DEBUG),1)
SFLAGS = -O0 -g
else
SFLAGS = -Os
endif
# Flags - Header search path
SFLAGS += -Ilib -I.
# Flags - Building options
SFLAGS += -Wall
# Flags - Header dependency tracking
SFLAGS += -MD -MP
# Define "Q" as an arobase by default to silence-out every command run by make.
# If V=1 is supplied on the make command line, undefine Q so that every command
# is echoed out.
Q=@
BUILD_VERBOSE=0
ifeq ("$(origin V)", "command line")
ifeq ($(V),1)
BUILD_VERBOSE=1
Q=
endif
endif

View File

@@ -1,5 +1,5 @@
TOOLCHAIN ?= host-gcc
USE_LIBA ?= 0
EXE = bin
OS_WITH_ONBOARDING_APP ?= 0
OS_WITH_SOFTWARE_UPDATE_PROMPT ?= 0
EPSILON_ONBOARDING_APP = 0
EPSILON_SOFTWARE_UPDATE_PROMPT = 0

View File

@@ -3,4 +3,3 @@ USE_LIBA = 1
EXE = elf
python/port/port.o: CXXFLAGS += -DMP_PORT_USE_STACK_SYMBOLS=1

View File

@@ -1,5 +1,5 @@
TOOLCHAIN = emscripten
USE_LIBA = 0
EXE = js
OS_WITH_ONBOARDING_APP ?= 0
OS_WITH_SOFTWARE_UPDATE_PROMPT ?= 0
EPSILON_ONBOARDING_APP = 0
EPSILON_SOFTWARE_UPDATE_PROMPT = 0

View File

@@ -4,6 +4,6 @@ ifeq ($(OS),Windows_NT)
endif
USE_LIBA = 0
EXE = elf
OS_WITH_ONBOARDING_APP ?= 0
OS_WITH_SOFTWARE_UPDATE_PROMPT ?= 0
SFLAGS = -fPIE
EPSILON_ONBOARDING_APP = 0
EPSILON_SOFTWARE_UPDATE_PROMPT = 0
SFLAGS += -fPIE

View File

@@ -4,10 +4,11 @@ LD = arm-none-eabi-ld.bfd
GDB = arm-none-eabi-gdb
OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size
ifeq ($(DEBUG),1)
OPTIM_SFLAGS += -ggdb3
SFLAGS += -ggdb3
else
OPTIM_SFLAGS += -fdata-sections -ffunction-sections
LDFLAGS = --gc-sections
SFLAGS += -fdata-sections -ffunction-sections
LDFLAGS += --gc-sections
endif
SFLAGS = -mthumb -march=armv7e-m -mfloat-abi=hard -mcpu=cortex-m4 -mfpu=fpv4-sp-d16
SFLAGS += -mthumb -march=armv7e-m -mfloat-abi=hard -mcpu=cortex-m4 -mfpu=fpv4-sp-d16

View File

@@ -1,4 +1,14 @@
include build/toolchain.arm-gcc.mak
CC = clang
CXX = clang++
SFLAGS = -target thumbv7em-unknown-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16
LD = arm-none-eabi-ld.bfd
GDB = arm-none-eabi-gdb
OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size
SFLAGS += -target thumbv7em-unknown-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16
ifeq ($(DEBUG),1)
SFLAGS += -ggdb3
else
SFLAGS += -fdata-sections -ffunction-sections
LDFLAGS += --gc-sections
endif

View File

@@ -1,6 +1,7 @@
CC = emcc
CXX = emcc
LD = emcc
SIZE = size
SFLAGS = -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1
LDFLAGS = -Oz -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EXPORTED_FUNCTIONS="['_main', '_IonEventsEmscriptenPushEvent']"
SIZE = size

View File

@@ -1,6 +1,7 @@
CC = gcc
CXX = g++
LD = g++
SFLAGS = -D_USE_MATH_DEFINES
LDFLAGS = -static -mwindows
EXE = exe
SFLAGS += -D_USE_MATH_DEFINES
LDFLAGS += -static -mwindows

View File

@@ -82,11 +82,11 @@ INLINER := escher/image/inliner
$(INLINER): escher/image/inliner.c
@echo "HOSTCC $@"
@$(HOSTCC) -std=c99 `libpng-config --cflags` $< `libpng-config --ldflags` -o $@
$(Q) $(HOSTCC) -std=c99 `libpng-config --cflags` $< `libpng-config --ldflags` -o $@
%.h %.cpp : %.png $(INLINER)
@echo "INLINER $@"
@$(INLINER) $<
$(Q) $(INLINER) $<
INLINER_PRODUCTS = $(1:.png=.h) $(1:.png=.cpp) $(1:.png=.o)

View File

@@ -14,7 +14,7 @@ include ion/src/shared/tools/Makefile
# char test[4]= "ab"; is valid and should initialize test to 'a','b',0,0).
# Older versions of GCC are not conformant so we resort to an initializer list.
initializer_list = $(shell echo $(1) | sed "s/\(.\)/'\1',/g")0
ion/src/shared/software_version.o: SFLAGS += -DPATCH_LEVEL="$(call initializer_list,$(PATCH_LEVEL))" -DVERSION="$(call initializer_list,$(VERSION))"
ion/src/shared/software_version.o: SFLAGS += -DPATCH_LEVEL="$(call initializer_list,$(PATCH_LEVEL))" -DEPSILON_VERSION="$(call initializer_list,$(EPSILON_VERSION))"
objs += $(addprefix ion/src/shared/, \
events.o \

View File

@@ -8,8 +8,8 @@
#error This file expects PATCH_LEVEL to be defined
#endif
#ifndef VERSION
#error This file expects VERSION to be defined
#ifndef EPSILON_VERSION
#error This file expects EPSILON_VERSION to be defined
#endif
#ifndef HEADER_SECTION
@@ -20,7 +20,7 @@ class VersionInfo {
public:
constexpr VersionInfo() :
m_header(Magic),
m_version{VERSION},
m_version{EPSILON_VERSION},
m_patchLevel{PATCH_LEVEL},
m_footer(Magic) { }
const char * version() const {

View File

@@ -45,16 +45,16 @@ endif
kandinsky/src/small_font.h: kandinsky/src/small_font.c
kandinsky/src/small_font.c: kandinsky/fonts/rasterizer
@echo "RASTER $(small_font_files)"
@$< kandinsky/fonts/SmallSourcePixel.ttf 12 12 SmallFont $(small_font_files)
$(Q) $< kandinsky/fonts/SmallSourcePixel.ttf 12 12 SmallFont $(small_font_files)
kandinsky/src/large_font.h: kandinsky/src/large_font.c
kandinsky/src/large_font.c: kandinsky/fonts/rasterizer
@echo "RASTER $(large_font_files)"
@$< kandinsky/fonts/LargeSourcePixel.ttf 16 16 LargeFont $(large_font_files)
$(Q) $< kandinsky/fonts/LargeSourcePixel.ttf 16 16 LargeFont $(large_font_files)
kandinsky/fonts/rasterizer: kandinsky/fonts/rasterizer.c kandinsky/fonts/unicode_for_symbol.c
@echo "HOSTCC $@"
@$(HOSTCC) $(RASTERIZER_CFLAGS) $^ $(RASTERIZER_LDFLAGS) -o $@
$(Q) $(HOSTCC) $(RASTERIZER_CFLAGS) $^ $(RASTERIZER_LDFLAGS) -o $@
products += $(small_font_files) $(large_font_files) kandinsky/fonts/rasterizer

View File

@@ -141,7 +141,7 @@ lexer_files = $(addprefix poincare/src/, expression_lexer.cpp expression_lexer.h
poincare/src/expression_lexer.hpp: poincare/src/expression_lexer.cpp
poincare/src/expression_lexer.cpp: poincare/src/expression_lexer.l
@echo "FLEX $(lexer_files)"
@flex -P poincare_expression_yy --header-file=poincare/src/expression_lexer.hpp -o poincare/src/expression_lexer.cpp $<
$(Q) flex -P poincare_expression_yy --header-file=poincare/src/expression_lexer.hpp -o poincare/src/expression_lexer.cpp $<
poincare/src/expression_lexer.o: CXXFLAGS += -Wno-deprecated-register -Wno-unused-value -Wno-unused-function
@@ -149,7 +149,7 @@ parser_files = $(addprefix poincare/src/, expression_parser.cpp expression_parse
poincare/src/expression_parser.hpp: poincare/src/expression_parser.cpp
poincare/src/expression_parser.cpp: poincare/src/expression_parser.y
@echo "BISON $(parser_files)"
@bison -d -p poincare_expression_yy -o poincare/src/expression_parser.cpp $<
$(Q) bison -d -p poincare_expression_yy -o poincare/src/expression_parser.cpp $<
poincare/src/expression.cpp: $(lexer_files) $(parser_files)

View File

@@ -208,7 +208,7 @@ endif
python/port/genhdr/qstrdefs.generated.h: python/port/genhdr/qstrdefs.in.h
@echo "QSTRDAT $@"
@$(PYTHON) python/src/py/makeqstrdata.py $< > $@
$(Q) $(PYTHON) python/src/py/makeqstrdata.py $< > $@
products += python/port/genhdr/qstrdefs.generated.h

View File

@@ -1,11 +1,14 @@
SFLAGS += -Iquiz/include
QUIZ_USE_CONSOLE ?= 0
quiz/src/runner.o: SFLAGS += -DQUIZ_USE_CONSOLE=$(QUIZ_USE_CONSOLE)
symbols_file = $(addprefix quiz/src/, symbols.c)
products += $(symbols_file)
$(symbols_file): $(tests)
@echo "AWK $@"
@awk -f quiz/src/symbols.awk $(tests) > $@
$(Q) awk -f quiz/src/symbols.awk $(tests) > $@
runner_objs += $(addprefix quiz/src/, runner.o symbols.o i18n.o)
test_objs += $(subst .c,.o, $(subst .cpp,.o,$(tests)))