1 ## -*-makefile-*- 2 ## HPUX/gcc specific setup 3 ## Copyright (c) 1999-2009, International Business Machines Corporation and 4 ## others. All Rights Reserved. 5 6 ## Commands to generate dependency files 7 GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS) 8 GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) 9 10 ## Flags for position independent code 11 SHAREDLIBCFLAGS = -fPIC 12 SHAREDLIBCXXFLAGS = -fPIC 13 SHAREDLIBCPPFLAGS = -DPIC 14 15 ## Common 'default' path to ensure the sanity of users. Search the current 16 ## directory, at least. 17 LD_DEFAULTPATH= -Wl,+b,.:'$$'ORIGIN/ 18 19 # Get some handy functions defined properly 20 DEFS += -D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L 21 22 ## Commands to link 23 ## For aCC, use the C++ linker so that __shlinit gets defined 24 LINK.c= $(CXX) $(DEFS) $(LDFLAGS) -Wl,+s $(LD_DEFAULTPATH) 25 LINK.cc= $(CXX) $(DEFS) $(LDFLAGS) -Wl,+s $(LD_DEFAULTPATH) 26 27 ## Shared library options 28 LD_SOOPTIONS= -Wl,-Bsymbolic 29 30 ## Commands to make a shared library 31 SHLIB.c= $(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) $(SHAREDLIBCXXFLAGS) -shared -Wl,+s $(LD_DEFAULTPATH) $(LD_SOOPTIONS) 32 SHLIB.cc= $(CXX) $(DEFS) $(CXXFLAGS) $(LDFLAGS) $(SHAREDLIBCXXFLAGS) -shared -Wl,+s $(LD_DEFAULTPATH) $(LD_SOOPTIONS) 33 34 ## Compiler switch to embed a runtime search path 35 LD_RPATH= -Wl,+b, 36 LD_RPATH_PRE= 37 38 ## Compiler switch to embed a library name 39 LD_SONAME = -Wl,+h,$(notdir $(MIDDLE_SO_TARGET)) 40 41 ## Environment variable to set a runtime search path 42 LDLIBRARYPATH_ENVVAR = SHLIB_PATH 43 44 ## Shared object suffix 45 SO= sl 46 ## Non-shared intermediate object suffix 47 STATIC_O = o 48 49 ## Compilation rules 50 %.$(STATIC_O): $(srcdir)/%.c 51 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< 52 %.o: $(srcdir)/%.c 53 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< 54 55 %.$(STATIC_O): $(srcdir)/%.cpp 56 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 57 %.o: $(srcdir)/%.cpp 58 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 59 60 61 ## Dependency rules 62 %.d : $(srcdir)/%.c 63 @echo "Generating dependency information for $<" 64 @$(SHELL) -ec '$(GEN_DEPS.c) $< \ 65 | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ 66 [ -s $@ ] || rm -f $@' 67 68 %.d : $(srcdir)/%.cpp 69 @echo "Generating dependency information for $<" 70 @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ 71 | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ 72 [ -s $@ ] || rm -f $@' 73 74 ## Versioned libraries rules 75 76 %.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) 77 $(RM) $@ && ln -s ${<F} $@ 78 %.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR) 79 $(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@ 80 81 ## Remove shared library 's' 82 STATIC_PREFIX_WHEN_USED = 83 STATIC_PREFIX = 84 85 ## End HPUX/gcc specific setup 86 87