Imported Upstream version 3.2.2
[debian/gnuradio] / omnithread / dir.mk
1 ifeq ($(ThreadSystem),Solaris)
2 CXXSRCS = solaris.cc
3 DIR_CPPFLAGS = $(OMNITHREAD_CPPFLAGS)
4 endif
5
6 ifeq ($(ThreadSystem),Posix)
7 CXXSRCS = posix.cc
8 DIR_CPPFLAGS = $(OMNITHREAD_CPPFLAGS) $(OMNITHREAD_POSIX_CPPFLAGS)
9 endif
10
11 ifeq ($(ThreadSystem),NT)
12 CXXSRCS = nt.cc
13 DIR_CPPFLAGS = $(OMNITHREAD_CPPFLAGS)
14 MSVC_STATICLIB_CXXNODEBUGFLAGS += -D_WINSTATIC
15 MSVC_STATICLIB_CXXDEBUGFLAGS += -D_WINSTATIC
16 MSVC_DLL_CXXNODEBUGFLAGS += -D_OMNITHREAD_DLL
17 MSVC_DLL_CXXDEBUGFLAGS += -D_OMNITHREAD_DLL
18 endif
19
20 ifeq ($(ThreadSystem),NTPosix)
21 CXXSRCS = posix.cc
22 DIR_CPPFLAGS = $(OMNITHREAD_CPPFLAGS)
23 MSVC_STATICLIB_CXXNODEBUGFLAGS += -D_WINSTATIC
24 MSVC_STATICLIB_CXXDEBUGFLAGS += -D_WINSTATIC
25 MSVC_DLL_CXXNODEBUGFLAGS += -D_OMNITHREAD_DLL
26 MSVC_DLL_CXXDEBUGFLAGS += -D_OMNITHREAD_DLL
27 endif
28
29 ifeq ($(ThreadSystem),Mach)
30 CXXSRCS = mach.cc
31 DIR_CPPFLAGS = $(OMNITHREAD_CPPFLAGS)
32 endif
33
34 ifeq ($(ThreadSystem),vxWorks)
35 CXXSRCS = vxWorks.cc
36 OBJS = vxWorks.o
37 DIR_CPPFLAGS = $(OMNITHREAD_CPPFLAGS)
38 endif
39
40 LIB_NAME     := omnithread
41 LIB_VERSION  := $(OMNITHREAD_VERSION)
42 LIB_OBJS     := $(CXXSRCS:.cc=.o)
43 LIB_IMPORTS  := $(OMNITHREAD_PLATFORM_LIB)
44
45 all:: mkstatic mkshared
46
47 export:: mkstatic mkshared
48
49 ifdef INSTALLTARGET
50 install:: mkstatic mkshared
51 endif
52
53 vers := $(subst ., ,$(LIB_VERSION))
54 ifeq ($(words $(vers)), 2)
55   vers  := _ $(vers)
56   major := ""
57 else
58   major := $(word 1, $(vers))
59 endif
60
61 namespec := $(LIB_NAME) $(vers)
62
63 ##############################################################################
64 # Build Static library
65 ##############################################################################
66
67 ifndef NoStaticLibrary
68
69 staticlib := static/$(patsubst %,$(LibNoDebugPattern),$(LIB_NAME)$(major))
70
71 mkstatic::
72         @(dir=static; $(CreateDir))
73
74 mkstatic:: $(staticlib)
75
76 $(staticlib): $(patsubst %, static/%, $(LIB_OBJS))
77         @$(StaticLinkLibrary)
78
79 export:: $(staticlib)
80         @$(ExportLibrary)
81
82 ifdef INSTALLTARGET
83 install:: $(staticlib)
84         @$(InstallLibrary)
85 endif
86
87 clean::
88         $(RM) static/*.o
89         $(RM) $(staticlib)
90
91 veryclean::
92         $(RM) static/*.o
93         $(RM) $(staticlib)
94
95 else
96
97 mkstatic::
98
99 endif
100
101
102 ##############################################################################
103 # Build Shared library
104 ##############################################################################
105 ifdef BuildSharedLibrary
106
107 shlib := shared/$(shell $(SharedLibraryFullName) $(namespec))
108
109 ifdef Win32Platform
110 # in case of Win32 lossage:
111   imps := $(patsubst $(DLLDebugSearchPattern),$(DLLNoDebugSearchPattern), \
112           $(LIB_IMPORTS))
113 else
114   imps := $(LIB_IMPORTS)
115 endif
116
117 mkshared::
118         @(dir=shared; $(CreateDir))
119
120 mkshared:: $(shlib)
121
122 $(shlib): $(patsubst %, shared/%, $(LIB_OBJS))
123         @(namespec="$(namespec)" extralibs="$(imps)" nodeffile=1; \
124          $(MakeCXXSharedLibrary))
125
126 export:: $(shlib)
127         @(namespec="$(namespec)"; \
128           $(ExportSharedLibrary))
129
130 ifdef INSTALLTARGET
131 install:: $(shlib)
132         @(namespec="$(namespec)"; \
133           $(InstallSharedLibrary))
134 endif
135
136 clean::
137         $(RM) shared/*.o
138         (dir=shared; $(CleanSharedLibrary))
139
140 veryclean::
141         $(RM) shared/*.o
142         @(dir=shared; $(CleanSharedLibrary))
143
144 else
145
146 mkshared::
147
148 endif
149
150 ##############################################################################
151 # Build debug libraries for Win32
152 ##############################################################################
153 ifdef Win32Platform
154
155 ifdef BuildSharedLibrary
156
157 all:: mkstaticdbug mkshareddbug
158
159 export:: mkstaticdbug mkshareddbug
160
161 else
162
163 all:: mkstaticdbug
164
165 export:: mkstaticdbug
166
167 endif
168
169
170 #####################################################
171 #      Static debug libraries
172 #####################################################
173
174 dbuglib := debug/$(patsubst %,$(LibDebugPattern),$(LIB_NAME)$(major))
175
176 mkstaticdbug::
177         @(dir=debug; $(CreateDir))
178
179 mkstaticdbug:: $(dbuglib)
180
181 $(dbuglib): $(patsubst %, debug/%, $(LIB_OBJS))
182         @$(StaticLinkLibrary)
183
184 export:: $(dbuglib)
185         @$(ExportLibrary)
186
187 clean::
188         $(RM) debug/*.o
189         $(RM) $(dbuglib)
190
191 veryclean::
192         $(RM) debug/*.o
193         $(RM) $(dbuglib)
194
195 #####################################################
196 #      DLL debug libraries
197 #####################################################
198
199 ifdef BuildSharedLibrary
200
201 dbugshlib := shareddebug/$(shell $(SharedLibraryDebugFullName) $(namespec))
202
203 dbugimps  := $(patsubst $(DLLNoDebugSearchPattern),$(DLLDebugSearchPattern), \
204                $(LIB_IMPORTS))
205
206 mkshareddbug::
207         @(dir=shareddebug; $(CreateDir))
208
209 mkshareddbug:: $(dbugshlib)
210
211 $(dbugshlib): $(patsubst %, shareddebug/%, $(LIB_OBJS))
212         (namespec="$(namespec)" debug=1 extralibs="$(dbugimps)" nodeffile=1; \
213          $(MakeCXXSharedLibrary))
214
215 export:: $(dbugshlib)
216         @(namespec="$(namespec)" debug=1; \
217           $(ExportSharedLibrary))
218
219 clean::
220         $(RM) shareddebug/*.o
221         @(dir=shareddebug; $(CleanSharedLibrary))
222
223 veryclean::
224         $(RM) shareddebug/*.o
225         @(dir=shareddebug; $(CleanSharedLibrary))
226
227 endif
228 endif
229