# add following to the CFLAGS if you want (values show the default):
# -DTTY='"/dev/tty1"'
# -DSHELL='"/bin/sh"'
# -DSASH='"/boot/sash:/sbin/sash:/bin/sash:/etc/sash"'
# -DINIT='"/bin/init:/sbin/init"'
# -DTIMEOUT=60

CFLAGS=-Wall -O2
LDFLAGS=-static

all:	failinit

failinit.o:	Makefile

clean:
	rm -f failinit *.o *~

install:	all
	@failinit=/etc/init; failinit_remount=/.remount; failinit_remountall=/.remountall; \
	for a in failinit failinit_remount failinit_remountall; do eval b=\"\$$$$a\"; \
	echo "cp $$a /etc"; cp "$$a" /etc; \
	[ -f "$$b" ] || { rm -f "$$b" && ln -s "/etc/$$a" "$$b"; }; \
	if cmp -s "/etc/$$a" "$$b"; then echo "ln -s /etc/$$a $$b"; \
	else echo "warning: cannot ln -s /etc/$$a $$b, perhaps you must rm $$b carefully"; \
	exit 1; fi; \
	chmod +x "/etc/$$a"; \
	done
	-strip /etc/failinit
#	[ -f /etc/init ] || { rm -f /etc/init && ln -s /etc/failinit /etc/init }
#	@if cmp -s /etc/init /etc/failinit; then true; \
#	else echo "warning: cannot link /etc/failinit to /etc/init"; fail; \
#	fi

# This target is only for me, tino@augsburg.net
dist:
	lsm-dist
