Makefile revision ed8da9dd20cdfa72f2903d4f26b789401e20c4f5
1#
2#  Copyright (c) International Business Machines  Corp., 2001
3#
4#  This program is free software;  you can redistribute it and/or modify
5#  it under the terms of the GNU General Public License as published by
6#  the Free Software Foundation; either version 2 of the License, or
7#  (at your option) any later version.
8#
9#  This program is distributed in the hope that it will be useful,
10#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
11#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
12#  the GNU General Public License for more details.
13#
14#  You should have received a copy of the GNU General Public License
15#  along with this program;  if not, write to the Free Software
16#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17#
18
19include ../utils/cond.mk
20
21
22CFLAGS += -I../../../../include -Wall
23LDLIBS += -L../../../../lib -lltp
24
25check_aio_eventfd = $(shell \
26	if printf \
27	"\#include <libaio.h>\n\
28	int main() \
29	{ \
30	io_set_eventfd(NULL, 0); \
31	return 0; \
32	}" | $(CC) -xc -laio - > /dev/null 2>&1 ; \
33	then echo yes ; \
34	else echo no ; fi)
35
36HAS_LIBAIO = $(call check_header,libaio.h)
37HAS_LIBAIO_EVENTFD = $(call check_aio_eventfd)
38
39ifeq ($(HAS_LIBAIO_EVENTFD),yes)
40CFLAGS += -DHAS_AIO_EVENTFD
41LDLIBS += -laio
42endif
43
44SRCS    = $(wildcard *.c)
45TARGETS = $(patsubst %.c, %, $(wildcard *.c))
46
47all: $(TARGETS)
48ifeq ($(HAS_LIBAIO),no)
49	@echo "Note: Libaio is required for eventfd overflow testing.";
50else
51ifeq ($(HAS_LIBAIO_EVENTFD),no)
52	@echo "Note: Eventfd support is required in libaio for overflow testing.";
53endif
54endif
55
56install:
57	@set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
58
59clean:
60	rm -f $(TARGETS) a.out
61
62