1## -*-makefile-*-
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4## BSD-specific setup (FreeBSD, OpenBSD, NetBSD, *BSD)
5## Copyright (c) 1999-2013, International Business Machines Corporation and
6## others. All Rights Reserved.
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## Flags for position independent code
13SHAREDLIBCFLAGS = -fPIC
14SHAREDLIBCXXFLAGS = -fPIC
15SHAREDLIBCPPFLAGS = -DPIC
16
17## Additional flags when building libraries and with threads
18THREADSCPPFLAGS = -D_REENTRANT
19LIBCPPFLAGS =
20
21## Compiler switch to embed a runtime search path
22LD_RPATH=
23LD_RPATH_PRE=	-Wl,-rpath,
24
25## Compiler switch to embed a library name
26LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
27
28## Shared library options
29LD_SOOPTIONS= -Wl,-Bsymbolic
30
31## Shared object suffix
32SO = so
33## Non-shared intermediate object suffix
34STATIC_O = ao
35
36## Compilation rules
37%.$(STATIC_O): $(srcdir)/%.c
38	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
39%.o: $(srcdir)/%.c
40	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
41
42%.$(STATIC_O): $(srcdir)/%.cpp
43	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
44%.o: $(srcdir)/%.cpp
45	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
46
47
48## Dependency rules
49%.d: $(srcdir)/%.c
50	@echo "generating dependency information for $<"
51	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
52		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
53		[ -s $@ ] || rm -f $@'
54
55%.d: $(srcdir)/%.cpp
56	@echo "generating dependency information for $<"
57	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
58		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
59		[ -s $@ ] || rm -f $@'
60
61## Versioned libraries rules
62
63%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
64	$(RM) $@ && ln -s ${<F} $@
65%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
66	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
67
68##  Bind internal references
69
70# LDflags that pkgdata will use
71BIR_LDFLAGS= -Wl,-Bsymbolic
72
73# Dependencies [i.e. map files] for the final library
74BIR_DEPS=
75
76## Remove shared library 's'
77STATIC_PREFIX_WHEN_USED =
78STATIC_PREFIX =
79
80## End BSD-specific setup
81
82
83