Permalink
Browse files

save progress

  • Loading branch information...
1 parent d17c596 commit 5d645a7358c6115603a679ac72d5c4231307ec0d @liweinan committed Mar 16, 2013
Showing with 25 additions and 0 deletions.
  1. +25 −0 make/debug/Makefile
View
@@ -0,0 +1,25 @@
+# $(debug-enter)
+debug-enter = $(if $(debug_trace), $(warning "Entering $0($(echo-args))"))
+
+# $(debug-leave)
+debug-leave = $(if $(debug_trace), $(warning Leaving $0))
+
+comma := ,
+echo-args = $(subst ' ','$(comma) ', $(foreach a,1 2 3 4 5 6 7 8 9,'$($a)'))
+
+debug_trace = 1
+
+define a
+ $(debug-enter)
+ @echo $1 $2 $3
+ $(debug-leave)
+endef
+
+define b
+ $(debug-enter)
+ $(call a,$1,$2,hi)
+ $(debug-leave)
+endef
+
+trace-macro:
+ $(call b,5,$(MAKE),c,d,e,f,g,h,i,j,k,l)

0 comments on commit 5d645a7

Please sign in to comment.