Imported Upstream version 20080930
[ltp-debian.git] / testcases / kernel / syscalls / eventfd / Makefile
blobda9faa0c20a875f2ad7881b86bbbe29058d131dc
2 # Copyright (c) International Business Machines Corp., 2001
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.
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.
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
19 include ../utils/cond.mk
22 CFLAGS += -I../../../../include -Wall
23 LDLIBS += -L../../../../lib -lltp
25 check_aio_eventfd = $(shell \
26 if echo -e \
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)
36 HAS_LIBAIO = $(call check_header,libaio.h)
37 HAS_LIBAIO_EVENTFD = $(call check_aio_eventfd)
39 ifeq ($(HAS_LIBAIO_EVENTFD),yes)
40 CFLAGS += -DHAS_AIO_EVENTFD
41 LDLIBS += -laio
42 endif
44 SRCS = $(wildcard *.c)
45 TARGETS = $(patsubst %.c, %, $(wildcard *.c))
47 all: $(TARGETS)
48 ifeq ($(HAS_LIBAIO),no)
49 @echo "Note: Libaio is required for eventfd overflow testing.";
50 else
51 ifeq ($(HAS_LIBAIO_EVENTFD),no)
52 @echo "Note: Eventfd support is required in libaio for overflow testing.";
53 endif
54 endif
56 install:
57 @set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
59 clean:
60 rm -f $(TARGETS)