##
#
# Makefile of libaio
#   Makefile of libaio, pasky's asynchronous I/O library
#
# Copyright (C) 2001,2002,2005  Petr Baudis <pasky@ucw.cz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
##

#### CONFIGURATION

PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/man

CUSTOM_CFLAGS=-ggdb
SYS_CFLAGS=
INCLUDES=-I.

LD=ld
AR=ar

### CONFIGURATION END

ifndef INSTALL
INSTALL=/usr/bin/install
endif

export


SYS_CFLAGS += -Wall -Werror -pedantic
LDFLAGS += -L.

OBJS=socket.o addr.o select.o bufio.o

all: all-recursive libaio.a doc

libaio.a: $(OBJS) $(LOCALLIBS)
	$(call cmd,archive)

# install-recursive?
install:
	@echo "Nothing to do in this directory, goodbye"

doc:
	for h in addr bufio select socket; do \
		./mkman.pl $$h.h <$$h.h >man/$$h.3; \
	done


clean: clean-recursive
	rm -f libaio.a *.o
	rm -f test1 test2 test3 test1-srv test2-srv test3-srv

test: test1-do test2-do test3-do

test1: test1.o libaio.a
	$(call cmd,link)
test2: test2.o libaio.a
	$(call cmd,link)
test3: test3.o libaio.a
	$(call cmd,link)

test1-do: test1
	$(call cmd,test)
test2-do: test2
	$(call cmd,test)
test3-do: test3
	$(call cmd,test)

-include Makefile.lib
