all: bench artillery sigio artillery-fork artillery-thread

DIET=/opt/diet/bin/diet #-Os
CFLAGS=-g #-DDEBUG

bench: bench.c
	$(DIET) gcc $(CFLAGS) -o $@ $^ -lowfat

artillery: artillery.o libenot.a
	$(DIET) gcc $(CFLAGS) -o $@ $^ -lowfat

artillery-fork: artillery.c
	$(DIET) gcc $(CFLAGS) -o $@ $^ -DUSE_FORK -lowfat

artillery-thread: artillery.c
	gcc -Os $(CFLAGS) -o $@ $^ -DUSE_THREADS -lowfat -lpthread

libenot.a: enot_poll.o enot.o
	ar cru $@ $^

%.o: %.c
	$(DIET) gcc $(CFLAGS) -c $^

t: epoll.c
	$(DIET) gcc $(CFLAGS) -o t epoll.c

sigio: sigio.c
	$(DIET) gcc $(CFLAGS) -o $@ $^

.PHONY: clean
clean:
	rm -f *.[oa] artillery sigio epoll burden bench enot.tar.gz \
	artillery-fork artillery-thread
