@@ -56,6 +56,7 @@ RM_F:=rm -f
56
56
RM_RF: =rm -rf
57
57
CP: =cp
58
58
CP_A: =cp -a
59
+ GDB: =gdb
59
60
60
61
STATIC: =@STATIC@
61
62
SHARED: =@SHARED@
@@ -498,6 +499,16 @@ else
498
499
-include $(BUILD_DIR ) /test/*.d
499
500
-include $(BUILD_DIR ) /*/test/*.d
500
501
endif
502
+ else ifeq ($(MAKECMDGOALS), debug)
503
+ ifdef MOD
504
+ $(warning Dependency tracking only set to cover the test executables of $(MOD).)
505
+ -include $(foreach dir, $(MOD ) , $(BUILD_DIR ) /$(dir ) /test/* .d)
506
+ else
507
+ -include $(BUILD_DIR ) /*/*.o.d
508
+ -include $(BUILD_DIR ) /*/*.lo.d
509
+ -include $(BUILD_DIR ) /test/*.d
510
+ -include $(BUILD_DIR ) /*/test/*.d
511
+ endif
501
512
else ifeq ($(MAKECMDGOALS), tune)
502
513
-include $(BUILD_DIR ) /*/*.o.d
503
514
-include $(BUILD_DIR ) /*/*.lo.d
@@ -798,6 +809,25 @@ check: library $(TESTS:%=%_TEST_RUN)
798
809
@echo ' All tests passed.'
799
810
endif
800
811
812
+ # ###############################################################################
813
+ # debugging
814
+ # ###############################################################################
815
+
816
+ % _TEST_DBG_RUN_ARGS : %
817
+ @$(GDB ) --args $< $(ARGS )
818
+
819
+ ifdef MOD
820
+ ifdef ARGS
821
+ DEBUG: =1
822
+ debug : library $(patsubst % ,% _TEST_DBG_RUN_ARGS, $($(sort $(MOD ) ) _TESTS) )
823
+ endif
824
+ endif
825
+
826
+ ifneq ($(DEBUG ) ,1)
827
+ debug :
828
+ $(error Can only run debugger with one module and one argument at a time)
829
+ endif
830
+
801
831
# ###############################################################################
802
832
# tuning
803
833
# ###############################################################################
@@ -952,11 +982,11 @@ dist:
952
982
dev/make_dist.sh $(FLINT_VERSION )
953
983
954
984
# ###############################################################################
955
- # debugging
985
+ # makefile debugging
956
986
# ###############################################################################
957
987
958
988
print-% :
959
989
@echo " $* =$( $* ) "
960
990
961
- .PHONY : all library shared static examples checkexamples profile tests check tune valgrind clean distclean install uninstall dist % _TEST_RUN % _VALGRIND_RUN print-% coverage coverage_html
962
- .SILENT : $(mpn_extras_S_SOURCES )
991
+ .PHONY : all library shared static examples checkexamples profile tests check tune valgrind clean distclean install uninstall dist % _TEST_RUN % _TEST_RUN_ % % _TEST_DGB_RUN_ARGS % _VALGRIND_RUN print-% coverage coverage_html debug
992
+ .PRECIOUS : $( mpn_extras_PIC_S_SOURCES ) $(mpn_extras_S_SOURCES )
0 commit comments