]> git.saurik.com Git - apt.git/blob - test/libapt/makefile
Merge remote-tracking branch 'donkult/debian/sid' into debian/sid
[apt.git] / test / libapt / makefile
1 # -*- make -*-
2 BASE=../..
3 SUBDIR=test/libapt
4 BASENAME=_libapt_test
5 APT_DOMAIN=none
6
7 # Bring in the default rules
8 include ../../buildlib/defaults.mak
9
10 .PHONY: test
11 test: $(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
16 PROGRAM = gtest${BASENAME}
17 SLIBS = -lapt-pkg -pthread $(LIB)/gtest.a
18 LIB_MAKES = apt-pkg/makefile
19 SOURCE = gtest_runner.cc $(wildcard *-helpers.cc *_test.cc)
20 include $(PROGRAM_H)
21
22
23 MKDIRS += $(OBJ) $(LIB)
24 LOCAL=gtest
25 SOURCE=gtest-all
26 gtest-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
30 GTEST_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.
35 CPPFLAGS += -isystem $(GTEST_DIR)/include
36
37 # Flags passed to the C++ compiler.
38 CXXFLAGS += -pthread
39 # disable some flags for gtest again
40 CXXFLAGS+= -Wno-missing-declarations
41 CXXFLAGS+= -Wno-missing-field-initializers
42 CXXFLAGS+= -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.
45 GTEST_HEADERS = /usr/include/gtest/*.h \
46 /usr/include/gtest/internal/*.h
47
48 # House-keeping build targets.
49 .PHONY: clean/gtest veryclean/gtest
50 clean: clean/gtest
51 clean/gtest:
52 rm -f $(gtest-OBJS)
53 veryclean: veryclean/gtest
54 veryclean/gtest: clean/gtest
55 rm -f $(LIB)/gtest.a
56
57 # Usually you shouldn't tweak such internal variables, indicated by a
58 # trailing _.
59 GTEST_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) $@ $^