Skip to content
Snippets Groups Projects
Commit ff2ffc38 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

Fixdepends re-implemented

Rev: bin/fixdepends.lpc:1.2(DEAD)
Rev: bin/fixdepends.sh:1.1
parent 933d365a
No related branches found
No related tags found
No related merge requests found
#!/usr/local/bin/ulpc
#define FILESET "a-zA-Z0-9./,_-"
#define DEPENDLINE "\n#Dependencies begin here, DO NOT REMOVE THIS LINE!!!!\n"
int main(int argc, string *argv)
{
string f,makefile,pre,file;
if(argc<2)
{
perror("Usage: fixdepends <makefile>\n");
exit(1);
}
if(!file_stat(argv[1]))
{
perror("Makefile not found.\n");
exit(1);
}
// Read depends from stdin
f=clone((program)"/precompiled/file","stdin")->read(0x7fffffff);
makefile=read_bytes(argv[1]);
sscanf(makefile,"%s" DEPENDLINE,makefile);
mv(argv[1],argv[1]+"~");
makefile+=DEPENDLINE;
while(strlen(f) && sscanf(f,"%[^" FILESET "]%s",pre,f)==2)
{
sscanf(f,"%[" FILESET "]%s",file,f);
makefile+=pre+(explode(file,"/")[-1]); // Basename
}
makefile+=f;
write_file(argv[1],makefile);
}
#!/bin/sh
cd $1
(
cat Makefile.src
echo "# Depencies begin here"
sed 's@[-/a-zA-Z0-9.,_]*/\([-a-zA-Z0-9.,_]*\)@\1@g'
) > Makefile.in
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment