# # $Revision: 1.18 $ # # Commondefs for top level libraries # libroot{defs,rules} suppport a general way to build single and multi-directory # libraries with multiple versions # # Before including librootdefs the top level makefile must define: # # BASELIB - the name of the base archive (with the .a suffix) # Where the source must live depends on the setting of ALTLIBS # and MULTIDIR. If either are set, the source must live in # a directory 'src' # ALTLIBS - the names of any alternate versions of the library # (with the .a suffix) # The source for these will be created by tlinking from BASELIB # to ALTLIBS (with the '.a' removed) # MULTIDIR - set this ONLY if the library has multiple directories # but NOT multiple versions # PRIVATEFILES - set to a tlink -x option(s) to exclude certain files # (if any) from being linked from BASELIB to ALTLIBS # # By default TARGETS is set here to be all the libraries and the shared version # of all non-non_shared and non-abi libraries (this is based on # looking at the trailing _ns.a or _abi.a). In addition any library # name that has the string _noso_ in it won't have a shared verion made. # To request that the ABI # version of a library be added as a shared object, set the ABISO macro. # To request that NO .so's get built - set the macro NOSO # # TARGETS can be added to: # TARGETS+=lib.ln # OR can be overridden if necessary: # TARGETS=$(LIBS) # # Then define the default rule: # default:$(TARGETS) # And include the other needed rules: # include ${LIBROOTRULES} # # Library Version Naming # Consistent naming is necessary to obtain all that these rules can offer. # # Names should be some prefix followed by an underscore followed by one of # the names in commondefs (e.g. _64_M3) followed '.a' # Example: a library built for default 64 bit: libx_64.a # Example: a library built for mips4 64 bit: libx_64_M4.a # Example: a library built for mips3 n32 bit: libx_n32_M4.a # # Names of non-shared versions should end in _ns.a # Example: a library built for 64 bit mips4, non-shared: libx_64_M4_ns.a # # Names of speciality libaries that shouldn't have .so's built for them # should have the string _noso_ imbedded somewhere in them. # Names of MIPS ABI libs should end in _32_abi.a. By default the .so version # of these won't get built. Set ABISO macro to have the .so version # added to TARGETS BASELIBSRCDIR=src LIBS=$(BASELIB) $(ALTLIBS) LIBROOTRULES=$(ROOT)/usr/include/make/librootrules # Common install locations. These can be overridden in the library Makefiles # after including librootdefs INSTINC=/usr/include INSTDIR=/usr/lib INSTDIR_NS=/usr/lib/nonshared INSTDIR_32_ABI=/usr/lib/abi INSTDIR_32=/usr/lib INSTDIR_32_M2=/usr/lib INSTDIR_32_NS=/usr/lib/nonshared INSTDIR_32_M2_NS=/usr/lib/nonshared INSTDIR_32_DEBUG =$(INSTDIR_32)/debug INSTDIR_32_INTERNAL =$(INSTDIR_32)/internal INSTDIR_64=/usr/lib64 INSTDIR_64_M3=/usr/lib64/mips3 INSTDIR_64_M4=/usr/lib64/mips4 INSTDIR_64_NS=/usr/lib64/nonshared INSTDIR_64_M3_NS=/usr/lib64/mips3/nonshared INSTDIR_64_M4_NS=/usr/lib64/mips4/nonshared INSTDIR_64_ABI=/usr/lib64/abi INSTDIR_64_DEBUG=$(INSTDIR_64)/debug INSTDIR_64_M3_DEBUG=$(INSTDIR_64_M3)/debug INSTDIR_64_M4_DEBUG=$(INSTDIR_64_M4)/debug INSTDIR_64_INTERNAL=$(INSTDIR_64)/internal INSTDIR_64_M3_INTERNAL=$(INSTDIR_64_M3)/internal INSTDIR_64_M4_INTERNAL=$(INSTDIR_64_M4)/internal INSTDIR_N32=/usr/lib32 INSTDIR_N32_M3=/usr/lib32/mips3 INSTDIR_N32_M4=/usr/lib32/mips4 INSTDIR_N32_NS=/usr/lib32/nonshared INSTDIR_N32_M3_NS=/usr/lib32/mips3/nonshared INSTDIR_N32_M4_NS=/usr/lib32/mips4/nonshared INSTDIR_N32_DEBUG=$(INSTDIR_N32)/debug INSTDIR_N32_M3_DEBUG=$(INSTDIR_N32_M3)/debug INSTDIR_N32_M4_DEBUG=$(INSTDIR_N32_M4)/debug INSTDIR_N32_INTERNAL=$(INSTDIR_N32)/internal INSTDIR_N32_M3_INTERNAL=$(INSTDIR_N32_M3)/internal INSTDIR_N32_M4_INTERNAL=$(INSTDIR_N32_M4)/internal # obsolete INSTABIDIR=$(INSTDIR_32_ABI) INSTDSO=$(INSTDIR) INSTNSDIR=$(INSTDIR_NS) # # Full install partial rules - including usage of the I_* macros to # suppress installation # INST_32_ABI=$(I_32_ABI) $(INSTALL) -F $(INSTDIR_32_ABI) INST_32=$(I_32) $(INSTALL) -F $(INSTDIR_32) INST_32_M2=$(I_32_M2) $(INSTALL) -F $(INSTDIR_32_M2) INST_32_NS=$(I_32) $(INSTALL) -F $(INSTDIR_32_NS) INST_32_M2_NS=$(I_32_M2) $(INSTALL) -F $(INSTDIR_32_M2_NS) INST_32_DEBUG=$(I_32) $(INSTALL) -F $(INSTDIR_32_DEBUG) INST_32_INTERNAL=$(I_32) $(INSTALL) -F $(INSTDIR_32_INTERNAL) INST_64=$(I_64) $(INSTALL) -F $(INSTDIR_64) INST_64_M3=$(I_64_M3) $(INSTALL) -F $(INSTDIR_64_M3) INST_64_M4=$(I_64_M4) $(INSTALL) -F $(INSTDIR_64_M4) INST_64_NS=$(I_64) $(INSTALL) -F $(INSTDIR_64_NS) INST_64_M3_NS=$(I_64_M3) $(INSTALL) -F $(INSTDIR_64_M3_NS) INST_64_M4_NS=$(I_64_M4) $(INSTALL) -F $(INSTDIR_64_M4_NS) INST_64_ABI=$(I_64_ABI) $(INSTALL) -F $(INSTDIR_64_ABI) INST_64_DEBUG=$(I_64) $(INSTALL) -F $(INSTDIR_64_DEBUG) INST_64_M3_DEBUG=$(I_64_M3) $(INSTALL) -F $(INSTDIR_64_M3_DEBUG) INST_64_M4_DEBUG=$(I_64_M4) $(INSTALL) -F $(INSTDIR_64_M4_DEBUG) INST_64_INTERNAL=$(I_64) $(INSTALL) -F $(INSTDIR_64_INTERNAL) INST_64_M3_INTERNAL=$(I_64_M3) $(INSTALL) -F $(INSTDIR_64_M3_INTERNAL) INST_64_M4_INTERNAL=$(I_64_M4) $(INSTALL) -F $(INSTDIR_64_M4_INTERNAL) INST_N32=$(I_N32) $(INSTALL) -F $(INSTDIR_N32) INST_N32_M3=$(I_N32_M3) $(INSTALL) -F $(INSTDIR_N32_M3) INST_N32_M4=$(I_N32_M4) $(INSTALL) -F $(INSTDIR_N32_M4) INST_N32_NS=$(I_N32) $(INSTALL) -F $(INSTDIR_N32_NS) INST_N32_M3_NS=$(I_N32_M3) $(INSTALL) -F $(INSTDIR_N32_M3_NS) INST_N32_M4_NS=$(I_N32_M4) $(INSTALL) -F $(INSTDIR_N32_M4_NS) INST_N32_DEBUG=$(I_N32) $(INSTALL) -F $(INSTDIR_N32_DEBUG) INST_N32_M3_DEBUG=$(I_N32_M3) $(INSTALL) -F $(INSTDIR_N32_M3_DEBUG) INST_N32_M4_DEBUG=$(I_N32_M4) $(INSTALL) -F $(INSTDIR_N32_M4_DEBUG) INST_N32_INTERNAL=$(I_N32) $(INSTALL) -F $(INSTDIR_N32_INTERNAL) INST_N32_M3_INTERNAL=$(I_N32_M3) $(INSTALL) -F $(INSTDIR_N32_M3_INTERNAL) INST_N32_M4_INTERNAL=$(I_N32_M4) $(INSTALL) -F $(INSTDIR_N32_M4_INTERNAL) # include releasedefs && normal commondefs include $(ROOT)/usr/include/make/releasedefs include $(ROOT)/usr/include/make/commondefs # # The following macros can be used to turn on and off command lines # based on target style # Set PTARGETS to be an appropriate set of TARGETS based on the STYLES_TO_BUILD # macro. # I_32_M2=\# I_32=\# I_32_ABI=\# I_N32_M3=\# I_N32_M4=\# I_N32=\# I_64_M3=\# I_64_M4=\# I_64=\# I_64_ABI=\# # # for backward compatibility/sanity permit anything that doesn't match our # naming conventions (gets libx.a) # PTARGETS+=$(LIBS:M?*.a:N?*_64?*:N?*_32?*:N?*_n32?*:N?*_abi?*:N?*_ns.a) #if $(STYLES_TO_BUILD:M32) == "32" I_32= PTARGETS+=$(LIBS:M?*_32.a) $(LIBS:M?*_32_ns.a) # for backward compatibility we really want to permit libx_ns.a PTARGETS+=$(LIBS:M?*_ns.a:N?*_64?*:N?*_32?*:N?*_n32?*) #endif #if $(STYLES_TO_BUILD:M32_M2) == "32_M2" I_32_M2= PTARGETS+=$(LIBS:M?*_32_M2.a) $(LIBS:M?*_32_M2_ns.a) #endif #if $(STYLES_TO_BUILD:M32_ABI) == "32_ABI" I_32_ABI= PTARGETS+=$(LIBS:M?*_32_abi.a) # for backward compatibility we really want to permit libx_abi.a PTARGETS+=$(LIBS:M?*_abi.a:N?*_64?*:N?*_32?*:N?*_n32?*) #endif #if $(STYLES_TO_BUILD:MN32_M3) == "N32_M3" I_N32_M3= PTARGETS+=$(LIBS:M?*_n32_M3.a) $(LIBS:M?*_n32_M3_ns.a) #endif #if $(STYLES_TO_BUILD:MN32_M4) == "N32_M4" I_N32_M4= PTARGETS+=$(LIBS:M?*_n32_M4.a) $(LIBS:M?*_n32_M4_ns.a) #endif #if $(STYLES_TO_BUILD:MN32) == "N32" I_N32= PTARGETS+=$(LIBS:M?*_n32.a) $(LIBS:M?*_n32_ns.a) #endif #if $(STYLES_TO_BUILD:M64_M3) == "64_M3" I_64_M3= PTARGETS+=$(LIBS:M?*_64_M3.a) $(LIBS:M?*_64_M3_ns.a) #endif #if $(STYLES_TO_BUILD:M64_M4) == "64_M4" I_64_M4= PTARGETS+=$(LIBS:M?*_64_M4.a) $(LIBS:M?*_64_M4_ns.a) #endif #if $(STYLES_TO_BUILD:M64) == "64" I_64= # permit _64ns.a for backward compatibility... PTARGETS+=$(LIBS:M?*_64.a) $(LIBS:M?*_64_ns.a) $(LIBS:M?*_64ns.a) #endif #if $(STYLES_TO_BUILD:M64_ABI) == "64_ABI" I_64_ABI= PTARGETS+=$(LIBS:M?*_64_abi.a) #endif TARGETS=$(PTARGETS) # whatever targets there are - add all shared versions as DSOs #if !defined(NOSO) TARGETS+=$(PTARGETS:N?*_ns.a:N?*_64ns.a:N?*_abi.a:N?*_noso_?*:.a=.so) #endif # add .so's for abi libs if requested #if defined(ABISO) TARGETS+=$(PTARGETS:M?*_abi.a:.a=.so) #endif #if (defined(MULTIDIR) || (defined(ALTLIBS) && !empty(ALTLIBS))) .NOTPARALLEL: COMMONPREF=lib SUBDIRS=$(BASELIBSRCDIR) $(ALTLIBS:.a=) # DESCENDERS are subdirectories that will be descended into using a .EXEC # rule so that their targets are not deemed out of date DESCENDERS=$(BASELIBSRCDIR)DESCEND $(ALTLIBS:S/.a/DESCEND/g) # base dir needs no special setup NOSETUPDIRS=$(BASELIBSRCDIR)SETUPDIR #endif # # If there are multiple versions, we set up macros to help duplicate # (via tlink) the base library source # #if defined(ALTLIBS) && !empty(ALTLIBS) .NOTPARALLEL: # The alternate libraries need to be 'setup' (via tlink) # never copy Makedepend! LINKSOURCES=$(TLINK) -r -x '^.*\.[oai]$$' -x '^.*\.so$$' -x 'versiondefs' -x $(MKDEPFILE) $(PRIVATEFILES) RMSOURCES=rm -fr $(ALTLIBS:.a=) SETUPDIRS=$(ALTLIBS:S/.a/SETUPDIR/g) #endif # # If we're a single level single version library, include libleaf{defs,rules} # #if !(defined(MULTIDIR) || (defined(ALTLIBS) && !empty(ALTLIBS))) INCLUDEDATROOT=yes include $(ROOT)/usr/include/make/libleafdefs #endif