1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 #
  22 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 #
  25 # Copyright 2016 RackTop Systems.
  26 # Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
  27 #
  28 
  29 pics/%.o:       ../common/%.c
  30                 $(COMPILE.c) -o $@ $<
  31                 $(POST_PROCESS_O)
  32 
  33 pics/%32.o:     ../common/%.c
  34                 $(COMPILE.c) -o $@ $<
  35                 $(POST_PROCESS_O)
  36 
  37 pics/%64.o:     ../common/%.c
  38                 $(COMPILE.c) -o $@ -D_ELF64 $<
  39                 $(POST_PROCESS_O)
  40 
  41 pics/%32.o:     %.c
  42                 $(COMPILE.c) -o $@ $<
  43                 $(POST_PROCESS_O)
  44 
  45 pics/%64.o:     %.c
  46                 $(COMPILE.c) -o $@ -D_ELF64 $<
  47                 $(POST_PROCESS_O)
  48 
  49 pics/%.o:       $(SGSTOOLS)/common/%.c
  50                 $(COMPILE.c) -o $@ $<
  51                 $(POST_PROCESS_O)
  52 
  53 pics/%.o:       $(VAR_AVLDIR)/%.c
  54                 $(COMPILE.c) -o $@ $<
  55                 $(POST_PROCESS_O)
  56 
  57 #
  58 # We use the shared elfcap code under usr/src/common/elfcap
  59 #
  60 pics/elfcap.o:  $(ELFCAP)/elfcap.c
  61                 $(COMPILE.c) -o  $@ $(ELFCAP)/elfcap.c
  62                 $(POST_PROCESS_O)
  63 
  64 # Rules for compiling the shared relocation engines (doreloc.c) maintained
  65 # under usr/src/uts. To support cross linking, We compile and link
  66 # all of these into every copy of libld. Each one requires a separate rule:
  67 #       - The source files are in different subtrees under usr/src/uts
  68 #       - The output file needs to include the platform name to
  69 #               keep the object files from colliding
  70 # The DO_RELOC_LIBLD definition is needed to generate the libld version
  71 # of the doreloc code.
  72 #
  73 pics/%_x86_32.o: $(KRTLD_I386)/%.c
  74                 $(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
  75                 $(POST_PROCESS_O)
  76 
  77 pics/%_x86_64.o: $(KRTLD_AMD64)/%.c
  78                 $(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
  79                 $(POST_PROCESS_O)
  80 
  81 pics/%_sparc_32.o: $(KRTLD_SPARC)/%.c
  82                 $(COMPILE.c) -o $@ -DDO_RELOC_LIBLD $<
  83                 $(POST_PROCESS_O)
  84 
  85 pics/%_sparc_64.o: \
  86                 $(KRTLD_SPARC)/%.c
  87                 $(COMPILE.c) -o $@ -D_ELF64 -DDO_RELOC_LIBLD $<
  88                 $(POST_PROCESS_O)
  89 
  90 
  91 $(LIBLINKS):
  92                 $(RM) $@; $(SYMLINK) $(DYNLIB) $@
  93 
  94 delete:
  95                 $(RM) $(DYNLIB)
  96 
  97 # Special target for native builds (ie. when we need to build a version of ld
  98 # to build a version of ld :-).
  99 
 100 native:         $(SGSLIBDIR)/$(LIBLINKS)
 101 
 102 $(PICS):        pics
 103 
 104 $(SGSLIBDIR)/$(DYNLIB): $(PICS) $(SGSLIBDIR)
 105                 $(BUILD.SO)
 106                 $(POST_PROCESS_SO)
 107 
 108 $(SGSLIBDIR)/$(LIBLINKS): $(SGSLIBDIR)/$(DYNLIB)
 109                 @$(RM) $(SGSLIBDIR)/$(LIBLINKS)
 110                 $(SYMLINK) $(DYNLIB) $(SGSLIBDIR)/$(LIBLINKS)
 111 
 112 include         $(SRC)/lib/Makefile.targ
 113 include         $(SRC)/cmd/sgs/Makefile.targ
 114 
 115 # Derived source and header files (messaging).
 116 
 117 catalog:        $(BLTMESG)
 118 
 119 chkmsg:         $(LIBSRCS) $(CHKSRCS)
 120                 sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS)
 121 
 122 $(BLTDEFS) + \
 123 $(BLTDATA):     $(SGSMSGTARG)
 124                 $(SGSMSG) $(SGSMSGFLAGS2) $(SGSMSGTARG)
 125 
 126 $(BLTMESG):     $(SGSMSGALL)
 127                 $(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL)