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