# These are some hacks, because the Makefile.in in libiberty has no
# templates like @srcdir@
/^srcdir.*=/{
s!^srcdir.*=.*$!srcdir=$(SRCDIR)!
i\
VPATH = $(srcdir)
}
s/^prefix.*=.*$/prefix=$(DJDIR)/
s/^CC.*=.*$/CC=gcc/
s/^CFLAGS.*=.*$/CFLAGS=-O/

/^needed2\.awk:.*$/,/^$/{
/^	.*$/d
/^$/{
r needed2.sed
}
}

/^needed\.awk:.*$/,/^$/{
/^	.*$/d
/^$/{
r needed.sed
}
}

/dummy\.o:.*$/,/^$/{
s/^	\($(CC).*\)2>.*$/	redir -e nul \1/
}

/errors:.*$/,/^$/{
s/^	-(\(.*\)).*>errors.*$/	-redir -o errors.tmp -eo \1/
/^$/{
i\
	update errors.tmp errors
}
}

/lconfig.h:.*$/,/^$/{
/^	.*".*$/d
s/^	.*awk.*$/	redir -i errors -o lconfig.h awk -f needed2.awk/
}

/config\.h:.*$/,/^$/{
s/^	cp/	update/
}

/lneeded-list:.*$/,/^$/{
/^	.*$/d
/^$/{
i\
	redir -o lneeded-list -i errors awk -f needed.awk
}
}

/needed-list:.*$/,/^$/{
s/^	cp/	update/
}

s/`cat needed-list`/stmp-ofiles/

/$(RULE2):.*$/,/^$/{
/^$/{
i\

i\
$(HOST_OFILES):
i\
	$(MAKE) $(FLAGS_TO_PASS) HOST_OFILES= @needed-list
i\
	touch stmp-ofiles
}
}

/required-list:.*$/,/^$/{
s/^	echo.*$/	echo.exe -o required-list $(REQUIRED_OFILES)/
}

/all:.*$/,/^$/{
s/^	.*$/#&/
}

/force:.*$/,/^$/{
/^$/{
i\

i\
dummy.o: alloca-conf.h
i\

i\
alloca-conf.h: alloca-normal.h
i\
	update $< $@
}
}

s/^Makefile:.*makedos.sed$/& needed.sed needed2.sed/

/^$(RULE2).*$/,/^$/{
s/\(^	.*\)\($(HOST_OFILES)\)/\1/
}
/.*@$(MULTICLEAN).*$/d
