]> git.saurik.com Git - apt.git/blame - test/libapt/makefile
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / libapt / makefile
CommitLineData
45df0ad2
DK
1# -*- make -*-
2BASE=../..
3SUBDIR=test/libapt
4BASENAME=_libapt_test
57da1b4b 5APT_DOMAIN=none
45df0ad2
DK
6
7# Bring in the default rules
8include ../../buildlib/defaults.mak
9
92d5a40d 10.PHONY: test
f00832cc
DK
11test: $(BIN)/gtest$(BASENAME)
12 MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=$(LIB) $(BIN)/gtest$(BASENAME)
13
14$(BIN)/gtest$(BASENAME): $(LIB)/gtest.a
15
16PROGRAM = gtest${BASENAME}
c4b91cbe
DK
17SLIBS = -lapt-pkg -lapt-private -pthread $(LIB)/gtest.a
18LIB_MAKES = apt-pkg/makefile apt-private/makefile
f00832cc
DK
19SOURCE = gtest_runner.cc $(wildcard *-helpers.cc *_test.cc)
20include $(PROGRAM_H)
21
22
23MKDIRS += $(OBJ) $(LIB)
24LOCAL=gtest
25SOURCE=gtest-all
26gtest-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(SOURCE)))
27
28# The rest of the file is based on the example found in
29# /usr/share/doc/libgtest-dev/examples/make/Makefile
30GTEST_DIR = /usr/src/gtest
31
32# Flags passed to the preprocessor.
33# Set Google Test's header directory as a system directory, such that
34# the compiler doesn't generate warnings in Google Test headers.
35CPPFLAGS += -isystem $(GTEST_DIR)/include
36
37# Flags passed to the C++ compiler.
38CXXFLAGS += -pthread
39# disable some flags for gtest again
40CXXFLAGS+= -Wno-missing-declarations
41CXXFLAGS+= -Wno-missing-field-initializers
42CXXFLAGS+= -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wno-suggest-attribute=noreturn
43
44# All Google Test headers. Usually you shouldn't change this definition.
45GTEST_HEADERS = /usr/include/gtest/*.h \
46 /usr/include/gtest/internal/*.h
47
48# House-keeping build targets.
49.PHONY: clean/gtest veryclean/gtest
50clean: clean/gtest
51clean/gtest:
52 rm -f $(gtest-OBJS)
53veryclean: veryclean/gtest
54veryclean/gtest: clean/gtest
55 rm -f $(LIB)/gtest.a
56
57# Usually you shouldn't tweak such internal variables, indicated by a
58# trailing _.
59GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
60
61# Builds gtest.a
62# For simplicity and to avoid depending on Google Test's
63# implementation details, the dependencies specified below are
64# conservative and not optimized. This is fine as Google Test
65# compiles fast and for ordinary users its source rarely changes.
66$(gtest-OBJS): $(GTEST_SRCS_)
67 echo Compiling $@
68 $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c -o $@ $(GTEST_DIR)/src/$(notdir $(basename $@)).cc
69
70$(LIB)/gtest.a: $(OBJ)/gtest-all.o
71 echo Building static library $@
72 -rm -f $@
73 $(AR) $(ARFLAGS) $@ $^