Makefile 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #! /usr/bin/make -f
  2. # //******************************************************************
  3. # //
  4. # // Copyright 2014 Intel Corporation.
  5. # // Copyright 2015 Eurogiciel <philippe.coval@eurogiciel.fr>
  6. # // Copyright 2016 Samsung <philippe.coval@osg.samsung.com>
  7. # //
  8. # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  9. # //
  10. # // Licensed under the Apache License, Version 2.0 (the "License");
  11. # // you may not use this file except in compliance with the License.
  12. # // You may obtain a copy of the License at
  13. # //
  14. # // http://www.apache.org/licenses/LICENSE-2.0
  15. # //
  16. # // Unless required by applicable law or agreed to in writing, software
  17. # // distributed under the License is distributed on an "AS IS" BASIS,
  18. # // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. # // See the License for the specific language governing permissions and
  20. # // limitations under the License.
  21. # //
  22. # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. default: all
  24. package?=iotivity-example
  25. config_mraa?=1
  26. DEST_LIB_DIR?=${DESTDIR}${local_optdir}/${package}/
  27. local_bindir?=bin
  28. local_bindir?=opt
  29. vpath+=src
  30. VPATH+=src
  31. CPPFLAGS=-I. \
  32. -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity \
  33. -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/ \
  34. -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/c_common \
  35. -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/oc_logger/ \
  36. -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/iotivity/resource/stack/
  37. CXXFLAGS+=-std=gnu++0x
  38. LIBS+= -loc -loc_logger -loctbstack
  39. srcs?=config.cpp
  40. objs?=${srcs:.cpp=.o}
  41. client?=${local_bindir}/client
  42. server_objs?=sensors.o
  43. server?=${local_bindir}/server
  44. observer?=${local_bindir}/observer
  45. all?=${client} ${observer}
  46. ifeq (${config_mraa},1)
  47. LIBS+=-lmraa
  48. all+=${server}
  49. ${local_bindir}/server: server.o ${server_objs} ${objs}
  50. @-mkdir -p ${@D}
  51. ${CXX} -o ${@} $^ ${LDFLAGS} ${LIBS}
  52. endif
  53. all: ${all}
  54. ${local_bindir}/%: %.o ${objs}
  55. @-mkdir -p ${@D}
  56. ${CXX} -o ${@} $^ ${LDFLAGS} ${LIBS}
  57. run: ${client}
  58. ${<D}/${<F}
  59. clean:
  60. rm -f *.o *~ ${objs} */*.o
  61. distclean: clean
  62. rm -f ${client} ${server}
  63. install: ${all}
  64. install -d ${DEST_LIB_DIR}
  65. install $^ ${DEST_LIB_DIR}