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