2018-05-06 23:34:45 +02:00
|
|
|
############################################################################
|
|
|
|
# apps/system/embedlog/Makefile
|
|
|
|
#
|
|
|
|
# Copyright (C) Michał Łyszczek. All rights reserved.
|
|
|
|
# Author: Michał Łyszczek <michal.lyszczek@bofc.pl>
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
|
|
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
# used to endorse or promote products derived from this software
|
|
|
|
# without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
-include $(TOPDIR)/Make.defs
|
|
|
|
|
|
|
|
WGET = wget
|
|
|
|
CP = cp -R
|
|
|
|
UNPACK = tar -xzf
|
|
|
|
PACKEXT = .tar.gz
|
2019-02-15 14:15:24 +01:00
|
|
|
NXTOOLSDIR = $(APPDIR)/tools
|
2018-05-06 23:34:45 +02:00
|
|
|
|
|
|
|
EMBEDLOG_URL = https://distfiles.kurwinet.pl/embedlog
|
2019-02-15 14:15:24 +01:00
|
|
|
EMBEDLOG_VERSION = 0.4.0
|
|
|
|
EMBEDLOG_SRC_SHA256 = 832c50e0f99d730bed25caed1c4745eca02882a9204c6ad41f715a269293c5a8
|
2018-05-06 23:34:45 +02:00
|
|
|
EMBEDLOG_EXT = tar.gz
|
|
|
|
EMBEDLOG_SOURCES = embedlog-$(EMBEDLOG_VERSION)
|
|
|
|
EMBEDLOG_TARBALL = $(EMBEDLOG_SOURCES).$(EMBEDLOG_EXT)
|
|
|
|
|
|
|
|
CFLAGS += -I$(APPDIR)/include/system
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS = embedlog/src/el-options.c \
|
2018-05-06 23:34:45 +02:00
|
|
|
embedlog/src/el-perror.c \
|
|
|
|
embedlog/src/el-pmemory.c \
|
|
|
|
embedlog/src/el-print.c \
|
|
|
|
embedlog/src/el-puts.c \
|
|
|
|
embedlog/src/el-ts.c
|
|
|
|
|
|
|
|
# compile-time configuration of embedlog
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_TIMESTAMP),y)
|
|
|
|
CFLAGS += -DENABLE_TIMESTAMP
|
|
|
|
CFLAGS += -DENABLE_REALTIME
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_CLOCK_MONOTONIC),y)
|
|
|
|
CFLAGS += -DENABLE_MONOTONIC
|
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_MONOTONIC=0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_FRACTIONS),y)
|
|
|
|
CFLAGS += -DENABLE_FRACTIONS
|
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_FRACTIONS=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_COLORS),y)
|
|
|
|
CFLAGS += -DENABLE_COLORS
|
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_COLORS=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_PREFIX),y)
|
|
|
|
CFLAGS += -DENABLE_PREFIX
|
|
|
|
CFLAGS += -DEL_PREFIX_MAX=$(CONFIG_EMBEDLOG_PREFIX_MAX)
|
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_PREFIX=0
|
|
|
|
CFLAGS += -DEL_PREFIX_MAX=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_FINFO),y)
|
|
|
|
CFLAGS += -DENABLE_FINFO
|
|
|
|
CFLAGS += -DNOFINFO=0
|
|
|
|
CFLAGS += -DEL_FLEN_MAX=$(CONFIG_EMBEDLOG_FLEN_MAX)
|
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_FINFO=0
|
|
|
|
CFLAGS += -DNOFINFO
|
|
|
|
CFLAGS += -DEL_FLEN_MAX=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_OUT_CUSTOM),y)
|
|
|
|
CFLAGS += -DENABLE_OUT_CUSTOM
|
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_OUT_CUSTOM=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_OUT_STDERR),y)
|
|
|
|
CFLAGS += -DENABLE_OUT_STDERR
|
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_OUT_STDERR=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_OUT_FILE),y)
|
|
|
|
CFLAGS += -DENABLE_OUT_FILE
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += embedlog/src/el-file.c
|
2018-05-06 23:34:45 +02:00
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_OUT_FILE=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_BINARY_LOGS),y)
|
|
|
|
CFLAGS += -DENABLE_BINARY_LOGS
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += embedlog/src/el-pbinary.c
|
|
|
|
CSRCS += embedlog/src/el-encode-number.c
|
2018-05-06 23:34:45 +02:00
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_BINARY_LOGS=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EMBEDLOG_ENABLE_OUT_TTY),y)
|
|
|
|
CFLAGS += -DENABLE_OUT_TTY
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += embedlog/src/el-tty.c
|
2018-05-06 23:34:45 +02:00
|
|
|
else
|
|
|
|
CFLAGS += -DENABLE_OUT_TTY=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_SERIAL_TERMIOS),y)
|
|
|
|
CFLAGS += -DHAVE_TERMIOS_H
|
|
|
|
else
|
|
|
|
CFLAGS += -DHAVE_TERMIOS_H=0
|
|
|
|
endif
|
|
|
|
|
2019-02-15 14:15:24 +01:00
|
|
|
CFLAGS += -DEL_LOG_MAX=$(CONFIG_EMBEDLOG_LOG_MAX)
|
|
|
|
CFLAGS += -DEL_MEM_LINE_SIZE=$(CONFIG_EMBEDLOG_MEM_LINE_SIZE)
|
2018-05-06 23:34:45 +02:00
|
|
|
|
2019-02-15 14:15:24 +01:00
|
|
|
# config.h is available only when building with autotools
|
2018-05-06 23:34:45 +02:00
|
|
|
CFLAGS += -DHAVE_CONFIG_H=0
|
|
|
|
|
|
|
|
# embedlog uses access(path, F_OK) to determin if file exists or not and since
|
|
|
|
# nuttx always returns OK here, we mark access as not working and make embedlog
|
|
|
|
# to use stat() for that purpose
|
|
|
|
CFLAGS += -DHAVE_ACCESS=0
|
2019-02-15 14:15:24 +01:00
|
|
|
|
|
|
|
# tell embedlog which features are available in nuttx os
|
2018-05-06 23:34:45 +02:00
|
|
|
CFLAGS += -DENABLE_REENTRANT
|
|
|
|
CFLAGS += -DENABLE_OUT_SYSLOG
|
|
|
|
CFLAGS += -DHAVE_STAT
|
|
|
|
CFLAGS += -DHAVE_UNISTD_H
|
|
|
|
CFLAGS += -DHAVE_FSYNC
|
|
|
|
CFLAGS += -DHAVE_FILENO
|
|
|
|
CFLAGS += -DENABLE_COLORS_EXTENDED=0
|
|
|
|
|
2019-02-15 14:15:24 +01:00
|
|
|
# nuttx has its own snprintf implementation, disable internal snprintf
|
|
|
|
# implementation
|
|
|
|
CFLAGS += -DPREFER_PORTABLE_SNPRINTF=0
|
|
|
|
CFLAGS += -DNEED_SNPRINTF_ONLY=0
|
|
|
|
CFLAGS += -DHAVE_SNPRINTF
|
2018-05-06 23:34:45 +02:00
|
|
|
|
2019-02-15 14:15:24 +01:00
|
|
|
# not yet implemented features - silent compiler warnings
|
2018-05-06 23:34:45 +02:00
|
|
|
CFLAGS += -DENABLE_OUT_NET=0
|
|
|
|
|
|
|
|
# nuttx does not implement clock() function
|
|
|
|
CFLAGS += -DENABLE_CLOCK=0
|
|
|
|
|
|
|
|
# building of embedlog
|
|
|
|
|
|
|
|
$(EMBEDLOG_TARBALL):
|
|
|
|
@echo "Downloading: $@"
|
|
|
|
$(Q) $(WGET) -O $@ $(EMBEDLOG_URL)/$@
|
2019-02-15 14:15:24 +01:00
|
|
|
${Q} $(NXTOOLSDIR)/check-hash.sh sha256 $(EMBEDLOG_SRC_SHA256) $@
|
2018-05-06 23:34:45 +02:00
|
|
|
$(Q) touch $@
|
|
|
|
|
|
|
|
$(EMBEDLOG_SOURCES): $(EMBEDLOG_TARBALL)
|
|
|
|
@echo "Unpacking $< -> $@"
|
|
|
|
$(Q) $(call DELDIR, $@)
|
|
|
|
$(Q) $(UNPACK) $<
|
|
|
|
$(Q) touch $@
|
|
|
|
|
|
|
|
embedlog: $(EMBEDLOG_SOURCES)
|
|
|
|
$(call DELDIR, $@)
|
|
|
|
$(Q) $(CP) $< $@
|
|
|
|
$(Q) touch $@
|
|
|
|
|
|
|
|
create_includes:
|
|
|
|
$(Q) $(CP) $(EMBEDLOG_SOURCES)/include/embedlog.h $(APPDIR)/include/system
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
context:: embedlog
|
2018-05-06 23:34:45 +02:00
|
|
|
$(Q) $(MAKE) create_includes
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
clean::
|
2018-05-06 23:34:45 +02:00
|
|
|
$(Q) $(call DELFILE, $(APPDIR)/include/system/embedlog.h)
|
|
|
|
$(Q) $(foreach COBJ, $(COBJS), $(call DELFILE, $(COBJ)))
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
distclean::
|
2018-05-06 23:34:45 +02:00
|
|
|
$(Q) $(call DELDIR, embedlog)
|
|
|
|
$(Q) $(call DELDIR, $(EMBEDLOG_SOURCES))
|
|
|
|
$(Q) $(call DELDIR, $(EMBEDLOG_TARBALL))
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
include $(APPDIR)/Application.mk
|
2019-04-05 02:53:29 +02:00
|
|
|
|