removed MKDEP; it is now a cpp option (-d)
This commit is contained in:
parent
63d6fe28e7
commit
7761eecc34
|
@ -62,7 +62,7 @@ GSRC = char.c symbol2str.c
|
||||||
GHSRC = errout.h idfsize.h ifdepth.h lapbuf.h \
|
GHSRC = errout.h idfsize.h ifdepth.h lapbuf.h \
|
||||||
nparams.h numsize.h obufsize.h \
|
nparams.h numsize.h obufsize.h \
|
||||||
parbufsize.h pathlength.h strsize.h textsize.h \
|
parbufsize.h pathlength.h strsize.h textsize.h \
|
||||||
botch_free.h debug.h inputtype.h dobits.h line_prefix.h mkdep.h
|
botch_free.h debug.h inputtype.h dobits.h line_prefix.h
|
||||||
|
|
||||||
# Other generated files, for 'make clean' only
|
# Other generated files, for 'make clean' only
|
||||||
GENERATED = tokenfile.g Lpars.h LLfiles LL.output lint.out \
|
GENERATED = tokenfile.g Lpars.h LLfiles LL.output lint.out \
|
||||||
|
@ -172,7 +172,6 @@ domacro.o: input.h
|
||||||
domacro.o: inputtype.h
|
domacro.o: inputtype.h
|
||||||
domacro.o: interface.h
|
domacro.o: interface.h
|
||||||
domacro.o: macro.h
|
domacro.o: macro.h
|
||||||
domacro.o: mkdep.h
|
|
||||||
domacro.o: nparams.h
|
domacro.o: nparams.h
|
||||||
domacro.o: parbufsize.h
|
domacro.o: parbufsize.h
|
||||||
domacro.o: textsize.h
|
domacro.o: textsize.h
|
||||||
|
@ -192,13 +191,11 @@ main.o: file_info.h
|
||||||
main.o: idf.h
|
main.o: idf.h
|
||||||
main.o: idfsize.h
|
main.o: idfsize.h
|
||||||
main.o: macro.h
|
main.o: macro.h
|
||||||
main.o: mkdep.h
|
|
||||||
options.o: charoffset.h
|
options.o: charoffset.h
|
||||||
options.o: class.h
|
options.o: class.h
|
||||||
options.o: idf.h
|
options.o: idf.h
|
||||||
options.o: idfsize.h
|
options.o: idfsize.h
|
||||||
options.o: macro.h
|
options.o: macro.h
|
||||||
options.o: mkdep.h
|
|
||||||
preprocess.o: LLlex.h
|
preprocess.o: LLlex.h
|
||||||
preprocess.o: bits.h
|
preprocess.o: bits.h
|
||||||
preprocess.o: charoffset.h
|
preprocess.o: charoffset.h
|
||||||
|
@ -210,7 +207,6 @@ preprocess.o: idfsize.h
|
||||||
preprocess.o: input.h
|
preprocess.o: input.h
|
||||||
preprocess.o: inputtype.h
|
preprocess.o: inputtype.h
|
||||||
preprocess.o: line_prefix.h
|
preprocess.o: line_prefix.h
|
||||||
preprocess.o: mkdep.h
|
|
||||||
preprocess.o: obufsize.h
|
preprocess.o: obufsize.h
|
||||||
replace.o: LLlex.h
|
replace.o: LLlex.h
|
||||||
replace.o: charoffset.h
|
replace.o: charoffset.h
|
||||||
|
|
|
@ -68,10 +68,4 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
!File: mkdep.h
|
|
||||||
#undef MKDEP 1 /* if defined, preprocessor only outputs
|
|
||||||
names of files included (not finished yet)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ as a macro with
|
||||||
as its replacement text.
|
as its replacement text.
|
||||||
.IP -\fBD\fIname\fR
|
.IP -\fBD\fIname\fR
|
||||||
the same as -\fBD\fIname\fR=1.
|
the same as -\fBD\fIname\fR=1.
|
||||||
.IP
|
|
||||||
.IP -\fBU\fIname\fR
|
.IP -\fBU\fIname\fR
|
||||||
.br
|
.br
|
||||||
undefine the macro name
|
undefine the macro name
|
||||||
|
@ -42,9 +41,25 @@ do not generate line directives
|
||||||
.IP -\fBM\fIn\fR
|
.IP -\fBM\fIn\fR
|
||||||
set maximum identifier length to
|
set maximum identifier length to
|
||||||
.IR n .
|
.IR n .
|
||||||
|
.IP -\fBd\fR[\fIfile\fR]
|
||||||
|
.br
|
||||||
|
if \fIfile\fR is not given, do not preprocess, but instead generate a list
|
||||||
|
of makefile dependencies and write them to the standard output.
|
||||||
|
If \fIfile\fP is given, generate preprocessor output on standard output,
|
||||||
|
and generate the list of makefile dependencies on file \fIfile\fP.
|
||||||
|
.IP -\fBxs\fR
|
||||||
|
when generating makefile dependencies, do not include files from
|
||||||
|
/usr/include.
|
||||||
|
.IP -\fBxm\fR
|
||||||
|
when generating makefile dependencies, generate them in the following format:
|
||||||
|
.RS
|
||||||
|
.IP "file.o: file1.h"
|
||||||
|
.RE
|
||||||
|
.IP ""
|
||||||
|
where "file.o" is derived from the source file name. Normally, only a list
|
||||||
|
of files included is generated.
|
||||||
.PP
|
.PP
|
||||||
The following names are always available unless undefined:
|
The following names are always available unless undefined:
|
||||||
.RS
|
|
||||||
.IP __FILE__
|
.IP __FILE__
|
||||||
The input (or #include) file being compiled
|
The input (or #include) file being compiled
|
||||||
(as a quoted string).
|
(as a quoted string).
|
||||||
|
@ -53,4 +68,3 @@ The line number being compiled.
|
||||||
.IP __DATE__
|
.IP __DATE__
|
||||||
The date and time of compilation as
|
The date and time of compilation as
|
||||||
a Unix ctime quoted string (the trailing newline is removed).
|
a Unix ctime quoted string (the trailing newline is removed).
|
||||||
.RE
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "class.h"
|
#include "class.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
#include "bits.h"
|
#include "bits.h"
|
||||||
#include "mkdep.h"
|
|
||||||
|
|
||||||
IMPORT char **inctable; /* list of include directories */
|
IMPORT char **inctable; /* list of include directories */
|
||||||
IMPORT char *getwdir();
|
IMPORT char *getwdir();
|
||||||
|
@ -34,6 +33,7 @@ PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
|
||||||
int nestlevel = -1;
|
int nestlevel = -1;
|
||||||
int svnestlevel[30] = {-1};
|
int svnestlevel[30] = {-1};
|
||||||
int nestcount;
|
int nestcount;
|
||||||
|
extern int do_preprocess;
|
||||||
|
|
||||||
char *
|
char *
|
||||||
GetIdentifier()
|
GetIdentifier()
|
||||||
|
@ -274,17 +274,12 @@ do_include()
|
||||||
inctable[0] = WorkingDir;
|
inctable[0] = WorkingDir;
|
||||||
if (filenm) {
|
if (filenm) {
|
||||||
if (!InsertFile(filenm, &inctable[tok==FILESPECIFIER],&result)){
|
if (!InsertFile(filenm, &inctable[tok==FILESPECIFIER],&result)){
|
||||||
#ifndef MKDEP
|
if (do_preprocess) error("cannot find include file \"%s\"", filenm);
|
||||||
error("cannot find include file \"%s\"", filenm);
|
else warning("cannot find include file \"%s\"", filenm);
|
||||||
#else
|
|
||||||
warning("cannot find include file \"%s\"", filenm);
|
|
||||||
add_dependency(filenm);
|
add_dependency(filenm);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef MKDEP
|
|
||||||
add_dependency(result);
|
add_dependency(result);
|
||||||
#endif
|
|
||||||
WorkingDir = getwdir(result);
|
WorkingDir = getwdir(result);
|
||||||
svnestlevel[++nestcount] = nestlevel;
|
svnestlevel[++nestcount] = nestlevel;
|
||||||
FileName = result;
|
FileName = result;
|
||||||
|
|
|
@ -8,19 +8,20 @@
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
#include <em_arith.h>
|
#include <em_arith.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <system.h>
|
||||||
#include "file_info.h"
|
#include "file_info.h"
|
||||||
#include "idfsize.h"
|
#include "idfsize.h"
|
||||||
#include "mkdep.h"
|
|
||||||
#ifdef MKDEP
|
|
||||||
#include "idf.h"
|
#include "idf.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char *symbol2str();
|
extern char *symbol2str();
|
||||||
extern char *getwdir();
|
extern char *getwdir();
|
||||||
extern int err_occurred;
|
extern int err_occurred;
|
||||||
|
extern int do_dependencies;
|
||||||
|
extern char *dep_file;
|
||||||
int idfsize = IDFSIZE;
|
int idfsize = IDFSIZE;
|
||||||
extern char options[];
|
extern char options[];
|
||||||
|
static File *dep_fd = STDOUT;
|
||||||
|
|
||||||
arith ifval;
|
arith ifval;
|
||||||
|
|
||||||
|
@ -56,9 +57,6 @@ main(argc, argv)
|
||||||
do_option(par);
|
do_option(par);
|
||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
}
|
}
|
||||||
#ifdef MKDEP
|
|
||||||
options['P'] = 1;
|
|
||||||
#endif
|
|
||||||
compile(argc - 1, &argv[1]);
|
compile(argc - 1, &argv[1]);
|
||||||
exit(err_occurred);
|
exit(err_occurred);
|
||||||
}
|
}
|
||||||
|
@ -89,12 +87,9 @@ compile(argc, argv)
|
||||||
source ? source : "stdin");
|
source ? source : "stdin");
|
||||||
if (source) WorkingDir = getwdir(dummy);
|
if (source) WorkingDir = getwdir(dummy);
|
||||||
preprocess(source);
|
preprocess(source);
|
||||||
#ifdef MKDEP
|
if (do_dependencies) list_dependencies(source);
|
||||||
list_dependencies(source);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MKDEP
|
|
||||||
struct idf *file_head;
|
struct idf *file_head;
|
||||||
extern char *strrindex();
|
extern char *strrindex();
|
||||||
|
|
||||||
|
@ -120,6 +115,9 @@ list_dependencies(source)
|
||||||
}
|
}
|
||||||
else source = 0;
|
else source = 0;
|
||||||
}
|
}
|
||||||
|
if (dep_file && !sys_open(dep_file, OP_WRITE, &dep_fd)) {
|
||||||
|
fatal("could not open %s", dep_file);
|
||||||
|
}
|
||||||
while (p) {
|
while (p) {
|
||||||
assert(p->id_resmac == K_FILE);
|
assert(p->id_resmac == K_FILE);
|
||||||
dependency(p->id_text, source);
|
dependency(p->id_text, source);
|
||||||
|
@ -140,12 +138,13 @@ add_dependency(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependency(s, source)
|
dependency(s, source)
|
||||||
char *s;
|
char *s, *source;
|
||||||
{
|
{
|
||||||
if (options['s'] && !strncmp(s, "/usr/include/", 13)) {
|
if (options['s'] && !strncmp(s, "/usr/include/", 13)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (options['m'] && source) print("%s: ", source);
|
if (options['m'] && source) {
|
||||||
print("%s\n", s);
|
fprint(dep_fd, "%s: %s\n", source, s);
|
||||||
|
}
|
||||||
|
else fprint(dep_fd, "%s\n", s);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -10,13 +10,15 @@
|
||||||
#include "class.h"
|
#include "class.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
#include "idf.h"
|
#include "idf.h"
|
||||||
#include "mkdep.h"
|
|
||||||
|
|
||||||
char options[128]; /* one for every char */
|
char options[128]; /* one for every char */
|
||||||
int inc_pos = 1; /* place where next -I goes */
|
int inc_pos = 1; /* place where next -I goes */
|
||||||
int inc_max;
|
int inc_max;
|
||||||
int inc_total;
|
int inc_total;
|
||||||
|
int do_preprocess = 1;
|
||||||
|
int do_dependencies = 0;
|
||||||
char **inctable;
|
char **inctable;
|
||||||
|
char *dep_file = 0;
|
||||||
|
|
||||||
extern int idfsize;
|
extern int idfsize;
|
||||||
int txt2int();
|
int txt2int();
|
||||||
|
@ -26,20 +28,25 @@ do_option(text)
|
||||||
{
|
{
|
||||||
switch(*text++) {
|
switch(*text++) {
|
||||||
case '-':
|
case '-':
|
||||||
#ifdef MKDEP
|
|
||||||
case 'x':
|
case 'x':
|
||||||
#endif
|
|
||||||
options[*text] = 1;
|
options[*text] = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifndef MKDEP
|
|
||||||
error("illegal option: %c", text[-1]);
|
error("illegal option: %c", text[-1]);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 'C' : /* comment output */
|
case 'C' : /* comment output */
|
||||||
case 'P' : /* run preprocessor stand-alone, without #'s */
|
case 'P' : /* run preprocessor stand-alone, without #'s */
|
||||||
options[*(text-1)] = 1;
|
options[*(text-1)] = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'd' : /* dependency generation */
|
||||||
|
do_dependencies = 1;
|
||||||
|
if (*text) {
|
||||||
|
dep_file = text;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
do_preprocess = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'D' : /* -Dname : predefine name */
|
case 'D' : /* -Dname : predefine name */
|
||||||
{
|
{
|
||||||
register char *cp = text, *name, *mactext;
|
register char *cp = text, *name, *mactext;
|
||||||
|
|
|
@ -14,42 +14,32 @@
|
||||||
#include "idfsize.h"
|
#include "idfsize.h"
|
||||||
#include "bits.h"
|
#include "bits.h"
|
||||||
#include "line_prefix.h"
|
#include "line_prefix.h"
|
||||||
#include "mkdep.h"
|
|
||||||
|
|
||||||
#ifdef DOBITS
|
#ifdef DOBITS
|
||||||
char bits[128];
|
char bits[128];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MKDEP
|
|
||||||
char _obuf[OBUFSIZE];
|
char _obuf[OBUFSIZE];
|
||||||
|
extern int do_preprocess;
|
||||||
|
|
||||||
Xflush()
|
Xflush()
|
||||||
{
|
{
|
||||||
sys_write(STDOUT, _obuf, OBUFSIZE);
|
if (do_preprocess) sys_write(STDOUT, _obuf, OBUFSIZE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
preprocess(fn)
|
preprocess(fn)
|
||||||
char *fn;
|
char *fn;
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
#ifndef MKDEP
|
|
||||||
register char *op = _obuf;
|
register char *op = _obuf;
|
||||||
register char *ob = &_obuf[OBUFSIZE];
|
register char *ob = &_obuf[OBUFSIZE];
|
||||||
#endif
|
|
||||||
char Xbuf[256];
|
char Xbuf[256];
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
extern char options[];
|
extern char options[];
|
||||||
|
|
||||||
#ifndef MKDEP
|
#define flush(X) (! do_preprocess || sys_write(STDOUT,_obuf,X))
|
||||||
#define flush(X) (sys_write(STDOUT,_obuf,X))
|
|
||||||
#define echo(ch) if (op == ob) { Xflush(); op = _obuf; } *op++ = (ch);
|
#define echo(ch) if (op == ob) { Xflush(); op = _obuf; } *op++ = (ch);
|
||||||
#define newline() echo('\n')
|
#define newline() echo('\n')
|
||||||
#else
|
|
||||||
#define flush(X)
|
|
||||||
#define echo(ch) (ch)
|
|
||||||
#define newline()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (! options['P']) {
|
if (! options['P']) {
|
||||||
/* Generate a line directive communicating the
|
/* Generate a line directive communicating the
|
||||||
|
|
Loading…
Reference in a new issue