1## -*-makefile-*-
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
4## QNX-specific setup
5## Copyright (c) 1999-2006, International Business Machines Corporation and
6## others. All Rights Reserved.
7##
8## Provided By: Chris McKillop <cdm@qnx.com>
9
10
11#
12# Create shared libs that "work" properly.
13#
14
15## Commands to generate dependency files
16GEN_DEPS.c=  $(CC) -E -Wp,-MM $(DEFS) $(CPPFLAGS)
17GEN_DEPS.cc= $(CXX) -E -Wp,-MM $(DEFS) $(CPPFLAGS)
18
19## Flags for position independent code
20SHAREDLIBCFLAGS = -shared
21SHAREDLIBCXXFLAGS = -shared
22# SHAREDLIBCPPFLAGS = -shared
23
24#
25# Always generatate PIC code.
26#
27#CPPFLAGS+=-shared
28
29## Additional flags when building libraries and with threads
30LIBCPPFLAGS =
31THREADSCPPFLAGS =
32
33## Compiler switch to embed a runtime search path
34LD_RPATH=
35LD_RPATH_PRE = -Wl,-rpath,
36
37## Compiler switch to embed a library name
38LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET))
39
40## Shared object suffix
41SO = so
42## Non-shared intermediate object suffix
43STATIC_O = ao
44
45## Compilation rules
46%.$(STATIC_O): $(srcdir)/%.c
47	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
48%.o: $(srcdir)/%.c
49	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
50
51%.$(STATIC_O): $(srcdir)/%.cpp
52	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
53%.o: $(srcdir)/%.cpp
54	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
55
56
57## Dependency rules
58%.d: $(srcdir)/%.c
59	@echo "generating dependency information for $<"
60	@$(SHELL) -ec '$(GEN_DEPS.c) $< \
61		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
62		[ -s $@ ] || rm -f $@'
63
64%.d: $(srcdir)/%.cpp
65	@echo "generating dependency information for $<"
66	@$(SHELL) -ec '$(GEN_DEPS.cc) $< \
67		| sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \
68		[ -s $@ ] || rm -f $@'
69
70## Versioned libraries rules
71##
72## QNX wants the SONAME in the shared lib to match the final "real" filename.
73## (to ease in packaging with QNX's native package format)
74##
75MIDDLE_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION_MAJOR)
76FINAL_SO_TARGET = $(MIDDLE_SO_TARGET)
77
78%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
79	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION_MAJOR) $@
80#%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION)
81#	$(RM) $@ && ln -s ${<F} $@
82#%.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR)
83#	$(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@
84
85##  Bind internal references
86
87# LDflags that pkgdata will use
88BIR_LDFLAGS= -Wl,-Bsymbolic
89
90# Dependencies [i.e. map files] for the final library
91BIR_DEPS=
92
93## End QNX-specific setup
94
95