1## -*-makefile-*-
2## BeOS-specific setup
3## Copyright (c) 2003-2006, International Business Machines Corporation and
4## others. All Rights Reserved.
5##
6## Original author: Andrew Bachmann
7
8## Commands to generate dependency files
9GEN_DEPS.c=  $(CC) -E -MM $(DEFS) $(CPPFLAGS)
10GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
11
12# Safe optimizations
13#OPTIMIZATIONS= -fdefault-inline -fdefer-pop -fforce-mem -fforce-addr \
14#	  -finline -finline-functions \
15#	  -fkeep-inline-functions -fkeep-static-consts -fbranch-count-reg \
16#	  -ffunction-cse -fstrength-reduce -fthread-jumps -fcse-follow-jumps \
17#	  -fcse-skip-blocks -frerun-cse-after-loop -frerun-loop-opt \
18#	  -fexpensive-optimizations -foptimize-register-move -fregmove \
19#	  -fschedule-insns -fschedule-insns2 -ffloat-store -funroll-loops \
20#	  -fmove-all-movables -freduce-all-givs -fpeephole \
21#	  -funroll-all-loops -ffunction-sections -fdata-sections
22
23# BeOS gccs (geekgadgets + 2.95.3) have this old bug: 
24# after this:          const wchar_t x[] = L"foo";
25# x[2] is "optimized" into: (wchar_t)((char *)x)[2] (== 0)
26#
27# see also: http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00454.html
28#
29# Unfortunately this behavior isn't controlled by a flag so we can't
30# use any O optimizations at all. (the behavior kicks in at -O1)
31
32# Optimizations aren't currently defined in the mh files.
33# So Don't override any flags set by the user or runConfigureICU.
34#CFLAGS += $(OPTIMIZATIONS)
35#CXXFLAGS += $(OPTIMIZATIONS)
36
37# Use -nostart instead of -shared
38SHLIB.c=      $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -nostart
39SHLIB.cc=     $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -nostart
40
41## Flags for position independent code
42SHAREDLIBCFLAGS = -fPIC
43SHAREDLIBCXXFLAGS = -fPIC
44SHAREDLIBCPPFLAGS = -DPIC
45
46## Additional flags when building libraries and with threads
47LIBCPPFLAGS = 
48THREADSCPPFLAGS = 
49
50## Compiler switch to embed a runtime search path
51LD_RPATH=	
52LD_RPATH_PRE = -Wl,-rpath,
53
54## Compiler switch to embed a library name
55LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
56
57## Shared object suffix
58SO = so
59## Non-shared intermediate object suffix
60STATIC_O = ao
61
62## Compilation rules
63%.$(STATIC_O): $(srcdir)/%.c
64	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
65%.o: $(srcdir)/%.c
66	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
67
68%.$(STATIC_O): $(srcdir)/%.cpp
69	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
70%.o: $(srcdir)/%.cpp
71	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
72
73
74## Dependency rules
75%.d: $(srcdir)/%.c
76	@echo "generating dependency information for $<"
77	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
78		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
79		[ -s $@ ] || rm -f $@'
80
81%.d: $(srcdir)/%.cpp
82	@echo "generating dependency information for $<"
83	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
84		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
85		[ -s $@ ] || rm -f $@'
86
87## Versioned libraries rules
88
89%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
90	$(RM) $@ && ln -s ${<F} $@
91%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
92	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
93
94##  Bind internal references
95
96# LDflags that pkgdata will use
97BIR_LDFLAGS= -Wl,-Bsymbolic
98
99# Dependencies [i.e. map files] for the final library
100BIR_DEPS=
101
102# Use LIBRARY_PATH instead of LD_LIBRARY_PATH
103LDLIBRARYPATH_ENVVAR= LIBRARY_PATH
104
105## End BeOS-specific setup
106
107