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 (at] qnx.com> 7 8 9 # 10 # Create shared libs that "work" properly. 11 # 12 13 ## Commands to generate dependency files 14 GEN_DEPS.c= $(CC) -E -Wp,-MM $(DEFS) $(CPPFLAGS) 15 GEN_DEPS.cc= $(CXX) -E -Wp,-MM $(DEFS) $(CPPFLAGS) 16 17 ## Flags for position independent code 18 SHAREDLIBCFLAGS = -shared 19 SHAREDLIBCXXFLAGS = -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 28 LIBCPPFLAGS = 29 THREADSCPPFLAGS = 30 31 ## Compiler switch to embed a runtime search path 32 LD_RPATH= 33 LD_RPATH_PRE = -Wl,-rpath, 34 35 ## Compiler switch to embed a library name 36 LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET)) 37 38 ## Shared object suffix 39 SO = so 40 ## Non-shared intermediate object suffix 41 STATIC_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 ## 73 MIDDLE_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION_MAJOR) 74 FINAL_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 86 BIR_LDFLAGS= -Wl,-Bsymbolic 87 88 # Dependencies [i.e. map files] for the final library 89 BIR_DEPS= 90 91 ## End QNX-specific setup 92 93