From 65b140a4bb80ba2b993dd4fdb0251ec552077961 Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 22 Jun 2017 15:57:16 +0000 Subject: Generate the newbsd: and install-update: targets here, rather than in the source Makefile.* files. ok tb rpe mlarkin --- usr.sbin/config/config.h | 3 ++- usr.sbin/config/main.c | 3 +-- usr.sbin/config/mkmakefile.c | 25 +++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) (limited to 'usr.sbin/config') diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index b1802949710..d471475015c 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.29 2016/10/16 09:35:40 tb Exp $ */ +/* $OpenBSD: config.h,v 1.30 2017/06/22 15:57:16 deraadt Exp $ */ /* $NetBSD: config.h,v 1.30 1997/02/02 21:12:30 thorpej Exp $ */ /* @@ -266,6 +266,7 @@ struct objects { struct hashtab; const char *conffile; /* source file, e.g., "GENERIC.sparc" */ +const char *last_component; const char *machine; /* machine type, e.g., "sparc" or "sun3" */ const char *machinearch; /* machine arch, e.g., "sparc" or "m68k" */ const char *srcdir; /* path to source directory (rel. to build) */ diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 6787a6e4346..a2b19656246 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.58 2017/06/19 17:35:04 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.59 2017/06/22 15:57:16 deraadt Exp $ */ /* $NetBSD: main.c,v 1.22 1997/02/02 21:12:33 thorpej Exp $ */ /* @@ -97,7 +97,6 @@ int main(int argc, char *argv[]) { char *p; - const char *last_component; char *outfile = NULL; int ch, eflag, uflag, fflag; char dirbuffer[PATH_MAX]; diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 816bb19887e..c2ac4c63626 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkmakefile.c,v 1.42 2016/10/16 17:50:00 tb Exp $ */ +/* $OpenBSD: mkmakefile.c,v 1.43 2017/06/22 15:57:16 deraadt Exp $ */ /* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */ /* @@ -429,7 +429,7 @@ emitrules(FILE *fp) ".SUFFIXES:\n" ".SUFFIXES: .s .S .c .o\n\n" - ".PHONY: depend all install clean tags\n\n" + ".PHONY: depend all install clean tags newbsd update-link\n\n" ".c.o:\n" "\t${NORMAL_C}\n\n" @@ -509,6 +509,27 @@ emitload(FILE *fp) } if (fputs("\t${NORMAL_C}\n\n", fp) < 0) return (1); + + if (fprintf(fp, "new%s: gap.o\n", nm) < 0) + return (1); + if (fprintf(fp, + "\t${SYSTEM_LD_HEAD}\n" + "\t${SYSTEM_LD} swap%s.o\n" + "\t${SYSTEM_LD_TAIL}\n" + "\tmv -f new%s %s\n\n", + swname, nm, nm) < 0) + return (1); + + if (fprintf(fp, "update-link:\n") < 0) + return (1); + if (fprintf(fp, + "\tmkdir -p -m 700 /usr/share/compile\n" + "\trm -rf /usr/share/compile/%s /usr/share/compile.tgz\n" + "\tmkdir /usr/share/compile/%s\n" + "\ttar -chf - Makefile makegap.sh ld.script *.o | \\\n" + "\t tar -C /usr/share/compile/%s -xf -\n\n", + last_component, last_component, last_component) < 0) + return (1); } return (0); } -- cgit v1.2.3-59-g8ed1b