Add initial control protocol test.
[oweals/dinit.git] / src / tests / cptests / Makefile
1 -include ../../../mconfig
2
3 objects = cptests.o
4 parent_test_objects = ../test-bpsys.o ../test-dinit.o
5 parent_objs = control.o dinit-log.o service.o
6
7 check: build-tests
8         ./cptests
9
10 build-tests: prepare-incdir cptests
11
12 # Create an "includes" directory populated with a combination of real and mock headers:
13 prepare-incdir:
14         mkdir -p includes
15         rm -rf includes/*.h
16         cd includes; ln -f ../../../includes/*.h .
17         cd includes; ln -f ../../test-includes/dinit.h .
18         cd includes; ln -f ../../test-includes/baseproc-sys.h .
19
20 cptests: cptests.o $(parent_objs)
21         $(CXX) $(SANITIZEOPTS) -o cptests cptests.o $(parent_test_objects) $(parent_objs) $(LDFLAGS)
22
23 $(objects): %.o: %.cc
24         $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../../dasynq -c $< -o $@
25
26 $(parent_objs): %.o: ../../%.cc
27         $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../../dasynq -c $< -o $@
28
29 clean:
30         rm -f *.o *.d cptests
31
32 -include $(objects:.o=.d)
33 -include $(parent_objects:.o=.d)