From: Urban Wallasch Date: Tue, 30 Jul 2019 16:25:50 +0000 (+0200) Subject: * Fixed some uncritical stuff in Makefile and some header files. X-Git-Tag: v0.1.0~51 X-Git-Url: https://git.packet-gain.de/?a=commitdiff_plain;h=a82d105e0ea685f651cd7bee995ffdeb464b6f27;p=ets2_tele.git * Fixed some uncritical stuff in Makefile and some header files. --- diff --git a/Makefile b/Makefile index b3b391e..2756cf5 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ SDK_INCLUDES=\ -Isdk/include/eurotrucks2 CFLAGS=-Wall -Wextra -std=c99 -O2 -DDEBUG -I. -CPPFLAGS=-Wall -O2 -DLOGGING -I. +CXXFLAGS=-Wall -O2 -DLOGGING -I. UNAME:= $(shell uname -s) @@ -24,20 +24,23 @@ else LIB_NAME_OPTION=-soname endif +COMMON_HDR := telemetry.h PLUGIN_SRC := teleshmem.cpp shmget.c +HTTPD_OBJ := telehttpd.o shmget.o net.o fserv.o +LOGGER_OBJ := telelogger.o shmget.o .PHONY: all clean all: telehttpd telelogger teleshmem.so -teleshmem.so: $(PLUGIN_SRC) $(SDK_HEADERS) - g++ -o $@ $(CPPFLAGS) -fPIC --shared -Wl,$(LIB_NAME_OPTION),$@ $(SDK_INCLUDES) $(PLUGIN_SRC) +teleshmem.so: $(PLUGIN_SRC) $(COMMON_HDR) $(SDK_HEADERS) $(SELF) + $(CXX) -o $@ $(CXXFLAGS) -fPIC --shared -Wl,$(LIB_NAME_OPTION),$@ $(SDK_INCLUDES) $(PLUGIN_SRC) -telehttpd: telehttpd.o shmget.o net.o fserv.o - $(CC) $(LDFLAGS) -o $@ -pthread $^ +telehttpd: $(HTTPD_OBJ) $(COMMON_HDR) $(SELF) + $(CC) $(LDFLAGS) -o $@ -pthread $(HTTPD_OBJ) -telelogger: telelogger.o shmget.o - $(CC) $(LDFLAGS) -o $@ $^ +telelogger: $(LOGGER_OBJ) $(COMMON_HDR) $(SELF) + $(CC) $(LDFLAGS) -o $@ $(LOGGER_OBJ) %.o: %.c $(SELF) $(CC) -c $(CFLAGS) -o $*.o $*.c diff --git a/log.h b/log.h index 9b27875..d6398db 100644 --- a/log.h +++ b/log.h @@ -8,15 +8,25 @@ #ifndef LOG_H_ #define LOG_H_ -#ifdef DEBUG +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if defined DEBUG && !defined __cplusplus #define EPRINT(fmt, ...) do { fprintf( stderr, "%s:%s:%d:"fmt, __FILE__, __FUNCTION__, __LINE__ , ##__VA_ARGS__ ); } while (0) #define DPRINT(...) EPRINT(__VA_ARGS__) - #define WHOAMI DPRINT("\n"); + #define WHOAMI DPRINT("\n") #else #define EPRINT(fmt, ...) do { fprintf( stderr, fmt, ##__VA_ARGS__ ); } while (0) #define DPRINT(...) - #define WHOAMI + #define WHOAMI #endif +#ifdef __cplusplus +} +#endif #endif /* LOG_H_ */ + diff --git a/telemetry.h b/telemetry.h index e29db93..f885996 100644 --- a/telemetry.h +++ b/telemetry.h @@ -1,6 +1,9 @@ #ifndef TELEMETRY_H_ #define TELEMETRY_H_ +#include +#include + #define TELE_SHM_KEY 0xecc11 struct telemetry_state_t {