]> git.saurik.com Git - apple/libdispatch.git/blob - src/Makefile.am
libdispatch-913.1.6.tar.gz
[apple/libdispatch.git] / src / Makefile.am
1 #
2 #
3 #
4
5 if HAVE_SWIFT
6 swiftlibdir=${prefix}/lib/swift/${OS_STRING}
7 swiftlib_LTLIBRARIES=libdispatch.la
8 else
9 lib_LTLIBRARIES=libdispatch.la
10 endif
11
12 if DISPATCH_USE_INTERNAL_WORKQUEUE
13 INTERNAL_WORKQUEUE_SOURCES= \
14 event/workqueue.c \
15 event/workqueue_internal.h
16 endif
17
18 libdispatch_la_SOURCES= \
19 allocator.c \
20 apply.c \
21 benchmark.c \
22 data.c \
23 init.c \
24 introspection.c \
25 io.c \
26 mach.c \
27 object.c \
28 once.c \
29 queue.c \
30 semaphore.c \
31 source.c \
32 time.c \
33 transform.c \
34 voucher.c \
35 protocol.defs \
36 provider.d \
37 allocator_internal.h \
38 data_internal.h \
39 inline_internal.h \
40 internal.h \
41 introspection_internal.h \
42 io_internal.h \
43 mach_internal.h \
44 object_internal.h \
45 queue_internal.h \
46 semaphore_internal.h \
47 shims.h \
48 source_internal.h \
49 trace.h \
50 voucher_internal.h \
51 event/event.c \
52 event/event_config.h \
53 event/event_epoll.c \
54 event/event_internal.h \
55 event/event_kevent.c \
56 firehose/firehose_internal.h \
57 shims/android_stubs.h \
58 shims/atomic.h \
59 shims/atomic_sfb.h \
60 shims/getprogname.h \
61 shims/hw_config.h \
62 shims/linux_stubs.c \
63 shims/linux_stubs.h \
64 shims/lock.c \
65 shims/lock.h \
66 shims/perfmon.h \
67 shims/time.h \
68 shims/tsd.h \
69 shims/yield.h \
70 $(INTERNAL_WORKQUEUE_SOURCES)
71
72 EXTRA_libdispatch_la_SOURCES=
73 EXTRA_libdispatch_la_DEPENDENCIES=
74
75 AM_CPPFLAGS=-I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/private
76
77 DISPATCH_CFLAGS=-Wall $(VISIBILITY_FLAGS) $(OMIT_LEAF_FP_FLAGS) \
78 $(MARCH_FLAGS) $(BSD_OVERLAY_CFLAGS)
79 if DISPATCH_ENABLE_ASSERTS
80 DISPATCH_CFLAGS+=-DDISPATCH_DEBUG=1
81 endif
82 AM_CFLAGS= $(PTHREAD_WORKQUEUE_CFLAGS) $(DISPATCH_CFLAGS) $(CBLOCKS_FLAGS)
83 AM_OBJCFLAGS=$(DISPATCH_CFLAGS) $(CBLOCKS_FLAGS)
84 AM_CXXFLAGS=$(PTHREAD_WORKQUEUE_CFLAGS) $(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS)
85 AM_OBJCXXFLAGS=$(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS)
86
87 if HAVE_PTHREAD_WORKQUEUES
88 PTHREAD_WORKQUEUE_LIBS=-lpthread_workqueue
89 PTHREAD_WORKQUEUE_CFLAGS=
90 endif
91
92 if BUILD_OWN_BLOCKS_RUNTIME
93 libdispatch_la_SOURCES+= BlocksRuntime/data.c BlocksRuntime/runtime.c
94 CBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime
95 CXXBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime
96 if USE_OBJC
97 BLOCKS_RUNTIME_LIBS=-ldl
98 endif
99 endif
100
101 libdispatch_la_LDFLAGS=-avoid-version
102 libdispatch_la_LIBADD=$(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS) $(BLOCKS_RUNTIME_LIBS)
103
104 if HAVE_DARWIN_LD
105 libdispatch_la_LDFLAGS+=-Wl,-compatibility_version,1 \
106 -Wl,-current_version,$(VERSION) -Wl,-dead_strip \
107 -Wl,-alias_list,$(top_srcdir)/xcodeconfig/libdispatch.aliases
108 endif
109
110 if USE_GOLD_LINKER
111 libdispatch_la_LDFLAGS+=-Xcompiler -fuse-ld=gold
112 endif
113
114 if USE_OBJC
115 libdispatch_la_SOURCES+=block.cpp data.m object.m
116 libdispatch_la_OBJCFLAGS=$(AM_OBJCFLAGS) -Wno-switch -fobjc-gc
117 libdispatch_la_CXXFLAGS=$(AM_CXXFLAGS) -std=gnu++11 -fno-exceptions
118 libdispatch_la_LDFLAGS+=-Wl,-upward-lobjc -Wl,-upward-lauto \
119 -Wl,-order_file,$(top_srcdir)/xcodeconfig/libdispatch.order
120 else
121 libdispatch_la_SOURCES+=block.cpp
122 libdispatch_la_CXXFLAGS=$(AM_CXXFLAGS) -std=gnu++11 -fno-exceptions
123 endif
124
125 if USE_MIG
126 MIG_SOURCES= \
127 protocolUser.c \
128 protocol.h \
129 protocolServer.c \
130 protocolServer.h
131
132 %User.c %.h %Server.c %Server.h: $(abs_srcdir)/%.defs
133 $(MIG) -user $*User.c -header $*.h \
134 -server $*Server.c -sheader $*Server.h $<
135 endif
136
137 if USE_DTRACE
138 DTRACE_SOURCES=provider.h
139
140 %.h: $(abs_srcdir)/%.d
141 $(DTRACE) -h -s $< -o $@
142 endif
143
144 if HAVE_SWIFT
145 SWIFT_SRC_FILES=\
146 swift/Block.swift \
147 swift/Data.swift \
148 swift/Dispatch.swift \
149 swift/IO.swift \
150 swift/Private.swift \
151 swift/Queue.swift \
152 swift/Source.swift \
153 swift/Time.swift \
154 swift/Wrapper.swift
155
156 SWIFT_ABS_SRC_FILES = $(SWIFT_SRC_FILES:%=$(abs_srcdir)/%)
157 SWIFT_OBJ_FILES = $(abs_builddir)/swift/swift_overlay.o
158 SWIFT_LIBTOOL_OBJ_FILES = $(abs_builddir)/swift/swift_overlay.lo
159
160 SWIFTC_FLAGS+= -Xcc -fmodule-map-file=$(abs_top_srcdir)/dispatch/module.modulemap -I$(abs_top_srcdir) -Xcc -fblocks
161 if DISPATCH_ENABLE_OPTIMIZATION
162 SWIFTC_FLAGS+=-O
163 endif
164
165 # this saves the object file, then tricks libtool into generating a .lo file and
166 # then moves the object file back in the places libtool expects them to be for
167 # the PIC and non-PIC case.
168 $(abs_builddir)/swift/swift_overlay.lo: $(abs_builddir)/swift/swift_overlay.o
169 mv $(abs_builddir)/swift/swift_overlay.o $(abs_builddir)/swift/.libs/swift_overlay.o.save
170 $(LIBTOOL) --mode=compile --tag=CC true -o $< -c /dev/null
171 cp $(abs_builddir)/swift/.libs/swift_overlay.o.save $(abs_builddir)/swift/.libs/swift_overlay.o
172 mv $(abs_builddir)/swift/.libs/swift_overlay.o.save $(abs_builddir)/swift/swift_overlay.o
173
174 $(abs_builddir)/swift/swift_overlay.o: $(SWIFT_ABS_SRC_FILES) $(SWIFTC)
175 @rm -f $@
176 $(SWIFTC) -whole-module-optimization -emit-library -c $(SWIFT_ABS_SRC_FILES) \
177 $(SWIFTC_FLAGS) -module-name Dispatch -module-link-name dispatch \
178 -o $@ -emit-module-path $(abs_builddir)/swift/Dispatch.swiftmodule
179
180 libdispatch_la_SOURCES+=swift/DispatchStubs.cc
181 EXTRA_libdispatch_la_SOURCES+=$(SWIFT_SRC_FILES)
182
183 EXTRA_libdispatch_la_DEPENDENCIES+=$(SWIFT_OBJ_FILES) $(SWIFT_LIBTOOL_OBJ_FILES) $(abs_builddir)/swift/Dispatch.swiftmodule
184 libdispatch_la_LIBADD+=$(SWIFT_LIBTOOL_OBJ_FILES)
185
186 SWIFT_GEN_FILES= \
187 $(abs_builddir)/swift/Dispatch.swiftmodule \
188 $(abs_builddir)/swift/Dispatch.swiftdoc \
189 $(SWIFT_OBJ_FILES)
190
191 swiftmoddir=${prefix}/lib/swift/${OS_STRING}/${host_cpu}
192 swiftmod_HEADERS=\
193 $(abs_builddir)/swift/Dispatch.swiftmodule \
194 $(abs_builddir)/swift/Dispatch.swiftdoc
195 endif
196
197 BUILT_SOURCES=$(MIG_SOURCES) $(DTRACE_SOURCES)
198 nodist_libdispatch_la_SOURCES=$(BUILT_SOURCES)
199 CLEANFILES=$(BUILT_SOURCES) $(SWIFT_GEN_FILES)
200 DISTCLEANFILES=pthread_machdep.h pthread System mach objc