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
3# found in the LICENSE file.
4
5TARGET = unit_test
6OBJECTS = main.o
7INCLUDES = -I$(GCLIENT_ROOT)/src/common
8OPTIONS = -fprofile-arcs -ftest-coverage -fno-inline -O0
9LIBS = -lgtest
10PACKAGES =
11
12all: $(TARGET)
13
14$(TARGET): $(OBJECTS)
15	$(CXX) $(CXXFLAGS) $(OPTIONS) $(LDFLAGS) $(PACKAGES) $(OBJECTS) $(LIBS) \
16			-o $(TARGET)
17
18-include $(OBJS:.o=.d)
19
20.cc.o:
21	$(CXX) $(CXXFLAGS) $(PACKAGES) $(OPTIONS) $(INCLUDES) -c $< -o $@
22	$(CXX) -MM $(CXXFLAGS) $(PACKAGES) $(OPTIONS) $(INCLUDES) $< > $*.d
23	@mv -f $*.d $*.d.tmp
24	@sed -e 's|.*:|$*.o|' < $*.d.tmp > $*.d
25	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -l | \
26			sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
27	@rm -f $*.d.tmp
28
29clean:
30	$(RM) *.o *.d $(TARGET)
31
32