diff --git a/contrib/chg/Makefile b/contrib/chg/Makefile --- a/contrib/chg/Makefile +++ b/contrib/chg/Makefile @@ -7,6 +7,9 @@ OBJS = $(SRCS:.c=.o) CFLAGS ?= -O2 -Wall -Wextra -pedantic -g CPPFLAGS ?= -D_FORTIFY_SOURCE=2 override CFLAGS += -std=gnu99 +ifdef HGPATH +override CPPFLAGS += -DHGPATH=\"$(HGPATH)\" +endif DESTDIR = PREFIX = /usr/local diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c --- a/contrib/chg/chg.c +++ b/contrib/chg/chg.c @@ -194,7 +194,11 @@ static const char *gethgcmd(void) if (!hgcmd || hgcmd[0] == '\0') hgcmd = getenv("HG"); if (!hgcmd || hgcmd[0] == '\0') +#ifdef HGPATH + hgcmd = (HGPATH); +#else hgcmd = "hg"; +#endif } return hgcmd; }