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 TESTDAEMON = test_daemon | 15 DAEMON_TEST = metrics_daemon_test |
16 LIB = libmetrics.a | 16 LIB = libmetrics.a |
17 SHAREDLIB = libmetrics.so | 17 SHAREDLIB = libmetrics.so |
18 | 18 |
19 CLIENT_OBJS = \ | 19 CLIENT_OBJS = \ |
20 metrics_client.o | 20 metrics_client.o |
21 LIB_OBJS = \ | 21 LIB_OBJS = \ |
22 metrics_library.o | 22 metrics_library.o |
23 DAEMON_OBJS = \ | 23 DAEMON_OBJS = \ |
24 metrics_daemon.o \ | 24 metrics_daemon.o \ |
25 metrics_daemon_main.o | 25 metrics_daemon_main.o |
26 TESTDAEMON_OBJS = \ | 26 TESTDAEMON_OBJS = \ |
27 metrics_daemon.o \ | 27 metrics_daemon.o \ |
28 » metrics_daemon_unittest.o | 28 » metrics_daemon_test.o |
29 | 29 |
30 DAEMON_LDFLAGS = $(LDCONFIG) -lrt -lbase -lpthread -lgflags | 30 DAEMON_LDFLAGS = $(LDCONFIG) -lrt -lbase -lpthread -lgflags |
31 TESTDAEMON_LIBS = -lgtest | 31 TESTDAEMON_LIBS = -lgtest |
32 | 32 |
33 all: $(LIB) $(SHAREDLIB) $(CLIENT) $(DAEMON) $(TESTDAEMON) | 33 all: $(LIB) $(SHAREDLIB) $(CLIENT) $(DAEMON) |
| 34 |
| 35 tests: $(DAEMON_TEST) |
34 | 36 |
35 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) | 37 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) |
36 $(CXX) $(LDFLAGS) $^ -o $@ | 38 $(CXX) $(LDFLAGS) $^ -o $@ |
37 | 39 |
38 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) | 40 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) |
39 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) | 41 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) |
40 | 42 |
41 $(TESTDAEMON): $(TESTDAEMON_OBJS) $(SHAREDLIB) | 43 $(DAEMON_TEST): $(TESTDAEMON_OBJS) $(SHAREDLIB) |
42 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) | 44 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) |
43 | 45 |
44 $(LIB): $(LIB_OBJS) | 46 $(LIB): $(LIB_OBJS) |
45 » ar rcs $@ $^ | 47 » $(AR) rcs $@ $^ |
46 | 48 |
47 $(SHAREDLIB): $(LIB_OBJS) | 49 $(SHAREDLIB): $(LIB_OBJS) |
48 $(CXX) $(LDFLAGS) -shared $^ -o $@ | 50 $(CXX) $(LDFLAGS) -shared $^ -o $@ |
49 | 51 |
50 %.o: %.cc | 52 %.o: %.cc |
51 $(CXX) $(CXXFLAGS) -c $< -o $@ | 53 $(CXX) $(CXXFLAGS) -c $< -o $@ |
52 | 54 |
53 # dependencies in addition to those defined by the rules | 55 # dependencies in addition to those defined by the rules |
54 | 56 |
55 metrics_daemon.o: \ | 57 metrics_daemon.o: \ |
56 metrics_daemon.h \ | 58 metrics_daemon.h \ |
57 network_states.h \ | 59 network_states.h \ |
58 power_states.h | 60 power_states.h |
59 metrics_daemon_unittest.o: \ | 61 metrics_daemon_test.o: \ |
60 metrics_daemon.h \ | 62 metrics_daemon.h \ |
61 network_states.h \ | 63 network_states.h \ |
62 power_states.h | 64 power_states.h |
63 | 65 |
64 install: | 66 install: |
65 install $(CLIENT) $(DESTDIR)/usr/bin | 67 install $(CLIENT) $(DESTDIR)/usr/bin |
66 install $(DAEMON) $(DESTDIR)/usr/bin | 68 install $(DAEMON) $(DESTDIR)/usr/bin |
67 install $(LIB) $(DESTDIR)/usr/lib | 69 install $(LIB) $(DESTDIR)/usr/lib |
68 install $(SHAREDLIB) $(DESTDIR)/usr/lib | 70 install $(SHAREDLIB) $(DESTDIR)/usr/lib |
69 install metrics_library.h $(DESTDIR)/usr/include | 71 install metrics_library.h $(DESTDIR)/usr/include |
70 install syslog_parser.sh $(DESTDIR)/usr/bin | 72 install syslog_parser.sh $(DESTDIR)/usr/bin |
71 install omaha_tracker.sh $(DESTDIR)/usr/sbin | 73 install omaha_tracker.sh $(DESTDIR)/usr/sbin |
72 | 74 |
73 clean: | 75 clean: |
74 rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) $(TESTDAEMON) *.o | 76 rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) $(TESTDAEMON) *.o |
OLD | NEW |