1CC = gcc
2CFLAGS = -O2 -Wall
3prefix =
4includedir = $(prefix)/include
5libdir = $(prefix)/lib
6CPPFLAGS = -I$(includedir)
7LDFLAGS = -L$(libdir) -Wl,-rpath,$(libdir)
8
9all: check-call check-callback
10
11test-call: test-call.c testcases.c
12	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test-call test-call.c -lffi
13
14test-callback: test-callback.c testcases.c
15	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test-callback test-callback.c -lffi
16
17check-call: test-call
18	./test-call > test-call.out
19	LC_ALL=C uniq -u < test-call.out > failed-call
20	test '!' -s failed-call
21
22check-callback: test-callback
23	./test-callback > test-callback.out
24	LC_ALL=C uniq -u < test-callback.out > failed-callback
25	test '!' -s failed-callback
26
27clean:
28	rm -f test-call test-callback test-call.out test-callback.out failed-call failed-callback
29