lib, eshi: move version string to evl_version
This commit is contained in:
parent
154e577193
commit
d9f26b70b0
|
@ -469,7 +469,7 @@ static void dump_gnuplot(time_t duration)
|
|||
|
||||
paste_file_in("/proc/version", NULL);
|
||||
paste_file_in("/proc/cmdline", NULL);
|
||||
fprintf(plot_fp, "# libevl version: %s\n", libevl_version_string);
|
||||
fprintf(plot_fp, "# libevl version: %s\n", evl_get_version().version_string);
|
||||
fprintf(plot_fp, "# sampling period: %u microseconds\n", period);
|
||||
paste_file_in("/sys/devices/virtual/clock/monotonic/gravity",
|
||||
"clock gravity: ");
|
||||
|
|
|
@ -14,10 +14,11 @@ PIC_OBJFILES = $(SRCFILES:%.c=$(O_DIR)/%-pic.o)
|
|||
OBJFILES = $(SRCFILES:%.c=$(O_DIR)/%.o)
|
||||
DEPFILES = $(SRCFILES:%.c=$(O_DIR)/%.d)
|
||||
|
||||
LIB_CPPFLAGS := $(BASE_CPPFLAGS) \
|
||||
-I. \
|
||||
-I../include/eshi \
|
||||
-I../include
|
||||
LIB_CPPFLAGS := $(BASE_CPPFLAGS) \
|
||||
-I. \
|
||||
-I../include/eshi \
|
||||
-I../include \
|
||||
-I$(O_DIR)
|
||||
|
||||
LIB_CFLAGS := $(LIB_CPPFLAGS) $(BASE_CFLAGS)
|
||||
|
||||
|
@ -34,7 +35,8 @@ install: all
|
|||
$(call inst-cmd,$(ARLIBNAME),$(INSTALL) -D $(O_DIR)/$(ARLIBNAME) $(DESTDIR)/$(libdir)/$(ARLIBNAME))
|
||||
|
||||
clean clobber mrproper: output-Makefile
|
||||
$(Q)$(RM) -f $(PIC_OBJFILES) $(OBJFILES) $(TARGETS) $(O_DIR)/$(DTSONAME) $(DEPFILES)
|
||||
$(Q)$(RM) -f $(O_DIR)/git-stamp.h $(PIC_OBJFILES) $(OBJFILES) \
|
||||
$(TARGETS) $(O_DIR)/$(DTSONAME) $(DEPFILES)
|
||||
|
||||
$(O_DIR)/$(SOLIBNAME): $(PIC_OBJFILES)
|
||||
$(call ld-cmd,$@,$(CC) -shared -Wl$(comma)-soname$(comma)$(DTSONAME) -o $(@) \
|
||||
|
@ -44,6 +46,9 @@ $(O_DIR)/$(SOLIBNAME): $(PIC_OBJFILES)
|
|||
$(O_DIR)/$(ARLIBNAME): $(OBJFILES)
|
||||
$(call ar-cmd,$@,$(AR) ru $@ $(OBJFILES))
|
||||
|
||||
$(O_DIR)/version-pic.o $(O_DIR)/version.o: override CFLAGS := $(CFLAGS) -DLIBSERIAL=\"$(EVL_SERIAL)\"
|
||||
version.c: $(O_DIR)/git-stamp.h
|
||||
|
||||
$(O_DIR)/%-pic.o: %.c
|
||||
$(call cc-pic-cmd,$@,$(CC) $(CFLAGS) -fPIC -c -o $@ $<)
|
||||
|
||||
|
|
|
@ -43,11 +43,3 @@ bool eshi_is_initialized(void)
|
|||
{
|
||||
return init_status == 0;
|
||||
}
|
||||
|
||||
struct evl_version evl_get_version(void)
|
||||
{
|
||||
return (struct evl_version){
|
||||
.api_level = __EVL__,
|
||||
.abi_level = -1,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright (C) 2018 Philippe Gerum <rpm@xenomai.org>
|
||||
*/
|
||||
|
||||
#include <evl/evl.h>
|
||||
#include "git-stamp.h"
|
||||
|
||||
#ifndef GIT_STAMP
|
||||
#define git_hash ""
|
||||
#else
|
||||
#define git_hash " -- " GIT_STAMP
|
||||
#endif
|
||||
|
||||
struct evl_version evl_get_version(void)
|
||||
{
|
||||
return (struct evl_version){
|
||||
.api_level = __EVL__,
|
||||
.abi_level = -1,
|
||||
.version_string = "eshi." LIBSERIAL git_hash,
|
||||
};
|
||||
}
|
|
@ -14,6 +14,7 @@
|
|||
struct evl_version {
|
||||
int api_level; /* libevl.so: __EVL__ */
|
||||
int abi_level; /* core: EVL_ABI_LEVEL, -1 for ESHI */
|
||||
const char *version_string;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
struct evl_version {
|
||||
int api_level; /* libevl.so: __EVL__ */
|
||||
int abi_level; /* core: EVL_ABI_LEVEL, -1 for ESHI */
|
||||
const char *version_string;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -39,8 +40,6 @@ void evl_sigdebug_handler(int sig, siginfo_t *si, void *ctxt);
|
|||
|
||||
unsigned int evl_detect_fpu(void);
|
||||
|
||||
extern const char *libevl_version_string;
|
||||
|
||||
struct evl_version evl_get_version(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
13
lib/Makefile
13
lib/Makefile
|
@ -52,19 +52,6 @@ $(O_DIR)/syscall-pic.o $(O_DIR)/syscall.o: override CFLAGS := $(CFLAGS) -fomit-f
|
|||
$(O_DIR)/version-pic.o $(O_DIR)/version.o: override CFLAGS := $(CFLAGS) -DLIBSERIAL=\"$(EVL_SERIAL)\"
|
||||
version.c: $(O_DIR)/git-stamp.h
|
||||
|
||||
$(O_DIR)/git-stamp.h: git-stamp
|
||||
@if test -r ../.git; then \
|
||||
stamp=`git --git-dir=../.git rev-list --abbrev-commit -1 HEAD`; \
|
||||
if test \! -s $@ || grep -wvq $$stamp $@; then \
|
||||
date=`git --git-dir=../.git log -1 $$stamp --pretty=format:%ci`; \
|
||||
echo "#define GIT_STAMP \"#$$stamp ($$date)\"" > $@; \
|
||||
fi; \
|
||||
elif test \! -r $@ -o -s $@; then \
|
||||
$(RM) -f $@ && touch $@; \
|
||||
fi; true
|
||||
|
||||
.PHONY: git-stamp
|
||||
|
||||
$(O_DIR)/%-pic.o: %.c
|
||||
$(call cc-pic-cmd,$@,$(CC) $(CFLAGS) -fPIC -c -o $@ $<)
|
||||
|
||||
|
|
|
@ -251,11 +251,3 @@ unsigned int evl_detect_fpu(void)
|
|||
|
||||
return core_info.fpu_features;
|
||||
}
|
||||
|
||||
struct evl_version evl_get_version(void)
|
||||
{
|
||||
return (struct evl_version){
|
||||
.api_level = __EVL__,
|
||||
.abi_level = EVL_ABI_LEVEL,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* Copyright (C) 2018 Philippe Gerum <rpm@xenomai.org>
|
||||
*/
|
||||
|
||||
#include <evl/evl.h>
|
||||
#include <uapi/evl/control.h>
|
||||
#include "git-stamp.h"
|
||||
|
||||
#ifndef GIT_STAMP
|
||||
|
@ -12,4 +14,11 @@
|
|||
#define git_hash " -- " GIT_STAMP
|
||||
#endif
|
||||
|
||||
const char *libevl_version_string = "evl." LIBSERIAL git_hash;
|
||||
struct evl_version evl_get_version(void)
|
||||
{
|
||||
return (struct evl_version){
|
||||
.api_level = __EVL__,
|
||||
.abi_level = EVL_ABI_LEVEL,
|
||||
.version_string = "evl." LIBSERIAL git_hash,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,3 +2,16 @@
|
|||
|
||||
EVL_SERIAL := 0
|
||||
EVL_IVERSION := 0
|
||||
|
||||
$(O_DIR)/git-stamp.h: git-stamp
|
||||
@if test -r ../.git; then \
|
||||
stamp=`git --git-dir=../.git rev-list --abbrev-commit -1 HEAD`; \
|
||||
if test \! -s $@ || grep -wvq $$stamp $@; then \
|
||||
date=`git --git-dir=../.git log -1 $$stamp --pretty=format:%ci`; \
|
||||
echo "#define GIT_STAMP \"#$$stamp ($$date)\"" > $@; \
|
||||
fi; \
|
||||
elif test \! -r $@ -o -s $@; then \
|
||||
$(RM) -f $@ && touch $@; \
|
||||
fi; true
|
||||
|
||||
.PHONY: git-stamp
|
||||
|
|
|
@ -77,7 +77,8 @@ int main(int argc, char *const argv[])
|
|||
cmddir = optarg;
|
||||
break;
|
||||
case 'V':
|
||||
printf("%s [ABI %d]\n", libevl_version_string,
|
||||
printf("%s [ABI %d]\n",
|
||||
evl_get_version().version_string,
|
||||
EVL_ABI_LEVEL);
|
||||
exit(0);
|
||||
case '?':
|
||||
|
|
Loading…
Reference in New Issue