mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
add Makefile back - needed for sonar
This commit is contained in:
158
Makefile
Normal file
158
Makefile
Normal file
@@ -0,0 +1,158 @@
|
||||
#
|
||||
# GNUMakefile for EMS-ESP
|
||||
#
|
||||
|
||||
NUMJOBS=${NUMJOBS:-" -j2 "}
|
||||
MAKEFLAGS+="j "
|
||||
#----------------------------------------------------------------------
|
||||
# Project Structure
|
||||
#----------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing header files
|
||||
# LIBRARIES is a list of directories containing libraries, this must be the top level containing include and lib
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#TARGET := $(notdir $(CURDIR))
|
||||
TARGET := emsesp
|
||||
BUILD := build
|
||||
SOURCES := src src/* lib_standalone lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src src/devices lib/ArduinoJson/src lib/PButton lib/semver lib/espMqttClient/src lib/espMqttClient/src/*
|
||||
INCLUDES := src lib_standalone lib/espMqttClient/src lib/espMqttClient/src/Transport lib/ArduinoJson/src lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src lib/uuid-telnet/src lib/uuid-syslog/src lib/semver lib/* src/devices
|
||||
LIBRARIES :=
|
||||
|
||||
CPPCHECK = cppcheck
|
||||
# CHECKFLAGS = -q --force --std=c++17
|
||||
CHECKFLAGS = -q --force --std=c++11
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Languages Standard
|
||||
#----------------------------------------------------------------------
|
||||
C_STANDARD := -std=c17
|
||||
CXX_STANDARD := -std=gnu++14
|
||||
|
||||
# C_STANDARD := -std=c11
|
||||
# CXX_STANDARD := -std=c++11
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Defined Symbols
|
||||
#----------------------------------------------------------------------
|
||||
DEFINES += -DARDUINOJSON_ENABLE -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0
|
||||
DEFINES += -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST -D__linux__ -DEMC_RX_BUFFER_SIZE=1500
|
||||
DEFINES += $(ARGS)
|
||||
|
||||
DEFAULTS = -DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.7.0-dev\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\"
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Sources & Files
|
||||
#----------------------------------------------------------------------
|
||||
OUTPUT := $(CURDIR)/$(TARGET)
|
||||
SYMBOLS := $(CURDIR)/$(BUILD)/$(TARGET).out
|
||||
|
||||
CSOURCES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.c))
|
||||
CXXSOURCES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cpp))
|
||||
|
||||
OBJS := $(patsubst %,$(BUILD)/%.o,$(basename $(CSOURCES)) $(basename $(CXXSOURCES)) )
|
||||
DEPS := $(patsubst %,$(BUILD)/%.d,$(basename $(CSOURCES)) $(basename $(CXXSOURCES)) )
|
||||
|
||||
INCLUDE += $(addprefix -I,$(foreach dir,$(INCLUDES), $(wildcard $(dir))))
|
||||
INCLUDE += $(addprefix -I,$(foreach dir,$(LIBRARIES),$(wildcard $(dir)/include)))
|
||||
|
||||
LDLIBS += $(addprefix -L,$(foreach dir,$(LIBRARIES),$(wildcard $(dir)/lib)))
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Compiler & Linker
|
||||
#----------------------------------------------------------------------
|
||||
CC := /usr/bin/gcc
|
||||
CXX := /usr/bin/g++
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Compiler & Linker Flags
|
||||
#----------------------------------------------------------------------
|
||||
# CPPFLAGS C and C++ Compiler Flags
|
||||
# CFLAGS C Compiler Flags
|
||||
# CXXFLAGS C++ Compiler Flags
|
||||
# LDFLAGS Linker Flags
|
||||
#----------------------------------------------------------------------
|
||||
CPPFLAGS += $(DEFINES) $(DEFAULTS) $(INCLUDE)
|
||||
CPPFLAGS += -ggdb
|
||||
CPPFLAGS += -g3
|
||||
CPPFLAGS += -Os
|
||||
|
||||
CFLAGS += $(CPPFLAGS)
|
||||
CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-missing-braces -Wno-unused-lambda-capture -Wno-sign-compare
|
||||
|
||||
CXXFLAGS += $(CFLAGS) -MMD
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Compiler & Linker Commands
|
||||
#----------------------------------------------------------------------
|
||||
# LINK.o link object files to binary
|
||||
# COMPILE.c compile C source files
|
||||
# COMPILE.cpp compile C++ source files
|
||||
#----------------------------------------------------------------------
|
||||
ifeq ($(strip $(CXXSOURCES)),)
|
||||
LD := $(CC)
|
||||
else
|
||||
LD := $(CXX)
|
||||
endif
|
||||
|
||||
#DEPFLAGS += -MF $(BUILD)/$*.d
|
||||
|
||||
LINK.o = $(LD) $(LDFLAGS) $(LDLIBS) $^ -o $@
|
||||
COMPILE.c = $(CC) $(C_STANDARD) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||
COMPILE.cpp = $(CXX) $(CXX_STANDARD) $(CXXFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Special Built-in Target
|
||||
#----------------------------------------------------------------------
|
||||
# .SUFFIXES disable built-in wildcard rules
|
||||
# .INTERMEDIATE make will treat targets as intermediate files, and delete them
|
||||
# .PRECIOUS make will not be deleted after it is no longer needed. Keep objects to speed up recompilation
|
||||
# .PHONY make will run this targets unconditionally, regardless of whether a file with that name exists or what its last-modification time is
|
||||
#----------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
.INTERMEDIATE:
|
||||
.PRECIOUS: $(OBJS) $(DEPS)
|
||||
.PHONY: all clean help
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Targets
|
||||
#----------------------------------------------------------------------
|
||||
.PHONY: all
|
||||
.SILENT: $(OUTPUT)
|
||||
|
||||
all: $(OUTPUT)
|
||||
|
||||
$(OUTPUT): $(OBJS)
|
||||
@mkdir -p $(@D)
|
||||
$(LINK.o)
|
||||
$(SYMBOLS.out)
|
||||
|
||||
$(BUILD)/%.o: %.c
|
||||
@mkdir -p $(@D)
|
||||
$(COMPILE.c)
|
||||
|
||||
$(BUILD)/%.o: %.cpp
|
||||
@mkdir -p $(@D)
|
||||
$(COMPILE.cpp)
|
||||
|
||||
$(BUILD)/%.o: %.s
|
||||
@mkdir -p $(@D)
|
||||
$(COMPILE.s)
|
||||
|
||||
cppcheck: $(SOURCES)
|
||||
$(CPPCHECK) $(CHECKFLAGS) $^
|
||||
|
||||
run: $(OUTPUT)
|
||||
@$<
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@$(RM) -rf $(BUILD) $(OUTPUT)
|
||||
|
||||
help:
|
||||
@echo available targets: all run clean
|
||||
@echo $(OUTPUT)
|
||||
|
||||
-include $(DEPS)
|
||||
7578
lib_standalone/ArduinoJson.h
Normal file
7578
lib_standalone/ArduinoJson.h
Normal file
File diff suppressed because it is too large
Load Diff
54
lib_standalone/ModuleLibrary.h
Normal file
54
lib_standalone/ModuleLibrary.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* EMS-ESP - https://github.com/emsesp/EMS-ESP
|
||||
* Copyright 2020-2024 Paul Derbyshire
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MODULELIBRARY_H
|
||||
#define MODULELIBRARY_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <emsesp.h>
|
||||
|
||||
class ModuleLibrary {
|
||||
public:
|
||||
class Modules {
|
||||
public:
|
||||
Modules(const char * key, std::unique_ptr<Module> module)
|
||||
: key(key)
|
||||
, module(std::move(module)) {
|
||||
}
|
||||
const char * key;
|
||||
std::unique_ptr<Module> module;
|
||||
};
|
||||
|
||||
void start(emsesp::EMSESP * emsesp_main, bool test_mode = false) {};
|
||||
void loop() {};
|
||||
void list(JsonObject output) {};
|
||||
bool enable(const char * key, const char * license, bool enable) {
|
||||
return true;
|
||||
};
|
||||
|
||||
static uuid::log::Logger logger_;
|
||||
|
||||
private:
|
||||
std::vector<Modules> modules_;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -211,7 +211,7 @@ build_unflags = ${common.unbuild_flags}
|
||||
[env:native]
|
||||
platform = native
|
||||
build_flags =
|
||||
-DARDUINOJSON_ENABLE_ARDUINO_STRING=1
|
||||
-DARDUINOJSON_ENABLE_ARDUINO_STRING=1
|
||||
-DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST
|
||||
-DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.7.0-dev.0\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\"
|
||||
-std=gnu++14 -Og -ggdb
|
||||
@@ -219,7 +219,6 @@ build_src_flags =
|
||||
-Wall -Wextra -Werror
|
||||
-Wno-unused-parameter -Wno-sign-compare
|
||||
-I./lib_standalone
|
||||
-I./lib/ArduinoJson/src
|
||||
-I./lib/uuid-common/src
|
||||
-I./lib/uuid-console/src
|
||||
-I./lib/uuid-log/src
|
||||
@@ -240,3 +239,4 @@ build_src_filter =
|
||||
+<../lib/espMqttClient/src/Transport>
|
||||
lib_compat_mode = off
|
||||
lib_ldf_mode = off
|
||||
lib_ignore = ArduinoJson
|
||||
|
||||
@@ -1186,7 +1186,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
EMSESP::mqtt_.incoming("ems-esp/thermostat/mode/auto", "auto"); // invalid, not allowed
|
||||
|
||||
// check extended MQTT base
|
||||
Mqtt::base("home/cellar/heating");
|
||||
// Mqtt::base("home/cellar/heating");
|
||||
EMSESP::mqtt_.incoming("home/cellar/heating/thermostat/mode"); // empty payload
|
||||
|
||||
// Web API TESTS
|
||||
|
||||
Reference in New Issue
Block a user