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 COUNTER_TEST = counter_test |
20 | 20 |
| 21 LCRASH ?= -lcrash |
| 22 |
21 TESTCOUNTER_OBJS = \ | 23 TESTCOUNTER_OBJS = \ |
22 counter.o \ | 24 counter.o \ |
23 counter_test.o | 25 counter_test.o |
24 CLIENT_OBJS = \ | 26 CLIENT_OBJS = \ |
25 metrics_client.o | 27 metrics_client.o |
26 DAEMON_OBJS = \ | 28 DAEMON_OBJS = \ |
27 counter.o \ | 29 counter.o \ |
28 metrics_daemon.o \ | 30 metrics_daemon.o \ |
29 metrics_daemon_main.o | 31 metrics_daemon_main.o |
30 TESTDAEMON_OBJS = \ | 32 TESTDAEMON_OBJS = \ |
(...skipping 15 matching lines...) Expand all Loading... |
46 | 48 |
47 tests: $(COUNTER_TEST) $(DAEMON_TEST) $(LIB_TEST) | 49 tests: $(COUNTER_TEST) $(DAEMON_TEST) $(LIB_TEST) |
48 | 50 |
49 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) | 51 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) |
50 $(CXX) $(LDFLAGS) $^ -o $@ | 52 $(CXX) $(LDFLAGS) $^ -o $@ |
51 | 53 |
52 $(COUNTER_TEST): $(TESTCOUNTER_OBJS) | 54 $(COUNTER_TEST): $(TESTCOUNTER_OBJS) |
53 $(CXX) -o $@ $^ $(TESTCOUNTER_LIBS) | 55 $(CXX) -o $@ $^ $(TESTCOUNTER_LIBS) |
54 | 56 |
55 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) | 57 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) |
56 » $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) -lcrash | 58 » $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(LCRASH) |
57 | 59 |
58 $(DAEMON_TEST): $(TESTDAEMON_OBJS) | 60 $(DAEMON_TEST): $(TESTDAEMON_OBJS) |
59 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) | 61 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) |
60 | 62 |
61 $(LIB): $(LIB_OBJS) | 63 $(LIB): $(LIB_OBJS) |
62 $(AR) rcs $@ $^ | 64 $(AR) rcs $@ $^ |
63 | 65 |
64 $(SHAREDLIB): $(LIB_OBJS) | 66 $(SHAREDLIB): $(LIB_OBJS) |
65 $(CXX) $(LDFLAGS) -shared $^ -o $@ | 67 $(CXX) $(LDFLAGS) -shared $^ -o $@ |
66 | 68 |
67 $(LIB_TEST): $(TESTLIB_OBJS) $(SHAREDLIB) | 69 $(LIB_TEST): $(TESTLIB_OBJS) $(SHAREDLIB) |
68 $(CXX) -o $@ $^ $(LDFLAGS) $(TESTLIB_LIBS) | 70 $(CXX) -o $@ $^ $(LDFLAGS) $(TESTLIB_LIBS) |
69 | 71 |
70 %.o: %.cc | 72 %.o: %.cc |
71 $(CXX) $(CXXFLAGS) -c $< -o $@ | 73 $(CXX) $(CXXFLAGS) -c $< -o $@ |
72 | 74 |
73 clean: | 75 clean: |
74 rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) *.o | 76 rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) *.o |
75 rm -f $(COUNTER_TEST) $(DAEMON_TEST) $(LIB_TEST) | 77 rm -f $(COUNTER_TEST) $(DAEMON_TEST) $(LIB_TEST) |
OLD | NEW |