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