tests makefile: auto-generate dependencies (*.d) while building objects.
[oweals/dinit.git] / src / tests / Makefile
index 1688ac077dbc991727294b80c5e1297a348cbeb4..9f94055047a20331e4ddb91276cde1c9a1fb7a2b 100644 (file)
@@ -1,12 +1,13 @@
 -include ../../mconfig
 
-objects = tests.o test-dinit.o
-parent_objs = service.o baseproc-service.o proc-service.o dinit-log.o load_service.o
+objects = tests.o test-dinit.o proctests.o test-run-child-proc.o test-bpsys.o
+parent_objs = service.o proc-service.o dinit-log.o load_service.o baseproc-service.o
 
 check: build-tests
        ./tests
+       ./proctests
 
-build-tests: prepare-incdir tests
+build-tests: tests proctests
 
 # Create an "includes" directory populated with a combination of real and mock headers:
 prepare-incdir:
@@ -15,19 +16,19 @@ prepare-incdir:
        cd includes; ln -sf ../../includes/*.h .
        cd includes; ln -sf ../test-includes/*.h .
 
-tests: $(objects) $(parent_objs)
-       $(CXX) $(SANITIZEOPTS) -o tests $(objects) $(parent_objs) $(EXTRA_LIBS)
+tests: prepare-incdir $(parent_objs) tests.o test-dinit.o test-bpsys.o
+       $(CXX) $(SANITIZEOPTS) -o tests $(parent_objs) tests.o test-dinit.o test-bpsys.o $(EXTRA_LIBS)
+
+proctests: prepare-incdir $(parent_objs) proctests.o test-dinit.o test-bpsys.o
+       $(CXX) $(SANITIZEOPTS) -o proctests $(parent_objs) proctests.o test-dinit.o test-bpsys.o $(EXTRA_LIBS)
 
 $(objects): %.o: %.cc
-       $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -Iincludes -I../dasynq -c $< -o $@
+       $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../dasynq -c $< -o $@
 
 $(parent_objs): %.o: ../%.cc
-       $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -Iincludes -I../dasynq -c $< -o $@
+       $(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../dasynq -c $< -o $@
 
 clean:
        rm -f *.o *.d
 
-$(objects:.o=.d): %.d: %.cc
-       $(CXX) $(CXXOPTS) -Iincludes -I../dasynq -MM -MG -MF $@ $<
-
-include $(objects:.o=.d)
+-include $(objects:.o=.d)