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