Fix build error on gcc version 7.x
[platform/upstream/iotivity.git] / examples / OICSensorBoard / Makefile
index ce6b173..21c9068 100644 (file)
@@ -1,16 +1,29 @@
-#Set the two variables below for the client build. 
-CLIENTARCH=x86
-BUILDTYPE=release
+default: all
+
+#Set the two variables below for the client build.
+CLIENTARCH?=x86
+BUILDTYPE?=release
 ##
 
 YOCTOCXXFLAGS=-I$(SDKTARGETSYSROOT)/usr/include/iotivity/resource/ -I$(SDKTARGETSYSROOT)/usr/include/iotivity/resource/stack -I$(SDKTARGETSYSROOT)/usr/include/iotivity/resource/ocrandom -I$(SDKTARGETSYSROOT)/usr/include/iotivity/resource/logger -I$(SDKTARGETSYSROOT)/usr/include/iotivity/resource/oc_logger
 
 YOCTOLDFLAGS=-loc -loctbstack -loc_logger -lmraa
 
-CXXFLAGS=-I../../resource/include -I../../resource/csdk/stack/include -I../../resource/csdk/ocrandom/include -I../../resource/csdk/logger/include -I../../resource/oc_logger/include
+CXXFLAGS=-I../../resource/include -I../../resource/c_common -I../../resource/csdk/stack/include -I../../resource/c_common/ocrandom/include -I../../resource/csdk/logger/include -I../../resource/oc_logger/include
 
 LDFLAGS=-L../../out/linux/$(CLIENTARCH)/$(BUILDTYPE) -loc -loctbstack -loc_logger
 
+install_dir?=${DESTDIR}/usr/lib/iotivity/examples/OICSensorBoard
+
+exes?=client
+ifneq ($(SDKTARGETSYSROOT),)
+exes+=server
+endif
+
+
+all: client
+       @echo "server depends on mraa"
+
 client: client.o
        g++ -o client client.o $(LDFLAGS)
 
@@ -23,7 +36,7 @@ observer.o: observer.cpp
 server.o: server.cpp
 ifeq ($(SDKTARGETSYSROOT),)
        echo "Error: Yocto cross-toolchain environment not initialized"
-       exit 1 
+       exit 1
 endif
        $(CXX) -std=c++0x -c -o $@ $< $(YOCTOCXXFLAGS)
 
@@ -32,3 +45,7 @@ server: server.o observer.o
 
 clean:
        rm -rf server client *.o
+
+install: ${exes}
+       install -d ${install_dir}
+       install $^ ${install_dir}