OLD | NEW |
| (Empty) |
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 CCC = g++ | |
6 CC = gcc | |
7 | |
8 INCLUDES = -I../.. | |
9 COPT = -g | |
10 | |
11 CCONFIG = $(shell pkg-config --cflags dbus-1 glib-2.0 dbus-glib-1) | |
12 LDCONFIG = $(shell pkg-config --libs dbus-1 glib-2.0 gthread-2.0 dbus-glib-1) | |
13 | |
14 CFLAGS = $(COPT) -fno-exceptions -Wall -Werror $(INCLUDES) $(CCONFIG) | |
15 LDFLAGS = $(LDCONFIG) -lrt -lbase -lpthread -lgflags -lmetrics | |
16 | |
17 COMMONSRC = metrics_daemon.cc | |
18 COMMONCSRC = marshal_void__string_boxed.c | |
19 SRC = main.cc | |
20 | |
21 TESTSRC = metrics_daemon_unittest.cc | |
22 TESTLIB = -lgflags -lgtest -lmetrics | |
23 | |
24 OBJ = $(SRC:.cc=.o) | |
25 COMMONOBJ = $(COMMONSRC:.cc=.o) $(COMMONCSRC:.c=.o) | |
26 TESTOBJ = $(TESTSRC:.cc=.o) | |
27 | |
28 %.o : %.cc | |
29 $(CCC) -c $(CFLAGS) $< -o $@ | |
30 | |
31 %.o : %.c | |
32 $(CC) -c $(CFLAGS) $< -o $@ | |
33 | |
34 %.c : %.list | |
35 glib-genmarshal --body --prefix=marshal $< > $@ | |
36 | |
37 %.h : %.list | |
38 glib-genmarshal --header --prefix=marshal $< > $@ | |
39 | |
40 DAEMON = metrics_daemon | |
41 TEST = test_daemon | |
42 | |
43 all: $(DAEMON) $(TEST) | |
44 | |
45 metrics_daemon: $(OBJ) $(COMMONOBJ) | |
46 $(CCC) -o metrics_daemon $(OBJ) $(COMMONOBJ) $(LDFLAGS) | |
47 | |
48 test_daemon: $(TESTOBJ) $(COMMONOBJ) | |
49 $(CCC) -o test_daemon $(TESTOBJ) $(COMMONOBJ) $(LDFLAGS) $(TESTLIB) | |
50 | |
51 # dependencies in addition to those defined by the rules | |
52 | |
53 metrics_daemon.o: metrics_daemon.h marshal_void__string_boxed.h network_states.h | |
54 metrics_daemon_unittest.o: metrics_daemon.h marshal_void__string_boxed.h \ | |
55 network_states.h | |
56 marshal_void__string_boxed.o: marshal_void__string_boxed.h | |
57 | |
58 .PRECIOUS: marshal_void__string_boxed.c # keep around for debugging | |
59 | |
60 install: | |
61 mkdir -p $(DESTDIR)/usr/bin | |
62 install $(DAEMON) $(DESTDIR)/usr/bin | |
63 | |
64 clean: | |
65 rm -f *.o marshal_void__string_boxed.[ch] \ | |
66 metrics_daemon test_daemon *~ | |
OLD | NEW |