1 ## -*-makefile-*- 2 ## MP-RAS specific setup 3 ## Copyright (c) 2003-2004, International Business Machines Corporation and 4 ## others. All Rights Reserved. 5 ## 6 ## Original contributer: Jason Gordon from NCR 7 8 ## Flags for position independent code 9 SHAREDLIBCFLAGS = -K PIC 10 SHAREDLIBCXXFLAGS = -K PIC 11 SHAREDLIBCPPFLAGS = -DPIC 12 13 ## Commands to generate dependency files 14 GEN_DEPS.c= $(CC) -Hnocopyr -I/usr/include -Hcpplvl=3 -Xa -Hmake $(DEFS) $(CPPFLAGS) 15 GEN_DEPS.cc= $(CXX) -Hnocopyr -I/usr/include -Hcpplvl=3 -Xa -Hmake $(DEFS) $(CPPFLAGS) 16 17 ## Commands to link 18 LINK.c= $(CC) $(CXXFLAGS) $(LDFLAGS) 19 LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) 20 21 ## Commands to make a shared library 22 SHLIB.c= $(CC) $(CFLAGS) $(LDFLAGS) -G 23 SHLIB.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) -G 24 25 ## Compiler switch to embed a runtime search path 26 LD_RPATH= -YP, 27 LD_RPATH_PRE= 28 29 ## Compiler switch to embed a library name 30 LD_SONAME = -h $(notdir $(MIDDLE_SO_TARGET)) 31 32 ## Shared object suffix 33 SO= so 34 ## Non-shared intermediate object suffix 35 STATIC_O = o 36 37 ## Compilation rules 38 %.$(STATIC_O): $(srcdir)/%.c 39 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< 40 %.o: $(srcdir)/%.c 41 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< 42 43 %.$(STATIC_O): $(srcdir)/%.cpp 44 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 45 %.o: $(srcdir)/%.cpp 46 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 47 48 49 ## Dependency rules 50 %.d : $(srcdir)/%.c 51 @echo "generating dependency information for $<" 52 @$(GEN_DEPS.c) $< > $@ 53 54 %.d : $(srcdir)/%.cpp 55 @echo "generating dependency information for $<" 56 @$(GEN_DEPS.cc) $< > $@ 57 58 ## Versioned libraries rules 59 60 %.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) 61 $(RM) $@ && ln -s ${<F} $@ 62 %.$(SO): %.$(SO).$(SO_TARGET_VERSION_MAJOR) 63 $(RM) $@ && ln -s ${*F}.$(SO).$(SO_TARGET_VERSION) $@ 64 65