allow a profiled build with 'make PROFILE=yes'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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)