Home | History | Annotate | Download | only in examples
      1 # Copyright 2015 The Weave Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 ###
      6 # examples
      7 
      8 examples_provider_obj_files := $(EXAMPLES_PROVIDER_SRC_FILES:%.cc=out/$(BUILD_MODE)/%.o)
      9 
     10 USE_INTERNAL_LIBEVHTP ?= 1
     11 
     12 ifeq (1, $(USE_INTERNAL_LIBEVHTP))
     13 $(examples_provider_obj_files) : third_party/include/evhtp.h
     14 endif
     15 
     16 $(examples_provider_obj_files) : out/$(BUILD_MODE)/%.o : %.cc
     17 	mkdir -p $(dir $@)
     18 	$(CXX) $(DEFS_$(BUILD_MODE)) $(INCLUDES) $(CFLAGS) $(CFLAGS_$(BUILD_MODE)) $(CFLAGS_CC) -c -o $@ $<
     19 
     20 out/$(BUILD_MODE)/examples_provider.a : $(examples_provider_obj_files)
     21 	rm -f $@
     22 	$(AR) crsT $@ $^
     23 
     24 EXAMPLES_DAEMON_SRC_FILES := \
     25 	examples/daemon/ledflasher/ledflasher.cc \
     26 	examples/daemon/light/light.cc \
     27 	examples/daemon/lock/lock.cc \
     28 	examples/daemon/oven/oven.cc \
     29 	examples/daemon/sample/sample.cc \
     30 	examples/daemon/speaker/speaker.cc
     31 
     32 examples_daemon_obj_files := $(EXAMPLES_DAEMON_SRC_FILES:%.cc=out/$(BUILD_MODE)/%.o)
     33 
     34 ifeq (1, $(USE_INTERNAL_LIBEVHTP))
     35 $(examples_daemon_obj_files) : third_party/include/evhtp.h
     36 endif
     37 
     38 $(examples_daemon_obj_files) : out/$(BUILD_MODE)/%.o : %.cc
     39 	mkdir -p $(dir $@)
     40 	$(CXX) $(DEFS_$(BUILD_MODE)) $(INCLUDES) $(CFLAGS) $(CFLAGS_$(BUILD_MODE)) $(CFLAGS_CC) -c -o $@ $<
     41 
     42 daemon_common_flags := \
     43 	-Wl,-rpath=out/$(BUILD_MODE)/ \
     44 	-Lthird_party/lib \
     45 	-levent \
     46 	-levent_openssl \
     47 	-lpthread \
     48 	-lavahi-common \
     49 	-lavahi-client \
     50 	-lexpat \
     51 	-lcurl \
     52 	-lssl \
     53 	-lcrypto
     54 
     55 daemon_deps := out/$(BUILD_MODE)/examples_provider.a out/$(BUILD_MODE)/libweave.so
     56 
     57 ifeq (1, $(USE_INTERNAL_LIBEVHTP))
     58 daemon_deps += third_party/lib/libevhtp.a
     59 else
     60 daemon_common_flags += -levhtp
     61 endif
     62 
     63 out/$(BUILD_MODE)/weave_daemon_ledflasher : out/$(BUILD_MODE)/examples/daemon/ledflasher/ledflasher.o $(daemon_deps)
     64 	$(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags)
     65 
     66 out/$(BUILD_MODE)/weave_daemon_light : out/$(BUILD_MODE)/examples/daemon/light/light.o $(daemon_deps)
     67 	$(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags)
     68 
     69 out/$(BUILD_MODE)/weave_daemon_lock : out/$(BUILD_MODE)/examples/daemon/lock/lock.o $(daemon_deps)
     70 	$(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags)
     71 
     72 out/$(BUILD_MODE)/weave_daemon_oven : out/$(BUILD_MODE)/examples/daemon/oven/oven.o $(daemon_deps)
     73 	$(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags)
     74 
     75 out/$(BUILD_MODE)/weave_daemon_sample : out/$(BUILD_MODE)/examples/daemon/sample/sample.o $(daemon_deps)
     76 	$(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags)
     77 
     78 out/$(BUILD_MODE)/weave_daemon_speaker : out/$(BUILD_MODE)/examples/daemon/speaker/speaker.o $(daemon_deps)
     79 	$(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags)
     80 
     81 all-examples : out/$(BUILD_MODE)/weave_daemon_ledflasher out/$(BUILD_MODE)/weave_daemon_light out/$(BUILD_MODE)/weave_daemon_lock out/$(BUILD_MODE)/weave_daemon_oven out/$(BUILD_MODE)/weave_daemon_sample out/$(BUILD_MODE)/weave_daemon_speaker
     82 
     83 .PHONY : all-examples
     84 
     85