diff options
author | Mike Frysinger <vapier@google.com> | 2016-04-06 16:44:18 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2016-04-06 20:56:26 +0000 |
commit | eae016cab6044d22b150afdf6f3f3cb5cc1c79fd (patch) | |
tree | 4438d6047ceeb857f9126cc1f096ee88d670c268 | |
parent | fcffce31f3c6f7594b0790f92d4e042aa489d42f (diff) | |
download | libweave-eae016cab6044d22b150afdf6f3f3cb5cc1c79fd.tar.gz |
clean up example/test_device clashes
Move the duplicated libevhtp logic to third_party.mk so that multiple
targets can rely on it being set up in the same way.
Delete the duplicate example object rules from tests_schema.mk. We
already include examples.mk before tests_schema.mk, so we know those
rules are defined for us. We just need to depend on the output libs.
Finally namespace the daemon variables in examples & tests_schema so
they don't stop on each other in weird ways.
Change-Id: I28fa152d8c8a30c84f7095e335e31a52889b5682
Reviewed-on: https://weave-review.googlesource.com/3152
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
-rw-r--r-- | examples/examples.mk | 42 | ||||
-rw-r--r-- | tests_schema/tests_schema.mk | 36 | ||||
-rw-r--r-- | third_party/third_party.mk | 11 |
3 files changed, 34 insertions, 55 deletions
diff --git a/examples/examples.mk b/examples/examples.mk index 48a1210..555322c 100644 --- a/examples/examples.mk +++ b/examples/examples.mk @@ -7,16 +7,6 @@ examples_provider_obj_files := $(EXAMPLES_PROVIDER_SRC_FILES:%.cc=out/$(BUILD_MODE)/%.o) -USE_INTERNAL_LIBEVHTP ?= 1 - -ifeq (1, $(USE_INTERNAL_LIBEVHTP)) -LIBEVHTP_INCLUDES = -Ithird_party/libevhtp -I$(dir $(third_party_libevhtp_header)) -LIBEVHTP_HEADERS = $(third_party_libevhtp_header) -else -LIBEVHTP_INCLUDES = -LIBEVHTP_HEADERS = -endif - $(examples_provider_obj_files) : $(LIBEVHTP_HEADERS) $(examples_provider_obj_files) : INCLUDES += $(LIBEVHTP_INCLUDES) $(examples_provider_obj_files) : out/$(BUILD_MODE)/%.o : %.cc @@ -43,7 +33,7 @@ $(examples_daemon_obj_files) : out/$(BUILD_MODE)/%.o : %.cc mkdir -p $(dir $@) $(CXX) $(DEFS_$(BUILD_MODE)) $(INCLUDES) $(CFLAGS) $(CFLAGS_$(BUILD_MODE)) $(CFLAGS_CC) -c -o $@ $< -daemon_common_flags := \ +example_daemon_common_flags := \ -Wl,-rpath=out/$(BUILD_MODE)/ \ -levent \ -levent_openssl \ @@ -55,31 +45,31 @@ daemon_common_flags := \ -lssl \ -lcrypto -daemon_deps := out/$(BUILD_MODE)/examples_provider.a out/$(BUILD_MODE)/libweave.so +example_daemon_deps := out/$(BUILD_MODE)/examples_provider.a out/$(BUILD_MODE)/libweave.so ifeq (1, $(USE_INTERNAL_LIBEVHTP)) -daemon_deps += $(third_party_libevhtp_lib) +example_daemon_deps += $(third_party_libevhtp_lib) else -daemon_common_flags += -levhtp +example_daemon_common_flags += -levhtp endif -out/$(BUILD_MODE)/weave_daemon_ledflasher : out/$(BUILD_MODE)/examples/daemon/ledflasher/ledflasher.o $(daemon_deps) - $(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags) +out/$(BUILD_MODE)/weave_daemon_ledflasher : out/$(BUILD_MODE)/examples/daemon/ledflasher/ledflasher.o $(example_daemon_deps) + $(CXX) -o $@ $^ $(CFLAGS) $(example_daemon_common_flags) -out/$(BUILD_MODE)/weave_daemon_light : out/$(BUILD_MODE)/examples/daemon/light/light.o $(daemon_deps) - $(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags) +out/$(BUILD_MODE)/weave_daemon_light : out/$(BUILD_MODE)/examples/daemon/light/light.o $(example_daemon_deps) + $(CXX) -o $@ $^ $(CFLAGS) $(example_daemon_common_flags) -out/$(BUILD_MODE)/weave_daemon_lock : out/$(BUILD_MODE)/examples/daemon/lock/lock.o $(daemon_deps) - $(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags) +out/$(BUILD_MODE)/weave_daemon_lock : out/$(BUILD_MODE)/examples/daemon/lock/lock.o $(example_daemon_deps) + $(CXX) -o $@ $^ $(CFLAGS) $(example_daemon_common_flags) -out/$(BUILD_MODE)/weave_daemon_oven : out/$(BUILD_MODE)/examples/daemon/oven/oven.o $(daemon_deps) - $(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags) +out/$(BUILD_MODE)/weave_daemon_oven : out/$(BUILD_MODE)/examples/daemon/oven/oven.o $(example_daemon_deps) + $(CXX) -o $@ $^ $(CFLAGS) $(example_daemon_common_flags) -out/$(BUILD_MODE)/weave_daemon_sample : out/$(BUILD_MODE)/examples/daemon/sample/sample.o $(daemon_deps) - $(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags) +out/$(BUILD_MODE)/weave_daemon_sample : out/$(BUILD_MODE)/examples/daemon/sample/sample.o $(example_daemon_deps) + $(CXX) -o $@ $^ $(CFLAGS) $(example_daemon_common_flags) -out/$(BUILD_MODE)/weave_daemon_speaker : out/$(BUILD_MODE)/examples/daemon/speaker/speaker.o $(daemon_deps) - $(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags) +out/$(BUILD_MODE)/weave_daemon_speaker : out/$(BUILD_MODE)/examples/daemon/speaker/speaker.o $(example_daemon_deps) + $(CXX) -o $@ $^ $(CFLAGS) $(example_daemon_common_flags) 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 diff --git a/tests_schema/tests_schema.mk b/tests_schema/tests_schema.mk index 19bdb26..73dfefd 100644 --- a/tests_schema/tests_schema.mk +++ b/tests_schema/tests_schema.mk @@ -3,29 +3,7 @@ # found in the LICENSE file. ### -# examples - -tests_schema_provider_obj_files := $(EXAMPLES_PROVIDER_SRC_FILES:%.cc=out/$(BUILD_MODE)/%.o) - -USE_INTERNAL_LIBEVHTP ?= 1 - -ifeq (1, $(USE_INTERNAL_LIBEVHTP)) -LIBEVHTP_INCLUDES = -Ithird_party/libevhtp -I$(dir $(third_party_libevhtp_header)) -LIBEVHTP_HEADERS = $(third_party_libevhtp_header) -else -LIBEVHTP_INCLUDES = -LIBEVHTP_HEADERS = -endif - -$(tests_schema_provider_obj_files) : $(LIBEVHTP_HEADERS) -$(tests_schema_provider_obj_files) : INCLUDES += $(LIBEVHTP_INCLUDES) -$(tests_schema_provider_obj_files) : out/$(BUILD_MODE)/%.o : %.cc - mkdir -p $(dir $@) - $(CXX) $(DEFS_$(BUILD_MODE)) $(INCLUDES) $(CFLAGS) $(CFLAGS_$(BUILD_MODE)) $(CFLAGS_CC) -c -o $@ $< - -out/$(BUILD_MODE)/examples_provider.a : $(tests_schema_provider_obj_files) - rm -f $@ - $(AR) crsT $@ $^ +# test_schema TESTS_SCHEMA_DAEMON_SRC_FILES := \ tests_schema/daemon/testdevice/testdevice.cc @@ -38,7 +16,7 @@ $(tests_schema_daemon_obj_files) : out/$(BUILD_MODE)/%.o : %.cc mkdir -p $(dir $@) $(CXX) $(DEFS_$(BUILD_MODE)) $(INCLUDES) $(CFLAGS) $(CFLAGS_$(BUILD_MODE)) $(CFLAGS_CC) -c -o $@ $< -daemon_common_flags := \ +tests_schema_daemon_common_flags := \ -Wl,-rpath=out/$(BUILD_MODE)/ \ -levent \ -levent_openssl \ @@ -50,16 +28,16 @@ daemon_common_flags := \ -lssl \ -lcrypto -daemon_deps := out/$(BUILD_MODE)/examples_provider.a out/$(BUILD_MODE)/libweave.so +tests_schema_daemon_deps := out/$(BUILD_MODE)/examples_provider.a out/$(BUILD_MODE)/libweave.so ifeq (1, $(USE_INTERNAL_LIBEVHTP)) -daemon_deps += $(third_party_libevhtp_lib) +tests_schema_daemon_deps += $(third_party_libevhtp_lib) else -daemon_common_flags += -levhtp +tests_schema_daemon_common_flags += -levhtp endif -out/$(BUILD_MODE)/weave_daemon_testdevice : out/$(BUILD_MODE)/tests_schema/daemon/testdevice/testdevice.o $(daemon_deps) - $(CXX) -o $@ $^ $(CFLAGS) $(daemon_common_flags) +out/$(BUILD_MODE)/weave_daemon_testdevice : out/$(BUILD_MODE)/tests_schema/daemon/testdevice/testdevice.o $(tests_schema_daemon_deps) + $(CXX) -o $@ $^ $(CFLAGS) $(tests_schema_daemon_common_flags) all-testdevices : out/$(BUILD_MODE)/weave_daemon_testdevice diff --git a/third_party/third_party.mk b/third_party/third_party.mk index 18f9b98..e1da63c 100644 --- a/third_party/third_party.mk +++ b/third_party/third_party.mk @@ -94,3 +94,14 @@ $(third_party_libevhtp_lib) : $(third_party_libevhtp_header) clean-libevhtp : rm -rf $(third_party_libevhtp) + +# These settings are exported for other code to use as needed. +USE_INTERNAL_LIBEVHTP ?= 1 + +ifeq (1, $(USE_INTERNAL_LIBEVHTP)) +LIBEVHTP_INCLUDES = -Ithird_party/libevhtp -I$(dir $(third_party_libevhtp_header)) +LIBEVHTP_HEADERS = $(third_party_libevhtp_header) +else +LIBEVHTP_INCLUDES = +LIBEVHTP_HEADERS = +endif |