1 ## -*-makefile-*- 2 ## HP/UX-specific setup using aCC 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= : 8 GEN_DEPS.cc= : 9 10 ## Flags for position independent code 11 SHAREDLIBCFLAGS = +Z 12 SHAREDLIBCXXFLAGS = +Z 13 14 ## Additional flags when building libraries with threads 15 ## We use this instead of -mt, which isn't available in all versions of aCC 16 ## Our tools won't compile with -D_POSIX_C_SOURCE=199506L 17 THREADSCPPFLAGS = -D_REENTRANT -D_THREAD_SAFE 18 19 # Use Extended ANSI mode, which is useful for 64-bit numbers 20 # +W ignores some warnings 21 # 740 Unsafe cast between pointers/references to incomplete classes... 22 # 749 This operation is non-portable and potentially unsafe. 23 # (Ironically the solution to fix this warning is non-portable) 24 # 823 Redundant preprocessing concatenation operation results in two valid 25 # preprocessing tokens. This comes from INT64_C in <inttypes.h> 26 # 4232 conversion to a more strictly aligned type may cause misaligned access. 27 CFLAGS += -Ae +Olit=all 28 CXXFLAGS += -Wc,-ansi_for_scope,on +W740 +W749 +W823 +W4232 29 30 # -Bhidden_def Hides all symbols defined in the module. 31 #LIBCFLAGS = -Bhidden_def 32 #LIBCXXFLAGS = -Bhidden_def 33 34 ## Commands to compile 35 COMPILE.c= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c 36 COMPILE.cc= $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c 37 38 ## Common 'default' path to ensure the sanity of users. Search the current 39 ## directory, at least. 40 LD_DEFAULTPATH= -Wl,+b,'$$'ORIGIN/ 41 42 # Use SHLIB_PATH and LD_LIBRARY_PATH to locate shared libraries 43 LDFLAGS += -Wl,+s $(LD_DEFAULTPATH) 44 45 ## Commands to link 46 ## For aCC, use the C++ linker so that __shlinit gets defined 47 LINK.c= $(CXX) $(CXXFLAGS) $(LDFLAGS) 48 LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) 49 50 ## Commands to make a shared library 51 #SHLIB.c= $(LD) $(LDFLAGS) -b 52 SHLIB.c= $(CXX) $(CXXFLAGS) $(LDFLAGS) -b 53 SHLIB.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) -b 54 55 ## Compiler switch to embed a runtime search path 56 LD_RPATH= -Wl,+b, 57 LD_RPATH_PRE= 58 59 ## Environment variable to set a runtime search path 60 LDLIBRARYPATH_ENVVAR = SHLIB_PATH 61 62 ## Compiler switch to embed a library name 63 LD_SONAME = -Wl,+h,$(notdir $(MIDDLE_SO_TARGET)) 64 65 ## The type of assembly needed when pkgdata is used for generating shared libraries. 66 # Commented out for now because the hp1 test machine runs out of memory. 67 #GENCCODE_ASSEMBLY=-a aCC-parisc 68 69 ## Shared object suffix 70 SO= sl 71 ## Non-shared intermediate object suffix 72 STATIC_O = o 73 74 ## Compilation rules 75 %.$(STATIC_O): $(srcdir)/%.c 76 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< 77 %.o: $(srcdir)/%.c 78 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< 79 80 %.$(STATIC_O): $(srcdir)/%.cpp 81 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 82 %.o: $(srcdir)/%.cpp 83 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 84 85 86 ## Dependency rules 87 %.d : $(srcdir)/%.c 88 @echo "generating dependency information for $<" 89 @$(GEN_DEPS.c) $< > $@ 90 91 %.d : $(srcdir)/%.cpp 92 @echo "generating dependency information for $<" 93 @$(GEN_DEPS.cc) $< > $@ 94 95 ## Versioned libraries rules 96 97 %.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) 98 $(RM) $@ && ln -s ${<F} $@ 99 %.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR) 100 $(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@ 101 102 ## Install libraries as executable 103 INSTALL-L=$(INSTALL_PROGRAM) 104 105 ## End HP/UX-specific setup 106