summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-08-25 02:45:04 +0000
committerjmallett <jmallett@FreeBSD.org>2002-08-25 02:45:04 +0000
commitb56d4d7791b5b13e9cdd5f4c4a0bedbcb21ced1f (patch)
treead8cf90f079d6d604f0e18eac1bd033bfc7b65d6 /usr.bin/make
parentfab070b2b32212efea82e6260b19957dcfcb5313 (diff)
downloadFreeBSD-src-b56d4d7791b5b13e9cdd5f4c4a0bedbcb21ced1f.zip
FreeBSD-src-b56d4d7791b5b13e9cdd5f4c4a0bedbcb21ced1f.tar.gz
Add a -C ala GNU make(1) for Makefiles which are too lazy to use $(MAKE) and
this particular GNU flag. It changes into the given directory for the operation in question. This just goes into said directory at the time of parsing the argument for getopt(3). Submitted by: Rachel Hestilow <rachel@jerkcity.com>
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/Makefile2
-rw-r--r--usr.bin/make/main.c7
-rw-r--r--usr.bin/make/make.15
3 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index 208c2cc..4f46cae 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -15,7 +15,7 @@ SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
NOSHARED?= YES
-CFLAGS+=-DMAKE_VERSION=\"5200205240\"
+CFLAGS+=-DMAKE_VERSION=\"5200208240\"
main.o: ${MAKEFILE}
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 0028e15..f143975 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -167,12 +167,15 @@ MainParseArgs(argc, argv)
optind = 1; /* since we're called more than once */
#ifdef REMOTE
-# define OPTFLAGS "BD:E:I:L:PSV:Xd:ef:ij:km:nqrstv"
+# define OPTFLAGS "BC:D:E:I:L:PSV:Xd:ef:ij:km:nqrstv"
#else
-# define OPTFLAGS "BD:E:I:PSV:Xd:ef:ij:km:nqrstv"
+# define OPTFLAGS "BC:D:E:I:PSV:Xd:ef:ij:km:nqrstv"
#endif
rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
switch(c) {
+ case 'C':
+ chdir(optarg);
+ break;
case 'D':
Var_Set(optarg, "1", VAR_GLOBAL);
Var_Append(MAKEFLAGS, "-D", VAR_GLOBAL);
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1
index 85f83e1..b35649e 100644
--- a/usr.bin/make/make.1
+++ b/usr.bin/make/make.1
@@ -41,6 +41,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl BPSXeiknqrstv
+.Op Fl C Ar directory
.Op Fl D Ar variable
.Op Fl d Ar flags
.Op Fl E Ar variable
@@ -88,6 +89,10 @@ by executing the commands to make the sources of a dependency line in sequence.
This is turned on by default unless
.Fl j
is used.
+.It Fl C Ar directory
+Change to
+.Ar directory
+while running.
.It Fl D Ar variable
Define
.Ar variable
OpenPOWER on IntegriCloud