OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 # | 4 # |
5 # Makefile for metrics utilities -- library, client and daemon | 5 # Makefile for metrics utilities -- library, client and daemon |
6 # | 6 # |
7 | 7 |
8 CCONFIG = $(shell $(PKG_CONFIG) --cflags dbus-1 glib-2.0 dbus-glib-1) | 8 CCONFIG = $(shell $(PKG_CONFIG) --cflags dbus-1 glib-2.0 dbus-glib-1) |
9 LDCONFIG = $(shell $(PKG_CONFIG) --libs dbus-1 glib-2.0 gthread-2.0 dbus-glib-1) | 9 LDCONFIG = $(shell $(PKG_CONFIG) --libs dbus-1 glib-2.0 gthread-2.0 dbus-glib-1) |
10 | 10 |
11 CXXFLAGS += -Wall -Werror -fPIC -fno-exceptions $(CCONFIG) | 11 CXXFLAGS += -Wall -Werror -fPIC -fno-exceptions $(CCONFIG) |
12 | 12 |
13 CLIENT = metrics_client | 13 CLIENT = metrics_client |
14 DAEMON = metrics_daemon | 14 DAEMON = metrics_daemon |
15 DAEMON_TEST = metrics_daemon_test | 15 DAEMON_TEST = metrics_daemon_test |
16 LIB = libmetrics.a | 16 LIB = libmetrics.a |
17 SHAREDLIB = libmetrics.so | 17 SHAREDLIB = libmetrics.so |
18 LIB_TEST = metrics_library_test | 18 LIB_TEST = metrics_library_test |
| 19 COUNTER_TEST = counter_test |
19 | 20 |
| 21 TESTCOUNTER_OBJS = \ |
| 22 counter.o \ |
| 23 counter_test.o |
20 CLIENT_OBJS = \ | 24 CLIENT_OBJS = \ |
21 metrics_client.o | 25 metrics_client.o |
| 26 DAEMON_OBJS = \ |
| 27 counter.o \ |
| 28 metrics_daemon.o \ |
| 29 metrics_daemon_main.o |
| 30 TESTDAEMON_OBJS = \ |
| 31 counter.o \ |
| 32 metrics_daemon.o \ |
| 33 metrics_daemon_test.o |
22 LIB_OBJS = \ | 34 LIB_OBJS = \ |
23 metrics_library.o | 35 metrics_library.o |
24 TESTLIB_OBJS = \ | 36 TESTLIB_OBJS = \ |
25 metrics_library.o \ | 37 metrics_library.o \ |
26 metrics_library_test.o | 38 metrics_library_test.o |
27 DAEMON_OBJS = \ | |
28 metrics_daemon.o \ | |
29 metrics_daemon_main.o | |
30 TESTDAEMON_OBJS = \ | |
31 metrics_daemon.o \ | |
32 metrics_daemon_test.o | |
33 | 39 |
| 40 TESTCOUNTER_LIBS = -lgmock -lgtest -lbase -lrt -lpthread |
34 DAEMON_LDFLAGS = $(LDFLAGS) $(LDCONFIG) -lrt -lbase -lpthread -lgflags | 41 DAEMON_LDFLAGS = $(LDFLAGS) $(LDCONFIG) -lrt -lbase -lpthread -lgflags |
35 TESTDAEMON_LIBS = -lgmock -lgtest | 42 TESTDAEMON_LIBS = -lgmock -lgtest |
36 TESTLIB_LIBS = -lgtest -lbase -lrt -lpthread | 43 TESTLIB_LIBS = -lgtest -lbase -lrt -lpthread |
37 | 44 |
38 all: $(LIB) $(SHAREDLIB) $(CLIENT) $(DAEMON) | 45 all: $(LIB) $(SHAREDLIB) $(CLIENT) $(DAEMON) |
39 | 46 |
40 tests: $(DAEMON_TEST) $(LIB_TEST) | 47 tests: $(COUNTER_TEST) $(DAEMON_TEST) $(LIB_TEST) |
41 | 48 |
42 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) | 49 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) |
43 $(CXX) $(LDFLAGS) $^ -o $@ | 50 $(CXX) $(LDFLAGS) $^ -o $@ |
44 | 51 |
| 52 $(COUNTER_TEST): $(TESTCOUNTER_OBJS) |
| 53 $(CXX) -o $@ $^ $(TESTCOUNTER_LIBS) |
| 54 |
45 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) | 55 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) |
46 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) | 56 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) |
47 | 57 |
48 $(DAEMON_TEST): $(TESTDAEMON_OBJS) | 58 $(DAEMON_TEST): $(TESTDAEMON_OBJS) |
49 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) | 59 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) |
50 | 60 |
51 $(LIB): $(LIB_OBJS) | 61 $(LIB): $(LIB_OBJS) |
52 $(AR) rcs $@ $^ | 62 $(AR) rcs $@ $^ |
53 | 63 |
54 $(SHAREDLIB): $(LIB_OBJS) | 64 $(SHAREDLIB): $(LIB_OBJS) |
(...skipping 11 matching lines...) Expand all Loading... |
66 metrics_daemon.h \ | 76 metrics_daemon.h \ |
67 network_states.h \ | 77 network_states.h \ |
68 power_states.h | 78 power_states.h |
69 metrics_daemon_test.o: \ | 79 metrics_daemon_test.o: \ |
70 metrics_daemon.h \ | 80 metrics_daemon.h \ |
71 network_states.h \ | 81 network_states.h \ |
72 power_states.h | 82 power_states.h |
73 | 83 |
74 clean: | 84 clean: |
75 rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) *.o | 85 rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) *.o |
76 » rm -f $(DAEMON_TEST) $(LIB_TEST) | 86 » rm -f $(COUNTER_TEST) $(DAEMON_TEST) $(LIB_TEST) |
OLD | NEW |