05d2a2d3cfa0803094f2ae400b2d104e3db514f7
[oweals/dinit.git] / src / tests / Makefile
1 -include ../../mconfig
2
3 objects = tests.o test-dinit.o proctests.o test-run-child-proc.o test-bpsys.o
4 parent_objs = service.o proc-service.o dinit-log.o load_service.o baseproc-service.o
5
6 check: build-tests
7         ./tests
8         ./proctests
9
10 build-tests: tests proctests
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 -sf ../../includes/*.h .
17         cd includes; ln -sf ../test-includes/*.h .
18
19 tests: prepare-incdir $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o
20         $(CXX) $(SANITIZEOPTS) -o tests $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(EXTRA_LIBS)
21
22 proctests: prepare-incdir $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o
23         $(CXX) $(SANITIZEOPTS) -o proctests $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(EXTRA_LIBS)
24
25 $(objects): %.o: %.cc
26         $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../dasynq -c $< -o $@
27
28 $(parent_objs): %.o: ../%.cc
29         $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../dasynq -c $< -o $@
30
31 clean:
32         rm -f *.o *.d
33
34 -include $(objects:.o=.d)