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 CFLAGS = -Wall -Werror -I/usr/include -fpic -O2 $(CCONFIG) | 11 CFLAGS = -Wall -Werror -I/usr/include -fPIC -O2 $(CCONFIG) |
12 CXXFLAGS = $(CFLAGS) -fno-exceptions | 12 CXXFLAGS = $(CFLAGS) -fno-exceptions |
13 | 13 |
14 CLIENT = metrics_client | 14 CLIENT = metrics_client |
15 DAEMON = metrics_daemon | 15 DAEMON = metrics_daemon |
16 TESTDAEMON = test_daemon | 16 TESTDAEMON = test_daemon |
17 LIB = libmetrics.a | 17 LIB = libmetrics.a |
18 SHAREDLIB = libmetrics.so | 18 SHAREDLIB = libmetrics.so |
19 | 19 |
20 CLIENT_OBJS = \ | 20 CLIENT_OBJS = \ |
21 metrics_client.o | 21 metrics_client.o |
22 LIB_OBJS = \ | 22 LIB_OBJS = \ |
23 metrics_library.o | 23 metrics_library.o |
24 DAEMON_OBJS = \ | 24 DAEMON_OBJS = \ |
25 marshal_void__string_boxed.o \ | |
26 metrics_daemon.o \ | 25 metrics_daemon.o \ |
27 metrics_daemon_main.o | 26 metrics_daemon_main.o |
28 TESTDAEMON_OBJS = \ | 27 TESTDAEMON_OBJS = \ |
29 marshal_void__string_boxed.o \ | |
30 metrics_daemon.o \ | 28 metrics_daemon.o \ |
31 metrics_daemon_unittest.o | 29 metrics_daemon_unittest.o |
32 | 30 |
33 DAEMON_LDFLAGS = $(LDCONFIG) -lrt -lbase -lpthread -lgflags | 31 DAEMON_LDFLAGS = $(LDCONFIG) -lrt -lbase -lpthread -lgflags |
34 TESTDAEMON_LIBS = -lgtest | 32 TESTDAEMON_LIBS = -lgtest |
35 | 33 |
36 all: $(LIB) $(SHAREDLIB) $(CLIENT) $(DAEMON) $(TESTDAEMON) | 34 all: $(LIB) $(SHAREDLIB) $(CLIENT) $(DAEMON) $(TESTDAEMON) |
37 | 35 |
38 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) | 36 $(CLIENT): $(CLIENT_OBJS) $(SHAREDLIB) |
39 $(CXX) $(LDFLAGS) $^ -o $@ | 37 $(CXX) $(LDFLAGS) $^ -o $@ |
40 | 38 |
41 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) | 39 $(DAEMON): $(DAEMON_OBJS) $(SHAREDLIB) |
42 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) | 40 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) |
43 | 41 |
44 $(TESTDAEMON): $(TESTDAEMON_OBJS) $(SHAREDLIB) | 42 $(TESTDAEMON): $(TESTDAEMON_OBJS) $(SHAREDLIB) |
45 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) | 43 $(CXX) -o $@ $^ $(DAEMON_LDFLAGS) $(TESTDAEMON_LIBS) |
46 | 44 |
47 $(LIB): $(LIB_OBJS) | 45 $(LIB): $(LIB_OBJS) |
48 ar rcs $@ $^ | 46 ar rcs $@ $^ |
49 | 47 |
50 $(SHAREDLIB): $(LIB_OBJS) | 48 $(SHAREDLIB): $(LIB_OBJS) |
51 $(CXX) $(LDFLAGS) -shared $^ -o $@ | 49 $(CXX) $(LDFLAGS) -shared $^ -o $@ |
52 | 50 |
53 %.o: %.cc | 51 %.o: %.cc |
54 $(CXX) $(CXXFLAGS) -c $< -o $@ | 52 $(CXX) $(CXXFLAGS) -c $< -o $@ |
55 | 53 |
56 %.o: %.c | 54 %.o: %.c |
57 $(CC) $(CFLAGS) -c $< -o $@ | 55 $(CC) $(CFLAGS) -c $< -o $@ |
58 | 56 |
59 %.c: %.list | |
60 glib-genmarshal --body --prefix=marshal $< > $@ | |
61 | |
62 %.h: %.list | |
63 glib-genmarshal --header --prefix=marshal $< > $@ | |
64 | |
65 # dependencies in addition to those defined by the rules | 57 # dependencies in addition to those defined by the rules |
66 | 58 |
67 metrics_daemon.o: \ | 59 metrics_daemon.o: \ |
68 marshal_void__string_boxed.h \ | |
69 metrics_daemon.h \ | 60 metrics_daemon.h \ |
70 » network_states.h | 61 » network_states.h \ |
| 62 » power_states.h |
71 metrics_daemon_unittest.o: \ | 63 metrics_daemon_unittest.o: \ |
72 marshal_void__string_boxed.h \ | |
73 metrics_daemon.h \ | 64 metrics_daemon.h \ |
74 » network_states.h | 65 » network_states.h \ |
75 marshal_void__string_boxed.o: \ | 66 » power_states.h |
76 » marshal_void__string_boxed.h | |
77 | |
78 .PRECIOUS: marshal_void__string_boxed.c # keep around for debugging | |
79 | 67 |
80 install: | 68 install: |
81 install $(CLIENT) $(DESTDIR)/usr/bin | 69 install $(CLIENT) $(DESTDIR)/usr/bin |
82 install $(DAEMON) $(DESTDIR)/usr/bin | 70 install $(DAEMON) $(DESTDIR)/usr/bin |
83 install $(LIB) $(DESTDIR)/usr/lib | 71 install $(LIB) $(DESTDIR)/usr/lib |
84 install $(SHAREDLIB) $(DESTDIR)/usr/lib | 72 install $(SHAREDLIB) $(DESTDIR)/usr/lib |
85 install metrics_library.h $(DESTDIR)/usr/include | 73 install metrics_library.h $(DESTDIR)/usr/include |
86 install syslog_parser.sh $(DESTDIR)/usr/bin | 74 install syslog_parser.sh $(DESTDIR)/usr/bin |
87 install omaha_tracker.sh $(DESTDIR)/usr/sbin | 75 install omaha_tracker.sh $(DESTDIR)/usr/sbin |
88 | 76 |
89 clean: | 77 clean: |
90 » rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) $(TESTDAEMON) | 78 » rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) $(TESTDAEMON) *.o |
91 » rm -f *.o marshal_void__string_boxed.[ch] | |
OLD | NEW |