prefix ?= /tmp

CC = gcc

CFLAGS ?= -Wall -O2 -s

SCRIPTS = host-key list-packages locate makedev mk_compaq_raid_dev news restore-config save-config setbbctime-utc trivial-net-setup
# boot-alternate-kernel is removed until monte works again
BINARIES = dotquad and or crypt sleep3 mktemp # zoom bounce
ETCFILES = bashrc host.conf issue profile services setuid-wrapper hosts protocols ld.so.conf nsswitch.conf resolv.conf motd fstab

all: $(BINARIES) setuid-wrapper

clean:
	rm -f $(BINARIES) *.o *~

install: all
	install $(SCRIPTS) $(BINARIES) $(DESTDIR)$(bindir)
	#cd $(DESTDIR)$(bindir); ln -sf reboot halt
	#cd $(DESTDIR)$(bindir); ln -sf reboot powerdown
	#cd $(DESTDIR)$(bindir); ln -sf reboot poweroff
	install -m 644 $(ETCFILES) $(DESTDIR)$(sysconfdir)

#bounce: bounce.c
#	$(CC) -o $@ $<

mktemp: mktemp.c
	$(CC) $(CFLAGS) -o $@ $<

and: andor.c
	$(CC) $(CFLAGS) -o $@ $< -DAND

or: andor.c
	$(CC) $(CFLAGS) -o $@ $< -DOR

zoom: zoom.c
	$(CC) $(CFLAGS) -o $@ $< -ljpeg -laa -lm

crypt: crypt.c
	$(CC) $(CFLAGS) -o $@ $< -lcrypt

setuid-wrapper: setuid-wrapper.c
	$(CC) $(CFLAGS) -o $@ $<
