Permalink
Browse files

Add a Makefile target to compile for gprof usage

  • Loading branch information...
1 parent a4f34a0 commit ba7b3a1d8f5db5838b8f26efc76c5714b7332848 @jbittel committed Nov 21, 2011
Showing with 14 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +13 −3 Makefile
View
@@ -1,3 +1,4 @@
httpry
callgrind.log
massif.log
+gmon.out
View
@@ -13,7 +13,7 @@ LIBS = -lpcap -lm -lpthread
PROG = httpry
FILES = httpry.c format.c methods.c utility.c rate.c
-.PHONY: all debug install uninstall clean
+.PHONY: all debug profile install uninstall clean
all: $(PROG)
@@ -26,12 +26,22 @@ debug: $(FILES)
@echo ""
@echo "This will cause the program to run slightly"
@echo "slower, but enables additional data verification"
- @echo "and sanity checks. Recommended for testing, not"
- @echo "production usage."
+ @echo "and sanity checks; recommended for testing, not"
+ @echo "production usage"
@echo "--------------------------------------------------"
@echo ""
$(CC) $(DEBUGFLAGS) -o $(PROG) $(FILES) $(LIBS)
+profile: $(FILES)
+ @echo "--------------------------------------------------"
+ @echo "Compiling $(PROG) in profile mode"
+ @echo ""
+ @echo "This enables profiling so gprof can be used for"
+ @echo "code analysis"
+ @echo "--------------------------------------------------"
+ @echo ""
+ $(CC) $(CCFLAGS) -pg -o $(PROG) $(FILES) $(LIBS)
+
install: $(PROG)
@echo "--------------------------------------------------"
@echo "Installing $(PROG) into /usr/sbin/"

0 comments on commit ba7b3a1

Please sign in to comment.