mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-16 22:38:41 +08:00
move embedlog from system to logging
This commit is contained in:
1
logging/embedlog/.gitignore
vendored
Normal file
1
logging/embedlog/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/embedlog*
|
225
logging/embedlog/Kconfig
Normal file
225
logging/embedlog/Kconfig
Normal file
@@ -0,0 +1,225 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
menuconfig LOGGING_EMBEDLOG
|
||||
bool "embedlog library"
|
||||
default n
|
||||
---help---
|
||||
Highly configurable logger for embedded devices. Documentation and
|
||||
more info available on: https://embedlog.bofc.pl (don't worry,
|
||||
it's in english). Note: none of the options define how embedlog
|
||||
will behave, it will simply configure whether given feature can be
|
||||
enabled in runtime or no. So enabling CONFIG_EMBEDLOG_ENABLE_TIMESTAMP
|
||||
won't make logger to add timestamp to every message - you will have to
|
||||
also enable timestamp in runtime object. But when
|
||||
CONFIG_EMBEDLOG_ENABLE_TIMESTAMP is disabled, setting timestamp print
|
||||
in runtime will make no difference and timestamp still will not be
|
||||
printed.
|
||||
|
||||
Library is licensed under BSD 2-clause license. See LICENSE file in
|
||||
the downloaded code for license details
|
||||
|
||||
if LOGGING_EMBEDLOG
|
||||
|
||||
config EMBEDLOG_ENABLE_PTHREAD
|
||||
bool "Enable thread safety"
|
||||
depends on !DISABLE_PTHREAD
|
||||
default n
|
||||
---help---
|
||||
When enabled, you will be able to configure embedlog to use
|
||||
EL_THREAD_SAFE option, which will provide full thread safety in all
|
||||
circumstances. When printing to stdout or syslog, embedlog is
|
||||
half thread-safe. Buffer is allocated for each print call, so
|
||||
different calls will not interfere with each other, but once
|
||||
buffer is handed over to the kernel, logs might get mangled.
|
||||
To make sure this does not happen, enable this and enable
|
||||
EL_THREAD_SAFE option in runtime.
|
||||
|
||||
When multiple threads print to single file, this must be
|
||||
enabled, as there are global states in each 'el' object. If two
|
||||
'el' objects print into two separate files, you do not need
|
||||
thread safety.
|
||||
|
||||
comment "DISABLE_PTHREAD must be disabled to use thread safety"
|
||||
depends on DISABLE_PTHREAD
|
||||
|
||||
config EMBEDLOG_ENABLE_OUT_FILE
|
||||
bool "Enable logging to file"
|
||||
default n
|
||||
---help---
|
||||
If enabled, you will be able to store logs in a file (like on
|
||||
sdcard). Log rotation is available as well. Library automatically
|
||||
handles cases when files are deleted or mountpoint disappears and
|
||||
appear again (like sd card switch). Disabling this will result in
|
||||
smaller code.
|
||||
|
||||
if EMBEDLOG_ENABLE_OUT_FILE
|
||||
|
||||
config EMBEDLOG_ENABLE_BINARY_LOGS
|
||||
bool "Enable binary logs"
|
||||
default n
|
||||
---help---
|
||||
When enabled, you will be able to print binary data into file
|
||||
to save space (on block device). Note: you will not be able to
|
||||
read such logs with tools like 'less' or 'grep'. You will need to
|
||||
create own reader or use 'hexdump'.
|
||||
|
||||
endif
|
||||
|
||||
config EMBEDLOG_ENABLE_OUT_STDERR
|
||||
bool "Enable logging to standard error"
|
||||
default y
|
||||
---help---
|
||||
If enabled, you will be able to log messages to standard error (stderr)
|
||||
and/or standard output (stdout).
|
||||
|
||||
config EMBEDLOG_ENABLE_OUT_TTY
|
||||
bool "Enable printing to tty device"
|
||||
default y
|
||||
---help---
|
||||
If enabled, you will be able to configure logger to print directly
|
||||
to tty serial device (like /dev/ttyS1). This might be useful if you
|
||||
want to have nsh in one tty and logs on the other. This is suitable
|
||||
if only one task will be printing logs to one tty, if you want
|
||||
multiple tasks to print into one tty, it's better to enable syslog
|
||||
printing and the syslog handle it.
|
||||
|
||||
config EMBEDLOG_ENABLE_OUT_CUSTOM
|
||||
bool "Enable custom logging function"
|
||||
default n
|
||||
---help---
|
||||
When enabled, you will be able to define own function that accepts
|
||||
fully constructed log message as 'const char *'
|
||||
|
||||
config EMBEDLOG_ENABLE_TIMESTAMP
|
||||
bool "Enable timestamp in messages"
|
||||
default y
|
||||
---help---
|
||||
If enabled, you will be able to configure logger to add timestamp to
|
||||
every logged message.
|
||||
|
||||
if EMBEDLOG_ENABLE_TIMESTAMP
|
||||
|
||||
config EMBEDLOG_ENABLE_FRACTIONS
|
||||
bool "Enable fractions of seconds"
|
||||
default y
|
||||
---help---
|
||||
If enabled, you will be able to configure logger to add fractions of
|
||||
seconds to timestamp
|
||||
|
||||
endif
|
||||
|
||||
config EMBEDLOG_ENABLE_PREFIX
|
||||
bool "Enable prefix"
|
||||
default n
|
||||
---help---
|
||||
If enabled, you will be able to set prefix that will be added to
|
||||
each message logged by embedlog. Useful when multiple tasks print
|
||||
to one tty (via syslog) and you need an easy way to know which program
|
||||
printed given log message.
|
||||
|
||||
if EMBEDLOG_ENABLE_PREFIX
|
||||
|
||||
config EMBEDLOG_PREFIX_MAX
|
||||
int "Max prefix length"
|
||||
default 16
|
||||
---help---
|
||||
Maximum length of prefix that can be printed. If prefix exceeds this
|
||||
value it will be truncated.
|
||||
|
||||
endif # EMBEDLOG_ENABLE_PREFIX
|
||||
|
||||
config EMBEDLOG_ENABLE_FINFO
|
||||
bool "Enable file info"
|
||||
default y
|
||||
---help---
|
||||
If enabled, you will be able to turn on information about location
|
||||
of the log. This uses __FILE__ and __LINE__ macros.
|
||||
|
||||
if EMBEDLOG_ENABLE_FINFO
|
||||
|
||||
config EMBEDLOG_FLEN_MAX
|
||||
int "Max file name in finfo"
|
||||
default 16
|
||||
---help---
|
||||
finfo look like this
|
||||
|
||||
[filename.c:123]
|
||||
|
||||
this parameter defines how long "filename.c" can be, if file name
|
||||
exceeds this value it will be truncated.
|
||||
|
||||
config EMBEDLOG_ENABLE_FUNCINFO
|
||||
bool "Enable function info in log"
|
||||
default y
|
||||
---help---
|
||||
When enabled, embedlog can be configured to add information
|
||||
about function name from which log originated. This uses __func__
|
||||
macro, so you need compiler that supports that. This macro was
|
||||
introduced in c99 standard.
|
||||
|
||||
if EMBEDLOG_ENABLE_FUNCINFO
|
||||
|
||||
config EMBEDLOG_FUNCLEN_MAX
|
||||
int "Max length of function to print"
|
||||
default 16
|
||||
---help---
|
||||
Max length of function name to print. If function is longer than
|
||||
this value, it will be truncated. This directly impacts size of
|
||||
buffer for each 'el' object allocated.
|
||||
|
||||
endif # EMBEDLOG_ENABLE_FUNCINFO
|
||||
|
||||
endif # EMBEDLOG_ENABLE_FINFO
|
||||
|
||||
comment "Function info requires EMBEDLOG_ENABLE_FINFO"
|
||||
depends on !EMBEDLOG_ENABLE_FINFO
|
||||
|
||||
config EMBEDLOG_ENABLE_COLORS
|
||||
bool "Enable output colors"
|
||||
default n
|
||||
---help---
|
||||
If enabled, you will be able to turn on ANSI colors for messages
|
||||
with different log severities. Disabling this will result in smaller
|
||||
code.
|
||||
|
||||
config EMBEDLOG_LOG_MAX
|
||||
int "Max length of log message"
|
||||
default 128
|
||||
---help---
|
||||
Maximum length of single log message. This defines length of finall
|
||||
message, so message "foo() returned %s" may consume for example
|
||||
200 bytes since '%s' may be a long string. Metadata like timestamp
|
||||
or file info uses this space too. Output log will be truncated if
|
||||
it exceeds this value. Lowering/increasing will result in
|
||||
appropriate higher/lower stack usage.
|
||||
|
||||
config EMBEDLOG_MEM_LINE_SIZE
|
||||
int "Number of bytes in line"
|
||||
default 16
|
||||
---help---
|
||||
How many bytes of memory to print in a single line of el_pmemory call.
|
||||
Check https://embedlog.bofc.pl/manuals/el_pmemory.3.html
|
||||
for more information about this.
|
||||
|
||||
config EMBEDLOG_DEMO_PROGRAMS
|
||||
bool "Compile demo programs"
|
||||
default n
|
||||
---help---
|
||||
Compile demo programs that visualise how embedlog works. Also good
|
||||
for checking if embedlog behaves correctly.
|
||||
|
||||
if EMBEDLOG_DEMO_PROGRAMS
|
||||
|
||||
config EMBEDLOG_DEMO_PROGRAMS_PRIORITY
|
||||
int "embedlog demo programs task priority"
|
||||
default 100
|
||||
|
||||
config EMBEDLOG_DEMO_PROGRAMS_STACKSIZE
|
||||
int "embedlog demo programs stack size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
|
||||
endif # EMBEDLOG_DEMO_PROGRAMS
|
||||
endif # LOGGING_EMBEDLOG
|
23
logging/embedlog/Make.defs
Normal file
23
logging/embedlog/Make.defs
Normal file
@@ -0,0 +1,23 @@
|
||||
############################################################################
|
||||
# apps/logging/embedlog/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifneq ($(CONFIG_LOGGING_EMBEDLOG),)
|
||||
CONFIGURED_APPS += $(APPDIR)/logging/embedlog
|
||||
endif
|
250
logging/embedlog/Makefile
Normal file
250
logging/embedlog/Makefile
Normal file
@@ -0,0 +1,250 @@
|
||||
############################################################################
|
||||
# apps/logging/embedlog/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
CP = cp -R
|
||||
UNPACK = tar -xzf
|
||||
PACKEXT = .tar.gz
|
||||
NXTOOLSDIR = $(APPDIR)/tools
|
||||
|
||||
EMBEDLOG_URL = https://distfiles.bofc.pl/embedlog
|
||||
EMBEDLOG_VERSION = 0.6.0
|
||||
EMBEDLOG_SRC_SHA256 = f5f15dd124d113c7c8cc286f17fc633e1ade90acb6633dc98277968ab2a149d5
|
||||
EMBEDLOG_EXT = tar.gz
|
||||
EMBEDLOG_SOURCES = embedlog-$(EMBEDLOG_VERSION)
|
||||
EMBEDLOG_TARBALL = $(EMBEDLOG_SOURCES).$(EMBEDLOG_EXT)
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)include$(DELIM)logging
|
||||
|
||||
CSRCS = $(EMBEDLOG_SOURCES)/src/el-options.c \
|
||||
$(EMBEDLOG_SOURCES)/src/el-perror.c \
|
||||
$(EMBEDLOG_SOURCES)/src/el-pmemory.c \
|
||||
$(EMBEDLOG_SOURCES)/src/el-print.c \
|
||||
$(EMBEDLOG_SOURCES)/src/el-puts.c \
|
||||
$(EMBEDLOG_SOURCES)/src/el-ts.c \
|
||||
$(EMBEDLOG_SOURCES)/src/el-flush.c \
|
||||
$(EMBEDLOG_SOURCES)/src/el-utils.c \
|
||||
|
||||
# compile-time configuration of embedlog
|
||||
|
||||
ifeq ($(CONFIG_EMBEDLOG_ENABLE_TIMESTAMP),y)
|
||||
CFLAGS += -DENABLE_TIMESTAMP
|
||||
CFLAGS += -DENABLE_REALTIME
|
||||
CFLAGS += -DENABLE_MONOTONIC
|
||||
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_FUNCINFO),y)
|
||||
CFLAGS += -DENABLE_FUNCINFO
|
||||
CFLAGS += -DEL_FUNCLEN_MAX=$(CONFIG_EMBEDLOG_FUNCLEN_MAX)
|
||||
else
|
||||
CFLAGS += -DENABLE_FUNCINFO=0
|
||||
CFLAGS += -DEL_FUNCLEN_MAX=0
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EMBEDLOG_ENABLE_FINFO),y)
|
||||
CFLAGS += -DENABLE_FINFO
|
||||
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
|
||||
CSRCS += $(EMBEDLOG_SOURCES)/src/el-file.c
|
||||
else
|
||||
CFLAGS += -DENABLE_OUT_FILE=0
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EMBEDLOG_ENABLE_BINARY_LOGS),y)
|
||||
CFLAGS += -DENABLE_BINARY_LOGS
|
||||
CSRCS += $(EMBEDLOG_SOURCES)/src/el-pbinary.c
|
||||
CSRCS += $(EMBEDLOG_SOURCES)/src/el-encode-number.c
|
||||
CSRCS += $(EMBEDLOG_SOURCES)/src/el-decode-number.c
|
||||
else
|
||||
CFLAGS += -DENABLE_BINARY_LOGS=0
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EMBEDLOG_ENABLE_OUT_TTY),y)
|
||||
CFLAGS += -DENABLE_OUT_TTY
|
||||
CSRCS += $(EMBEDLOG_SOURCES)/src/el-tty.c
|
||||
else
|
||||
CFLAGS += -DENABLE_OUT_TTY=0
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EMBEDLOG_ENABLE_PTHREAD),y)
|
||||
CFLAGS += -DENABLE_PTHREAD
|
||||
CSRCS += $(EMBEDLOG_SOURCES)/src/el-lock.c
|
||||
else
|
||||
CFLAGS += -DENABLE_PTHREAD=0
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SERIAL_TERMIOS),y)
|
||||
CFLAGS += -DHAVE_TERMIOS_H
|
||||
else
|
||||
CFLAGS += -DHAVE_TERMIOS_H=0
|
||||
endif
|
||||
|
||||
CFLAGS += -DEL_LOG_MAX=$(CONFIG_EMBEDLOG_LOG_MAX)
|
||||
CFLAGS += -DEL_MEM_LINE_SIZE=$(CONFIG_EMBEDLOG_MEM_LINE_SIZE)
|
||||
|
||||
# config.h is available only when building with autotools
|
||||
CFLAGS += -DHAVE_CONFIG_H=0
|
||||
|
||||
# embedlog uses access(path, F_OK) to determine 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
|
||||
|
||||
# tell embedlog which features are available in nuttx os
|
||||
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
|
||||
# symlinks are only supported on pseudofs, where nobody is going to
|
||||
# store logfiles, thus symlinks are useless on nuttx
|
||||
CFLAGS += -DHAVE_SYMLINK=0
|
||||
|
||||
# nuttx has its own snprintf implementation, disable internal snprintf
|
||||
# implementation
|
||||
CFLAGS += -DPREFER_PORTABLE_SNPRINTF=0
|
||||
CFLAGS += -DNEED_SNPRINTF_ONLY=0
|
||||
CFLAGS += -DHAVE_SNPRINTF
|
||||
|
||||
# not yet implemented features - silent compiler warnings
|
||||
CFLAGS += -DENABLE_OUT_NET=0
|
||||
|
||||
# nuttx does not implement clock() function
|
||||
CFLAGS += -DENABLE_CLOCK=0
|
||||
|
||||
ifeq ($(CONFIG_EMBEDLOG_DEMO_PROGRAMS),y)
|
||||
# build demo programs as library instead of standalone programs
|
||||
CFLAGS += -DEMBEDLOG_DEMO_LIBRARY
|
||||
|
||||
PROGNAME = el_demo_print_memory
|
||||
PRIORITY = $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_PRIORITY)
|
||||
STACKSIZE = $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_STACKSIZE)
|
||||
MAINSRC = $(EMBEDLOG_SOURCES)/examples/print-memory.c
|
||||
|
||||
PROGNAME += el_demo_print_options
|
||||
PRIORITY += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_PRIORITY)
|
||||
STACKSIZE += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_STACKSIZE)
|
||||
MAINSRC += $(EMBEDLOG_SOURCES)/examples/print-options.c
|
||||
|
||||
PROGNAME += el_demo_print_simple
|
||||
PRIORITY += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_PRIORITY)
|
||||
STACKSIZE += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_STACKSIZE)
|
||||
MAINSRC += $(EMBEDLOG_SOURCES)/examples/print-simple.c
|
||||
|
||||
PROGNAME += el_demo_print_thread_safe
|
||||
PRIORITY += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_PRIORITY)
|
||||
STACKSIZE += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_STACKSIZE)
|
||||
MAINSRC += $(EMBEDLOG_SOURCES)/examples/print-thread-safe.c
|
||||
|
||||
PROGNAME += el_demo_print_to_file
|
||||
PRIORITY += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_PRIORITY)
|
||||
STACKSIZE += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_STACKSIZE)
|
||||
MAINSRC += $(EMBEDLOG_SOURCES)/examples/print-to-file.c
|
||||
|
||||
PROGNAME += el_demo_print_tty
|
||||
PRIORITY += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_PRIORITY)
|
||||
STACKSIZE += $(CONFIG_EMBEDLOG_DEMO_PROGRAMS_STACKSIZE)
|
||||
MAINSRC += $(EMBEDLOG_SOURCES)/examples/print-tty.c
|
||||
endif
|
||||
|
||||
# building of embedlog
|
||||
|
||||
# Download and unpack tarball if no git repo found
|
||||
ifeq ($(wildcard $(EMBEDLOG_SOURCES)/.git),)
|
||||
$(EMBEDLOG_TARBALL):
|
||||
@echo "Downloading: $@"
|
||||
$(Q) curl -L -o $@ $(EMBEDLOG_URL)/$@
|
||||
${Q} $(NXTOOLSDIR)/check-hash.sh sha256 $(EMBEDLOG_SRC_SHA256) $@
|
||||
|
||||
$(EMBEDLOG_SOURCES): $(EMBEDLOG_TARBALL)
|
||||
@echo "Unpacking $< -> $@"
|
||||
$(Q) $(call DELDIR, $@)
|
||||
$(Q) $(UNPACK) $<
|
||||
$(Q) touch $@
|
||||
endif
|
||||
|
||||
$(EMBEDLOG_SOURCES)/include/embedlog.h: $(EMBEDLOG_SOURCES)/include/embedlog.h.in
|
||||
@echo "Generating: $@"
|
||||
$(Q) sed -e "s/@ENABLE_OUT_FILE@/$(CONFIG_EMBEDLOG_ENABLE_OUT_FILE)/" \
|
||||
-e "s/@ENABLE_OUT_TTY@/$(CONFIG_EMBEDLOG_ENABLE_OUT_TTY)/" \
|
||||
-e "s/@ENABLE_PREFIX@/$(CONFIG_EMBEDLOG_ENABLE_PREFIX)/" \
|
||||
-e "s/@ENABLE_OUT_CUSTOM@/$(CONFIG_EMBEDLOG_ENABLE_OUT_CUSTOM)/" \
|
||||
-e "s/@ENABLE_PTHREAD@/$(CONFIG_EMBEDLOG_ENABLE_PTHREAD)/" \
|
||||
-e "s/^#if y$$/#if 1/" \
|
||||
-e "s/^#if $$/#if 0/" \
|
||||
-e "s/^#if n$$/#if 0/" $< > $@
|
||||
|
||||
create_includes: $(EMBEDLOG_SOURCES)/include/embedlog.h
|
||||
$(Q) $(CP) $< $(APPDIR)/include/logging
|
||||
|
||||
context:: $(EMBEDLOG_SOURCES)
|
||||
$(Q) $(MAKE) create_includes
|
||||
|
||||
clean::
|
||||
$(Q) $(call DELFILE, $(APPDIR)/include/logging/embedlog.h)
|
||||
$(Q) $(foreach COBJ, $(COBJS), $(call DELFILE, $(COBJ)))
|
||||
|
||||
distclean::
|
||||
$(Q) $(call DELDIR, $(EMBEDLOG_SOURCES))
|
||||
$(Q) $(call DELDIR, $(EMBEDLOG_TARBALL))
|
||||
|
||||
include $(APPDIR)/Application.mk
|
Reference in New Issue
Block a user