source: trunk/Config.kmk

Last change on this file was 328, checked in by cinc, 18 years ago

Added default path to Macports glib2 installation to PATH_SDK_glib2 calculation.

File size: 11.2 KB
Line 
1# $Id: $
2## @file
3# The main kBuild configration file for NOM.
4#
5
6
7#
8# Default build configuration.
9#
10
11# Override the installation path (anticipating kBuild changes).
12PATH_INS = $(PATH_OUT)/installed
13ifn1of ($(BUILD_TARGET),win)
14PATH_DLL = $(PATH_INS)/lib
15endif
16
17# Enable automatic installation of what's built.
18KBUILD_DO_AUTO_INSTALL := 1
19
20# Where to install the idl headers.
21NOM_INS_CLASS_H = include/nom/class_h/
22NOM_PATH_CLASS_H = $(PATH_INS)/$(patsubst %/,%,$(NOM_INS_CLASS_H))
23
24# Enables the building of testcases. Comment out to speed up the build.
25NOM_WITH_TESTCASES = 1
26
27
28#
29# Version and author stuff.
30#
31NOM_VERSION_MAJOR := 0
32NOM_VERSION_MINOR := 0
33NOM_VERSION_PATCH := 1
34NOM_VERSION_DOTTED := $(NOM_VERSION_MAJOR).$(NOM_VERSION_MINOR).$(NOM_VERSION_PATCH)
35NOM_VERSION_STRING := "$(NOM_VERSION_DOTTED)"
36NOM_VERSION_UNDERSCORED := $(subst .,_,$(NOM_VERSION_DOTTED))
37NOM_AUTHOR_STRING := "(C) Chris Wohlgemuth 2003-2007"
38
39
40
41#
42# Include any configuration files.
43# The AutoConfig.kmk is generated, while LocalConfig.kmk is where local modifications go.
44#
45NOM_AUTO_CONFIG := $(wildcard $(PATH_ROOT)/AutoConfig.kmk)
46ifneq ($(NOM_AUTO_CONFIG),)
47 include $(NOM_AUTO_CONFIG)
48endif
49
50NOM_LOCAL_CONFIG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
51ifneq ($(NOM_LOCAL_CONFIG),)
52 include $(NOM_LOCAL_CONFIG)
53endif
54
55
56#
57# .idl -> .h and .ih.
58#
59
60# The name of the IDL compiler we're using during compilation
61ifeq ($(BUILD_TARGET).$(BUILD_TARGET_ARCH),$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH))
62 NOM_IDL_COMPILER = $(PATH_BIN)/nom-idl-compiler$(SUFF_EXE)
63else
64 NOM_IDL_COMPILER = $(PATH_BIN)/nom-idl-compiler$(HOSTSUFF_EXE)
65endif
66
67# Tell kBuild about the IDLINCS and IDLDEFS.
68PROPS_ACCUMULATE_L += IDLINCS
69PROPS_ACCUMULATE_R += IDLDEFS
70PROPS_ACCUMULATE_L_LNK += IDLINCS
71PROPS_ACCUMULATE_R_LNK += IDLDEFS
72
73##
74# Double eval define that def_nom_hnadle_idl makes use of for defining the rules.
75## @todo fix missing dependencies here.
76define def_nom_handle_idl_rules
77
78$(idl_pre): $(mysrc) | $(call DIRDEP,$(idl_pre_dir))
79 $(call MSG_TOOL,CPP,$(target),$$<,$(mysrc))
80ifeq ($(BUILD_TARGET),win)
81 $(REDIRECT) -o $$@ -- $$(TOOL_$$(TEMPLATE_basebin_TOOL)_CC) -nologo -E $(addprefix -D,$(defs) __NOM_IDL_COMPILER__) $(addprefix -I,$(incs)) $(mysrc)
82else
83 $(REDIRECT) -o $$@ -- $$(TOOL_$$(TEMPLATE_basebin_TOOL)_CC) -E -x c $(addprefix -D,$(defs) __NOM_IDL_COMPILER__) $(addprefix -I,$(incs)) $(mysrc)
84endif
85
86$(idl_h): $(idl_pre) | $(NOM_IDL_COMPILER) $(call DIRDEP,$(NOM_PATH_CLASS_H))
87 $(call MSG_TOOL,idl-h,$(target),$$<,$(mysrc))
88 $(QUIET2)$(RM) -f $$@
89 $(QUIET)$(NOM_IDL_COMPILER) --emit-h -d $$(@D) $$<
90 $(QUIET)$(TEST) '!' -f $$@ -- $(APPEND) $$@
91
92$(idl_ih): $(idl_pre) | $(NOM_IDL_COMPILER) $(call DIRDEP,$(NOM_PATH_CLASS_H))
93 $(call MSG_TOOL,idl-ih,$(target),$$<,$(mysrc))
94 $(QUIET2)$(RM) -f $$@
95 $(QUIET)$(NOM_IDL_COMPILER) --emit-ih -d $$(@D) $$<
96 $(QUIET)$(TEST) '!' -f $$@ -- $(APPEND) $$@
97
98$(idl_c): $(idl_pre) | $(NOM_IDL_COMPILER) $(call DIRDEP,$(idl_c_dir))
99 $(call MSG_TOOL,idl-c,$(target),$$<,$(mysrc))
100 $(QUIET2)$(RM) -f $$@
101 $(QUIET)$(NOM_IDL_COMPILER) --emit-c -d $$(@D) $$<
102 $(QUIET)$(TEST) '!' -f $$@ -- $(APPEND) $$@
103
104$(target)_INTERMEDIATES += $(idl_h) $(idl_ih) $(idl_c)
105
106endef # def_nom_handle_idl_rules
107
108##
109# Handler for .idl files listed in the SOURCES properties.
110#
111# .idl files are compiled into .ih and .h files which ends up in a class_h under
112# the target output dir.
113#
114# @param target The target file.
115# @param source The source file.
116# @param lots more
117# @returns quite a bit.
118# @remarks This SRC_HANDLERS stuff is a kBuild concept that's currently being
119# worked on, so this isn't working 100% the way it should quite yet (defs,++).
120define def_nom_handle_idl
121type := IDL
122
123# FIXME: This has to be put back to kBuild somehow.
124incs := $($(target)_IDLINCS) \
125 $($(target)_INCS)
126defs := \
127 $($(target)_IDLDEFS) \
128 $($(target)_DEFS)
129ifneq ($(defpath),)
130mysrc := $(abspathex $(source),$(defpath))
131incs := $(abspathex $(incs),$(defpath))
132else
133mysrc := $(source)
134endif
135
136# figure out the output
137idl_h := $(NOM_PATH_CLASS_H)/$(notdir $(source:.idl=.h))
138idl_ih := $(NOM_PATH_CLASS_H)/$(notdir $(source:.idl=.ih))
139idl_pre_dir := $(PATH_$(target))/class_pre
140idl_pre := $(idl_pre_dir)/$(notdir $(source:.idl=.pre))
141idl_c_dir := $(PATH_$(target))/class_c
142idl_c := $(idl_c_dir)/$(notdir $(source:.idl=-template.c))
143
144$(eval $(def_nom_handle_idl_rules))
145
146_OUT_FILES += $(idl_h) $(idl_ih) $(idl_c) $(idl_pre)
147_DIRS += $(NOM_PATH_CLASS_H) $(idl_c_dir) $(idl_pre_dir)
148
149# cleanup
150idl_pre :=
151idl_h :=
152idl_c :=
153idl_ih :=
154idl_dir :=
155mysrc :=
156
157endef # def_nom_handle_idl
158
159
160#
161# GLib v2.x SDK.
162#
163SDK_glib2 = GLib v2.x
164ifndef PATH_SDK_glib2
165 if1of ($(BUILD_TARGET),win)
166 SDK_glib2_FROM_NOM = 1
167 endif
168 ifdef SDK_glib2_FROM_NOM
169 PATH_SDK_glib2 := $(PATH_INS)
170 else
171 PATH_SDK_glib2 := $(firstword $(wildcard $(PATH_ROOT)/tools/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/glib/v2*) )
172 endif
173 ifeq ($(PATH_SDK_glib2),)
174 PATH_SDK_glib2 := $(patsubst %/include/glib-2.0/glib.h,%,$(firstword $(wildcard /usr/include/glib-2.0/glib.h /usr/local/include/glib-2.0/glib.h /opt/local/include/glib-2.0/glib.h) ))
175 endif
176else
177 PATH_SDK_glib2 := $(PATH_SDK_glib2)
178endif
179SDK_glib2_INCS = \
180 $(PATH_SDK_glib2)/include/glib-2.0 \
181 $(PATH_SDK_glib2)/lib/glib-2.0/include
182ifdef SDK_glib2_FROM_NOM
183 SDK_glib2_LIBS.darwin = \
184 $(PATH_SDK_glib2)/lib/libnomglib.dylib
185 SDK_glib2_LIBS.freebsd = \
186 $(PATH_SDK_glib2)/lib/libnomglib.so
187 SDK_glib2_LIBS.linux = \
188 $(PATH_SDK_glib2)/lib/libnomglib.so
189 SDK_glib2_LIBS.netbsd = \
190 $(PATH_SDK_glib2)/lib/libnomglib.so
191 SDK_glib2_LIBS.openbsd = \
192 $(PATH_SDK_glib2)/lib/libnomglib.so
193 SDK_glib2_LIBS.os2 = \
194 $(PATH_SDK_glib2)/lib/nomglib.dll
195 SDK_glib2_LIBS.solaris = \
196 $(PATH_SDK_glib2)/lib/libnomglib.so
197 SDK_glib2_LIBS.win = \
198 $(PATH_SDK_glib2)/lib/libnomglib.lib
199else
200 SDK_glib2_LIBS.darwin = \
201 $(PATH_SDK_glib2)/lib/libglib-2.0.dylib
202 SDK_glib2_LIBS.freebsd = \
203 $(PATH_SDK_glib2)/lib/libglib-2.0.so
204 SDK_glib2_LIBS.linux = \
205 $(PATH_SDK_glib2)/lib/libglib-2.0.so
206 SDK_glib2_LIBS.netbsd = \
207 $(PATH_SDK_glib2)/lib/libglib-2.0.so
208 SDK_glib2_LIBS.openbsd = \
209 $(PATH_SDK_glib2)/lib/libglib-2.0.so
210 SDK_glib2_LIBS.os2 = \
211 $(PATH_SDK_glib2)/lib/glib-2.0.a
212 SDK_glib2_LIBS.solaris = \
213 $(PATH_SDK_glib2)/lib/libglib-2.0.so
214 SDK_glib2_LIBS.win = \
215 $(PATH_SDK_glib2)/lib/glib-2.0.lib
216endif
217
218
219#
220# The main template.
221# All other templates except nombldprog are derived from this.
222#
223TEMPLATE_basebin = Executables.
224if1of ($(BUILD_TARGET),win nt)
225 ifeq ($(BUILD_TARGET_ARCH),x86)
226 TEMPLATE_basebin_TOOL = VCC70
227 else
228 TEMPLATE_basebin_TOOL = VCC80AMD64
229 endif
230 TEMPLATE_basebin_CFLAGS = -Zi -Zl -EHsc -GF -W3 -MD
231 TEMPLATE_basebin_CFLAGS.release = -O2
232 TEMPLATE_basebin_LDFLAGS = /NoD /LargeAddressAware /Incremental:NO /Debug -MapInfo:Lines -MapInfo:Exports
233 TEMPLATE_basebin_LIBS = \
234 $(PATH_TOOL_$(TEMPLATE_basebin_TOOL)_LIB)/msvcrt.lib \
235 $(PATH_TOOL_$(TEMPLATE_basebin_TOOL)_LIB)/msvcprt.lib \
236 $(PATH_TOOL_$(TEMPLATE_basebin_TOOL)_LIB)/oldnames.lib
237 TEMPLATE_basebin_SDKS.win = WINPSDK
238 TEMPLATE_basebin_DEFS = HAVE_IO_H
239else
240 ifeq ($(BUILD_TARGET),os2)
241 TEMPLATE_basebin_TOOL = GXX3OMF
242 else ifeq ($(BUILD_TARGET),darwin)
243 TEMPLATE_basebin_TOOL = GXX4MACHO
244 else
245 TEMPLATE_basebin_TOOL = GXX3
246 endif
247 TEMPLATE_basebin_CFLAGS = -g
248 TEMPLATE_basebin_CFLAGS.release = -O2
249 TEMPLATE_basebin_LDFLAGS = -g
250 TEMPLATE_basebin_LDFLAGS.darwin = -framework Carbon
251 if1of ($(BUILD_TARGET), freebsd linux netbsd openbsd solaris)
252 TEMPLATE_basebin_LIBS += pthread
253 endif
254 if1of ($(BUILD_TARGET), darwin)
255 TEMPLATE_basebin_LIBS += iconv
256 endif
257 TEMPLATE_basebin_DEFS = HAVE_UNISTD_H
258endif
259TEMPLATE_basebin_DEFS += GC_DLL
260TEMPLATE_basebin_DEFS.debug = DEBUG
261TEMPLATE_basebin_DEFS.release = NDEBUG
262TEMPLATE_basebin_INCS = \
263 $(PATH_ROOT)/nom/include \
264 $(NOM_PATH_CLASS_H) \
265 $(PATH_ROOT)/gc6.8/include
266TEMPLATE_basebin_IDLINCS = \
267 $(PATH_ROOT)/nom/idl
268TEMPLATE_basebin_INST = bin/
269TEMPLATE_basebin_SRC_HANDLERS = .idl:def_nom_handle_idl
270
271
272#
273# The library template.
274#
275TEMPLATE_baselib = Static libraries for linking with executables (non-PIC).
276TEMPLATE_baselib_EXTENDS = basebin
277TEMPLATE_baselib_INST = lib/
278
279
280#
281# The DLL / shared objects template.
282#
283TEMPLATE_basedll = DLLs / shared objects.
284TEMPLATE_basedll_EXTENDS = basebin
285TEMPLATE_basedll_EXTENDS_BY = prepending
286if1of ($(BUILD_TARGET), win nt)
287 TEMPLATE_basedll_INST = bin/ testcase/
288else
289 TEMPLATE_basedll_INST = lib/
290endif
291ifn1of ($(BUILD_TARGET), win nt os2)
292 TEMPLATE_basedll_CFLAGS = -fPIC
293 TEMPLATE_basedll_CXXFLAGS = -fPIC
294 TEMPLATE_basedll_LDFLAGS = -fPIC
295 TEMPLATE_basedll_DEFS = PIC
296endif
297
298
299#
300# The DLL / shared objects library template.
301#
302TEMPLATE_basedlllib = DLLs / shared objects.
303TEMPLATE_basedlllib_EXTENDS = basebin
304TEMPLATE_basedlllib_INST = lib/
305
306
307#
308# The testcase programs.
309#
310TEMPLATE_basetst = Testcase programs.
311TEMPLATE_basetst_EXTENDS = basebin
312TEMPLATE_basetst_INST = testcase/
313
314
315#
316# The template for NOM executables.
317#
318TEMPLATE_nombin = NOM Executables.
319TEMPLATE_nombin_EXTENDS = basebin
320TEMPLATE_nombin_EXTENDS_BY = appending
321ifeq ($(BUILD_TARGET),win)
322 TEMPLATE_nombin_LIBS = $(PATH_LIB)/libnomobjtk$(SUFF_LIB)
323else ifeq ($(BUILD_TARGET),os2)
324 TEMPLATE_nombin_LIBS = $(PATH_DLL)/nobjtk$(SUFF_DLL)
325else
326 TEMPLATE_nombin_LIBS = $(PATH_DLL)/libnomobjtk$(SUFF_DLL)
327endif
328TEMPLATE_nombin_SDKS = glib2
329
330
331#
332# The library template.
333#
334TEMPLATE_nomlib = Static libraries for linking with executables (non-PIC).
335TEMPLATE_nomlib_EXTENDS = nombin
336TEMPLATE_nomlib_INST = lib/
337
338
339#
340# The DLL / shared objects template.
341#
342TEMPLATE_nomdll = DLLs / shared objects.
343TEMPLATE_nomdll_EXTENDS = nombin
344TEMPLATE_nomdll_EXTENDS_BY = prepending
345if1of ($(BUILD_TARGET), win nt)
346 TEMPLATE_nomdll_INST = bin/ testcase/
347else
348 TEMPLATE_nomdll_INST = lib/
349endif
350ifn1of ($(BUILD_TARGET), win nt os2)
351 TEMPLATE_nomdll_CFLAGS = -fPIC
352 TEMPLATE_nomdll_CXXFLAGS = -fPIC
353 TEMPLATE_nomdll_LDFLAGS = -fPIC
354 TEMPLATE_nomdll_DEFS = PIC
355endif
356
357
358#
359# The DLL / shared objects library template.
360#
361TEMPLATE_nomdlllib = DLLs / shared objects.
362TEMPLATE_nomdlllib_EXTENDS = nombin
363TEMPLATE_nomdlllib_INST = lib/
364
365
366#
367# The testcase programs.
368#
369TEMPLATE_nomtst = Testcase programs.
370TEMPLATE_nomtst_EXTENDS = nombin
371TEMPLATE_nomtst_INST = testcase/
372
373## Todo GTK variations.
374
375#
376# Build programs.
377#
378TEMPLATE_nombldprog = Build program (cat be static)
379if1of ($(BUILD_PLATFORM),win nt)
380 ifeq ($(BUILD_PLATFORM_ARCH),x86)
381 TEMPLATE_nombldprog_TOOL = VCC70
382 else
383 TEMPLATE_nombldprog_TOOL = VCC80AMD64
384 endif
385 TEMPLATE_nombldprog_CFLAGS = -Zi -Zl -EHsc -GF -W3 -MT
386 TEMPLATE_nombldprog_CFLAGS.release = -O2
387 TEMPLATE_nombldprog_LIBS = \
388 $(PATH_TOOL_$(TEMPLATE_nombldprog_TOOL)_LIB)/oldnames.lib \
389 $(PATH_TOOL_$(TEMPLATE_nombldprog_TOOL)_LIB)/libcmt.lib
390else
391 ifeq ($(BUILD_PLATFORM),os2)
392 TEMPLATE_nombldprog_TOOL = GCC3OMF
393 else ifeq ($(BUILD_PLATFORM),darwin)
394 TEMPLATE_nombldprog_TOOL = GCC4MACHO
395 else
396 TEMPLATE_nombldprog_TOOL = GCC3
397 endif
398 TEMPLATE_nombldprog_CFLAGS = -g
399 TEMPLATE_nombldprog_CFLAGS.release = -O2
400endif
401TEMPLATE_nombldprog_DEFS.debug = DEBUG
402TEMPLATE_nombldprog_DEFS.release = NDEBUG
403
Note: See TracBrowser for help on using the repository browser.