Commit 6715a7519bb26a9063aec92cd44d77ddf0fe4be9

Stefan Sperling 2018-03-16T21:08:22

allow a profiled build with 'make PROFILE=yes'

diff --git a/got/Makefile b/got/Makefile
index 8e74120..a65d4db 100644
--- a/got/Makefile
+++ b/got/Makefile
@@ -7,7 +7,13 @@ SRCS=		got.c delta.c error.c fileindex.c object.c path.c pack.c \
 CPPFLAGS = -I${.CURDIR}/../include -I${.CURDIR}/../lib
 LDADD = -lutil -lz
 DPADD = ${LIBZ} ${LIBUTIL}
+.if defined(PROFILE)
+CC = gcc
+CPPFLAGS += -DPROFILE
+DEBUG = -O0 -pg
+.else
 DEBUG = -O0 -g
+.endif
 CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
 
 # For now, default to installing binary in ~/bin
diff --git a/got/got.c b/got/got.c
index be95ec2..3ae4fc6 100644
--- a/got/got.c
+++ b/got/got.c
@@ -173,9 +173,10 @@ cmd_checkout(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
+#ifndef PROFILE
 	if (pledge("stdio rpath wpath cpath flock", NULL) == -1)
 		err(1, "pledge");
-
+#endif
 	if (argc == 1) {
 		char *cwd, *base, *dotgit;
 		repo_path = argv[0];
@@ -298,9 +299,10 @@ cmd_log(int argc, char *argv[])
 	struct got_object *obj;
 	char *repo_path = NULL;
 
+#ifndef PROFILE
 	if (pledge("stdio rpath wpath cpath", NULL) == -1)
 		err(1, "pledge");
-
+#endif
 	if (argc == 1) {
 		repo_path = getcwd(NULL, 0);
 		if (repo_path == NULL)