Tizen 2.1 base
[platform/upstream/gcd.git] / dispatch-1.0 / testing / Makefile.darwin
1 # No workie: dispatch_sema
2
3 MAKECMD=        $(MAKE) -f Makefile.darwin
4
5 TESTS=  dispatch_apply \
6         dispatch_api \
7         dispatch_c99 \
8         dispatch_cffd \
9         dispatch_debug \
10         queue_finalizer \
11         dispatch_group \
12         dispatch_pingpong \
13         dispatch_plusplus \
14         dispatch_priority \
15         dispatch_priority2 \
16         dispatch_proc \
17         dispatch_read \
18         dispatch_after \
19         dispatch_sema \
20         dispatch_timer_bit31 \
21         dispatch_timer_bit63 \
22         dispatch_starfish \
23         dispatch_cascade \
24         dispatch_drift \
25         dispatch_readsync \
26         nsoperation
27
28 all: harness summarize bench $(TESTS)
29         @lipo -remove x86_64 -output dispatch_timer_bit31 dispatch_timer_bit31 2>/dev/null || true
30
31 logs: $(addsuffix .testlog, $(TESTS))
32 debuglogs: $(addsuffix .debuglog, $(TESTS))
33
34 testbots:
35         $(MAKECMD) test
36
37 test: clean-logs
38         $(MAKECMD) _test
39
40 _test: all logs debuglogs
41         @cat *.testlog *.debuglog
42         @cat *.testlog *.debuglog | ./summarize
43
44 # Override ARCHS and SDKROOT to cross-build test suite
45
46 SRCS = dispatch_test.c
47 OBJS = $(SRCS:%.c=%.o)
48 ARCHS=i386 x86_64 ppc
49 CFLAGS = -Werror -Wall -Wextra -Wshadow -mdynamic-no-pic -Os -g $(patsubst %, -arch %,$(ARCHS)) -DDISPATCH_NO_LEGACY -I..
50 CPPFLAGS = $(CFLAGS)
51 LDFLAGS = $(patsubst %, -arch %,$(ARCHS))
52 LDLIBS = -lstdc++
53
54 ifneq ($(SDKROOT),)
55 CFLAGS += -isysroot $(SDKROOT)
56 LDFLAGS += -isysroot $(SDKROOT)
57 CC = xcrun -sdk $(SDKROOT) gcc
58 endif
59
60 harness: harness.o $(OBJS)
61 summarize: summarize.o
62 bench: bench.o func.o
63         $(CC) $(LDFLAGS) -framework Foundation $(LDLIBS) -o $@ $^
64
65 bench.o: bench.mm
66         $(CC) -x objective-c++ $(CFLAGS) -c $^ -o $@
67 func.o: func.c
68         $(CC) -x c++ $(CFLAGS) -c $^ -o $@
69
70 dispatch_apply: dispatch_apply.o $(OBJS)
71 dispatch_api: dispatch_api.o $(OBJS)
72 dispatch_c99: dispatch_c99.o $(OBJS)
73 dispatch_cffd: dispatch_cffd.o $(OBJS)
74         $(CC) $(LDFLAGS) -framework CoreFoundation -o $@ $^
75 dispatch_debug: dispatch_debug.o $(OBJS)
76 dispatch_group: dispatch_group.o $(OBJS)
77 dispatch_pingpong: dispatch_pingpong.o $(OBJS)
78 dispatch_plusplus: dispatch_plusplus.o $(OBJS)
79 dispatch_priority: dispatch_priority.o $(OBJS)
80 dispatch_priority2: dispatch_priority2.o $(OBJS)
81 dispatch_proc: dispatch_proc.o $(OBJS)
82 queue_finalizer: queue_finalizer.o $(OBJS)
83 dispatch_read:  dispatch_read.o $(OBJS)
84 dispatch_read2: dispatch_read2.o $(OBJS)
85 dispatch_after: dispatch_after.o $(OBJS)
86 dispatch_timer: dispatch_timer.o $(OBJS)
87 dispatch_suspend_timer: dispatch_suspend_timer.o $(OBJS)
88 dispatch_sema: dispatch_sema.o $(OBJS)
89 dispatch_timer_bit31: dispatch_timer_bit31.o $(OBJS)
90 dispatch_timer_bit63: dispatch_timer_bit63.o $(OBJS)
91 dispatch_drift: dispatch_drift.o $(OBJS)
92 dispatch_starfish: dispatch_starfish.o $(OBJS)
93 dispatch_cascade: dispatch_cascade.o $(OBJS)
94 dispatch_readsync: dispatch_readsync.o $(OBJS)
95 ENVIRON_nsoperation = NOLEAKS=1
96 nsoperation: nsoperation.o $(OBJS)
97         $(CC) $(LDFLAGS) -framework Foundation -o $@ $^
98
99 dispatch_api.o: dispatch_api.c
100         $(CC) -c $(CFLAGS) -include $(SDKROOT)/usr/include/dispatch/dispatch.h -pendantic -o $@ $^
101
102 dispatch_c99.o: dispatch_c99.c
103         $(CC) -c $(CFLAGS) -std=c99 -pedantic -o $@ $^
104
105 dispatch_priority2.o: dispatch_priority.c
106         $(CC) -c $(CFLAGS) -DUSE_SET_TARGET_QUEUE=1 -o $@ $^
107
108 $(addsuffix .testlog, $(TESTS)): harness $(TESTS)
109         $(ENVIRON_$(basename $@)) ./harness ./$(basename $@) > $@
110
111 $(addsuffix .debuglog, $(TESTS)): harness $(TESTS)
112         $(ENVIRON_$(basename $@)) DYLD_IMAGE_SUFFIX=_debug ./harness ./$(basename $@) > $@
113
114 clean-logs:
115         rm -f *.testlog *.debuglog *.leakslog
116
117 clean: clean-logs
118         rm -f *.o *.dSYM bench harness summarize $(TESTS)