home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 3
/
hamradioversion3.0examsandprograms1992.iso
/
packet
/
n17jsrc
/
mkdep.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-02-04
|
904b
|
44 lines
/* Simple-minded program that generates dependencies for a makefile.
* Does not process #ifdefs, so some spurious dependencies may be
* generated.
*
* Copyright 1991 Phil Karn, KA9Q
*/
#include <stdio.h>
#include <stdio.h>
#include <string.h>
char include[] = "#include";
main(argc,argv)
int argc;
char *argv[];
{
int i;
FILE *fp;
char buf[512],*cp,*cp1;
for(i=1;i<argc;i++){
strcpy(buf,argv[i]);
if((cp = strchr(buf,'.')) == NULL)
continue;
*cp = '\0';
printf("%s.obj: %s",buf,argv[i]);
fp = fopen(argv[i],"r");
while(fgets(buf,512,fp) != NULL){
if(strncmp(buf,include,sizeof(include)-1) != 0)
continue;
if((cp = strchr(buf,'\"')) == NULL)
continue;
cp++;
if((cp1 = strchr(cp,'\"')) == NULL)
continue;
putchar(' ');
while(cp != cp1)
putchar(*cp++);
}
putchar('\n');
fclose(fp);
}
return 0;
}