The sigconv.awk script generates a sigdesc.h header file, which
contains a sigdec[] vector of structures, but the generated output is missing braces around the initializer of each struct, which triggers warnings in WARNS=3: src/usr.bin/top/sigdesc.h:10: warning: missing braces around initializer src/usr.bin/top/sigdesc.h:10: warning: (near initialization for `sigdesc[0]') * Fix the sigconv.awk script to generate a header with initializers which look better. * Add rules to usr.bin/top/Makefile that rebuilds a new sigconv.h header which matches the correct signal set from the build-time version of `${DESTDIR}/usr/include/signal.h' (so sigconv.h doesn't get stale once changes are made to the header). * Remove the old sigconv.h header, now that it is autoupdated at build time. * Various Makefile style fixes (the committed Makefile was kindly submitted by Ruslan): - Reorder .PATH, PROG, SRCS and CFLAGS to match style.Makefile(5) - Split off the generated sources (sigdesc.h top.local.h) in an SRCS+= line of their own. - Add entries to CLEANFILES near the rules that generate the respective files. - Move the explicit rule which builds top.1 after the implicit rules which generate its dependencies. Reviewed by: ru, bde Submitted by: ru (Makefile) MFC after: 2 weeks
This commit is contained in:
parent
fbf953b58e
commit
d2d6d8d537
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164784
@ -1,3 +1,5 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
nsig = 0;
|
nsig = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
@ -10,7 +12,7 @@ BEGIN {
|
|||||||
print "struct sigdesc sigdesc[] = {"
|
print "struct sigdesc sigdesc[] = {"
|
||||||
}
|
}
|
||||||
|
|
||||||
/^#define[ \t][ \t]*SIG[A-Z]/ {
|
/^#define[ \t][ \t]*SIG[A-Z]+[0-9]*[ \t]/ {
|
||||||
|
|
||||||
j = sprintf("%d", $3);
|
j = sprintf("%d", $3);
|
||||||
str = $2;
|
str = $2;
|
||||||
@ -18,10 +20,10 @@ BEGIN {
|
|||||||
if (nsig < j)
|
if (nsig < j)
|
||||||
nsig = j;
|
nsig = j;
|
||||||
|
|
||||||
siglist[j] = sprintf("\"%s\",\t%2d,", \
|
siglist[j] = sprintf("{ \"%s\",\t%2d },", \
|
||||||
substr(str, 4), j);
|
substr(str, 4), j);
|
||||||
}
|
}
|
||||||
/^#[ \t]*define[ \t][ \t]*SIG[A-Z]/ {
|
/^#[ \t]*define[ \t][ \t]*SIG[A-Z]+[0-9]*[ \t]/ {
|
||||||
|
|
||||||
j = sprintf("%d", $4);
|
j = sprintf("%d", $4);
|
||||||
str = $3;
|
str = $3;
|
||||||
@ -29,10 +31,10 @@ BEGIN {
|
|||||||
if (nsig < j)
|
if (nsig < j)
|
||||||
nsig = j;
|
nsig = j;
|
||||||
|
|
||||||
siglist[j] = sprintf("\"%s\",\t%2d,", \
|
siglist[j] = sprintf("{ \"%s\",\t%2d },", \
|
||||||
substr(str, 4), j);
|
substr(str, 4), j);
|
||||||
}
|
}
|
||||||
/^#[ \t]*define[ \t][ \t]*_SIG[A-Z]/ {
|
/^#[ \t]*define[ \t][ \t]*_SIG[A-Z]+[0-9]*[ \t]/ {
|
||||||
|
|
||||||
j = sprintf("%d", $4);
|
j = sprintf("%d", $4);
|
||||||
str = $3;
|
str = $3;
|
||||||
@ -40,7 +42,7 @@ BEGIN {
|
|||||||
if (nsig < j)
|
if (nsig < j)
|
||||||
nsig = j;
|
nsig = j;
|
||||||
|
|
||||||
siglist[j] = sprintf("\"%s\",\t%2d,", \
|
siglist[j] = sprintf("{ \"%s\",\t%2d },", \
|
||||||
substr(str, 5), j);
|
substr(str, 5), j);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,5 +51,5 @@ END {
|
|||||||
if (siglist[n] != "")
|
if (siglist[n] != "")
|
||||||
printf(" %s\n", siglist[n]);
|
printf(" %s\n", siglist[n]);
|
||||||
|
|
||||||
printf(" NULL,\t 0\n};\n");
|
printf(" { NULL,\t 0 }\n};\n");
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,35 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
PROG= top
|
|
||||||
|
|
||||||
TOPDIR= ${.CURDIR}/../../contrib/top
|
TOPDIR= ${.CURDIR}/../../contrib/top
|
||||||
.PATH: ${TOPDIR}
|
.PATH: ${TOPDIR}
|
||||||
|
|
||||||
CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -I${.CURDIR} -I${TOPDIR} -I. -DORDER
|
PROG= top
|
||||||
|
SRCS= commands.c display.c machine.c screen.c top.c \
|
||||||
|
username.c utils.c version.c
|
||||||
|
SRCS+= sigdesc.h top.local.h
|
||||||
|
CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -DORDER
|
||||||
|
CFLAGS+= -I${.CURDIR} -I${TOPDIR} -I.
|
||||||
|
|
||||||
#
|
#
|
||||||
# The table size should be a prime number approximately twice as
|
# The table size should be a prime number approximately twice as
|
||||||
# large as the number of lines in /etc/passwd. The default number
|
# large as the number of lines in /etc/passwd. The default number
|
||||||
# is 20011, use /etc/make.conf to override this.
|
# is 20011; use /etc/make.conf to override this.
|
||||||
#
|
#
|
||||||
.if defined(TOP_TABLE_SIZE)
|
.if defined(TOP_TABLE_SIZE)
|
||||||
CFLAGS+= -D"Table_size=${TOP_TABLE_SIZE}"
|
CFLAGS+= -D"Table_size=${TOP_TABLE_SIZE}"
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
SRCS= commands.c display.c machine.c screen.c top.c \
|
|
||||||
username.c utils.c version.c top.local.h
|
|
||||||
|
|
||||||
CLEANFILES+= top.local.h top.x top.1
|
|
||||||
DPADD= ${LIBTERMCAP} ${LIBM} ${LIBKVM}
|
DPADD= ${LIBTERMCAP} ${LIBM} ${LIBKVM}
|
||||||
LDADD= -ltermcap -lm -lkvm
|
LDADD= -ltermcap -lm -lkvm
|
||||||
|
|
||||||
top.1: top.x top.local.1
|
CLEANFILES= sigdesc.h
|
||||||
cat ${.ALLSRC} > top.1
|
SIGCONV_AWK= ${.CURDIR}/../../contrib/top/sigconv.awk
|
||||||
|
SIGNAL_H= ${DESTDIR}/usr/include/sys/signal.h
|
||||||
|
sigdesc.h: ${SIGCONV_AWK} ${SIGNAL_H}
|
||||||
|
awk -f ${SIGCONV_AWK} < ${SIGNAL_H} > ${.TARGET}
|
||||||
|
|
||||||
|
CLEANFILES+= top.local.h top.x
|
||||||
.SUFFIXES: .X .x .H .h
|
.SUFFIXES: .X .x .H .h
|
||||||
|
|
||||||
.X.x .H.h:
|
.X.x .H.h:
|
||||||
@${ECHO} Making ${.TARGET} from ${.IMPSRC}
|
@${ECHO} Making ${.TARGET} from ${.IMPSRC}
|
||||||
@sed -e's,%LoadMax%,5.0,g' \
|
@sed -e's,%LoadMax%,5.0,g' \
|
||||||
@ -37,4 +40,8 @@ top.1: top.x top.local.1
|
|||||||
-e's,%random%,1,g' \
|
-e's,%random%,1,g' \
|
||||||
${.IMPSRC} > ${.TARGET}
|
${.IMPSRC} > ${.TARGET}
|
||||||
|
|
||||||
|
CLEANFILES+= top.1
|
||||||
|
top.1: top.x top.local.1
|
||||||
|
cat ${.ALLSRC} > ${.TARGET}
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/* This file was automatically generated */
|
|
||||||
/* by the awk script "sigconv.awk". */
|
|
||||||
|
|
||||||
struct sigdesc {
|
|
||||||
char *name;
|
|
||||||
int number;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sigdesc sigdesc[] = {
|
|
||||||
"HUP", 1,
|
|
||||||
"INT", 2,
|
|
||||||
"QUIT", 3,
|
|
||||||
"ILL", 4,
|
|
||||||
"TRAP", 5,
|
|
||||||
"ABRT", 6,
|
|
||||||
"EMT", 7,
|
|
||||||
"FPE", 8,
|
|
||||||
"KILL", 9,
|
|
||||||
"BUS", 10,
|
|
||||||
"SEGV", 11,
|
|
||||||
"SYS", 12,
|
|
||||||
"PIPE", 13,
|
|
||||||
"ALRM", 14,
|
|
||||||
"TERM", 15,
|
|
||||||
"URG", 16,
|
|
||||||
"STOP", 17,
|
|
||||||
"TSTP", 18,
|
|
||||||
"CONT", 19,
|
|
||||||
"CHLD", 20,
|
|
||||||
"TTIN", 21,
|
|
||||||
"TTOU", 22,
|
|
||||||
"IO", 23,
|
|
||||||
"XCPU", 24,
|
|
||||||
"XFSZ", 25,
|
|
||||||
"VTALRM", 26,
|
|
||||||
"PROF", 27,
|
|
||||||
"WINCH", 28,
|
|
||||||
"INFO", 29,
|
|
||||||
"USR1", 30,
|
|
||||||
"USR2", 31,
|
|
||||||
NULL, 0
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user