Print this page
need includes from common/dis/i386 on sparc too
reorder some things in Makefile.com
style fixes
only include native support in standalone library
rename instr.c
take to dis and libdisasm with an axe; does not yet compile

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdisasm/Makefile.com
          +++ new/usr/src/lib/libdisasm/Makefile.com
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15  # If applicable, add the following below this CDDL HEADER, with the
  16   16  # fields enclosed by brackets "[]" replaced with your own identifying
  17   17  # information: Portions Copyright [yyyy] [name of copyright owner]
  18   18  #
  19   19  # CDDL HEADER END
  20   20  #
  21   21  #
  22   22  # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23   23  # Use is subject to license terms.
       24 +# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
  24   25  #
  25   26  
  26   27  #
  27   28  # The build process for libdisasm is sightly different from that used by other
  28   29  # libraries, because libdisasm must be built in two flavors - as a standalone
  29   30  # for use by kmdb and as a normal library.  We use $(CURTYPE) to indicate the
  30   31  # current flavor being built.
  31   32  #
  32      -# The SPARC library is built from the closed gate.  This Makefile is shared
  33      -# between both environments, so all paths must be absolute.
  34      -#
  35   33  
  36   34  LIBRARY=        libdisasm.a
  37   35  STANDLIBRARY=   libstanddisasm.so
  38   36  VERS=           .1
  39   37  
  40   38  # By default, we build the shared library.  Construction of the standalone
  41   39  # is specifically requested by architecture-specific Makefiles.
  42   40  TYPES=          library
  43   41  CURTYPE=        library
  44   42  
  45   43  COMDIR=         $(SRC)/lib/libdisasm/common
  46   44  
  47   45  #
  48      -# Architecture-dependent files common to both versions of libdisasm
       46 +# Architecture-independent files
  49   47  #
  50      -OBJECTS_common_i386 = dis_i386.o dis_tables.o
  51      -OBJECTS_common_sparc = dis_sparc.o instr.o dis_sparc_fmt.o
       48 +SRCS_common=            $(COMDIR)/libdisasm.c
       49 +OBJECTS_common=         libdisasm.o
  52   50  
  53      -SRCS_common_i386 = $(ISASRCDIR)/dis_i386.c $(SRC)/common/dis/i386/dis_tables.c
  54      -SRCS_common_sparc = $(ISASRCDIR)/dis_sparc.c $(ISASRCDIR)/instr.c \
  55      -        $(ISASRCDIR)/dis_sparc_fmt.c
  56      -
  57   51  #
  58      -# Architecture-independent files common to both version of libdisasm
       52 +# Architecture-dependent disassembly files
  59   53  #
  60      -OBJECTS_common_common = libdisasm.o
  61      -SRC_common_common = $(OBJECTS_common_common:%.o=$(COMDIR)/%.c)
       54 +SRCS_i386=              $(COMDIR)/dis_i386.c \
       55 +                        $(SRC)/common/dis/i386/dis_tables.c
       56 +SRCS_sparc=             $(COMDIR)/dis_sparc.c \
       57 +                        $(COMDIR)/dis_sparc_fmt.c \
       58 +                        $(COMDIR)/dis_sparc_instr.c
  62   59  
       60 +OBJECTS_i386=           dis_i386.o \
       61 +                        dis_tables.o
       62 +OBJECTS_sparc=          dis_sparc.o \
       63 +                        dis_sparc_fmt.o \
       64 +                        dis_sparc_instr.o
  63   65  
  64      -OBJECTS=                                \
  65      -        $(OBJECTS_common_$(MACH))       \
  66      -        $(OBJECTS_common_common)
       66 +#
       67 +# We build the regular shared library with support for all architectures.
       68 +# The standalone version should only contain code for the native
       69 +# architecture to reduce the memory footprint of kmdb.
       70 +#
       71 +OBJECTS_library=        $(OBJECTS_common) \
       72 +                        $(OBJECTS_i386) \
       73 +                        $(OBJECTS_sparc)
       74 +OBJECTS_standalone=     $(OBJECTS_common) \
       75 +                        $(OBJECTS_$(MACH))
       76 +OBJECTS=                $(OBJECTS_$(CURTYPE))
  67   77  
  68   78  include $(SRC)/lib/Makefile.lib
  69   79  
  70      -SRCS=                                   \
  71      -        $(SRCS_$(CURTYPE))              \
  72      -        $(SRCS_common_$(MACH))          \
  73      -        $(SRCS_common_common)
       80 +SRCS_library=           $(SRCS_common) \
       81 +                        $(SRCS_i386) \
       82 +                        $(SRCS_sparc)
       83 +SRCS_standalone=        $(SRCS_common) \
       84 +                        $(SRCS_$(MACH))
       85 +SRCS=                   $(SRCS_$(CURTYPE))
  74   86  
  75   87  #
  76   88  # Used to verify that the standalone doesn't have any unexpected external
  77   89  # dependencies.
  78   90  #
  79   91  LINKTEST_OBJ = objs/linktest_stand.o
  80   92  
  81   93  CLOBBERFILES_standalone = $(LINKTEST_OBJ)
  82   94  CLOBBERFILES += $(CLOBBERFILES_$(CURTYPE))
  83   95  
↓ open down ↓ 27 lines elided ↑ open up ↑
 111  123  # We need to rename some standard functions so we can easily implement them 
 112  124  # in consumers.
 113  125  STAND_RENAMED_FUNCS= \
 114  126          snprintf
 115  127  
 116  128  CPPFLAGS_standalone = -DDIS_STANDALONE $(STAND_RENAMED_FUNCS:%=-D%=mdb_%) \
 117  129          -Dvsnprintf=mdb_iob_vsnprintf -I$(SRC)/cmd/mdb/common
 118  130  CPPFLAGS_library = -D_REENTRANT
 119  131  CPPFLAGS +=     -I$(COMDIR) $(CPPFLAGS_$(CURTYPE))
 120  132  
 121      -#
 122      -# For x86, we have to link to sources in usr/src/common
 123      -#
 124      -CPPFLAGS_dis_i386 = -I$(SRC)/common/dis/i386 -DDIS_TEXT
 125      -CPPFLAGS_dis_sparc =
 126      -CPPFLAGS +=     $(CPPFLAGS_dis_$(MACH))
      133 +# For the x86 disassembler we have to include sources from usr/src/common
      134 +CPPFLAGS += -I$(SRC)/common/dis/i386 -DDIS_TEXT
 127  135  
 128  136  CFLAGS_standalone = $(STAND_FLAGS_32)
 129  137  CFLAGS_common =
 130  138  CFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common)
 131  139  
 132  140  CFLAGS64_standalone = $(STAND_FLAGS_64)
 133  141  CFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common)
 134  142  
 135  143  DYNFLAGS +=     $(ZINTERPOSE)
 136  144  
 137  145  .KEEP_STATE:
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX