src/share/tools/hsdis/Makefile

Tue, 28 Jul 2009 12:12:40 -0700

author
xdono
date
Tue, 28 Jul 2009 12:12:40 -0700
changeset 1279
bd02caa94611
parent 1155
67a2f5ba5582
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6862919: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 07/09
Reviewed-by: tbell, ohair

     1 #
     2 # Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.
     8 #
     9 # This code is distributed in the hope that it will be useful, but WITHOUT
    10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 # version 2 for more details (a copy is included in the LICENSE file that
    13 # accompanied this code).
    14 #
    15 # You should have received a copy of the GNU General Public License version
    16 # 2 along with this work; if not, write to the Free Software Foundation,
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 #
    19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20 # CA 95054 USA or visit www.sun.com if you need additional information or
    21 # have any questions.
    22 #  
    23 #
    25 # Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw)
    27 # Default arch; it is changed below as needed.
    28 ARCH		= i386
    29 OS		= $(shell uname)
    31 ## OS = SunOS ##
    32 ifeq		($(OS),SunOS)
    33 CPU             = $(shell uname -p)
    34 ARCH1=$(CPU:i586=i386)
    35 ARCH=$(ARCH1:i686=i386)
    36 OS		= solaris
    37 CC 		= cc
    38 CFLAGS		+= -KPIC
    39 ifdef LP64
    40 ifeq ($(ARCH),sparc)
    41 ARCH            = sparcv9
    42 endif
    43 ifeq ($(ARCH),i386)
    44 ARCH            = amd64
    45 endif
    46 endif
    47 CFLAGS/sparcv9	+= -xarch=v9
    48 CFLAGS/amd64	+= -m64
    49 CFLAGS		+= $(CFLAGS/$(ARCH))
    50 DLDFLAGS	+= -G
    51 LDFLAGS         += -ldl
    52 OUTFLAGS	+= -o $@
    53 LIB_EXT		= .so
    54 else
    55 ## OS = Linux ##
    56 ifeq		($(OS),Linux)
    57 ifneq           ($(MINGW),)
    58 LIB_EXT		= .dll
    59 CPPFLAGS += -I$(TARGET_DIR)/include
    60 LDFLAGS += -L$(TARGET_DIR)/lib
    61 OS=windows
    62 ifneq           ($(findstring x86_64-,$(MINGW)),)
    63 ARCH=amd64
    64 else
    65 ARCH=i386
    66 endif
    67 CC 		= $(MINGW)-gcc
    68 CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
    69 else
    70 CPU             = $(shell uname -m)
    71 ARCH1=$(CPU:x86_64=amd64)
    72 ARCH=$(ARCH1:i686=i386)
    73 CFLAGS/i386	+= -m32
    74 CFLAGS/sparc	+= -m32
    75 CFLAGS/sparcv9	+= -m64
    76 CFLAGS/amd64	+= -m64
    77 CFLAGS		+= $(CFLAGS/$(ARCH))
    78 CFLAGS		+= -fPIC
    79 OS		= linux
    80 LIB_EXT		= .so
    81 CC 		= gcc
    82 endif
    83 CFLAGS		+= -O
    84 DLDFLAGS	+= -shared
    85 LDFLAGS         += -ldl
    86 OUTFLAGS	+= -o $@
    87 ## OS = Windows ##
    88 else   # !SunOS, !Linux => Windows
    89 OS		= windows
    90 CC		= gcc
    91 #CPPFLAGS	+= /D"WIN32" /D"_WINDOWS" /D"DEBUG" /D"NDEBUG"
    92 CFLAGS		+=  /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
    93 CFLAGS		+= LIBARCH=\"$(LIBARCH)\""
    94 DLDFLAGS	+= /dll /subsystem:windows /incremental:no \
    95 			/export:decode_instruction
    96 OUTFLAGS	+= /link /out:$@
    97 LIB_EXT		= .dll
    98 endif	# Linux
    99 endif	# SunOS
   101 LIBARCH		= $(ARCH)
   102 ifdef		LP64
   103 LIBARCH64/sparc	= sparcv9
   104 LIBARCH64/i386	= amd64
   105 LIBARCH64	= $(LIBARCH64/$(ARCH))
   106 ifneq		($(LIBARCH64),)
   107 LIBARCH		= $(LIBARCH64)
   108 endif   # LIBARCH64/$(ARCH)
   109 endif   # LP64
   111 JDKARCH=$(LIBARCH:i386=i586)
   113 ifeq            ($(BINUTILS),)
   114 # Pop all the way out of the workspace to look for binutils.
   115 # ...You probably want to override this setting.
   116 BINUTILSDIR	= $(shell cd build/binutils;pwd)
   117 else
   118 BINUTILSDIR	= $(shell cd $(BINUTILS);pwd)
   119 endif
   121 CPPFLAGS	+= -I$(BINUTILSDIR)/include -I$(BINUTILS)/bfd -I$(TARGET_DIR)/bfd
   122 CPPFLAGS	+= -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\"
   124 TARGET_DIR	= build/$(OS)-$(JDKARCH)
   125 TARGET		= $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT)
   127 SOURCE		= hsdis.c
   129 LIBRARIES =	$(TARGET_DIR)/bfd/libbfd.a \
   130 		$(TARGET_DIR)/opcodes/libopcodes.a \
   131 		$(TARGET_DIR)/libiberty/libiberty.a
   133 DEMO_TARGET	= $(TARGET_DIR)/hsdis-demo
   134 DEMO_SOURCE	= hsdis-demo.c
   136 .PHONY:  all clean demo both
   138 all:  $(TARGET)
   140 both: all all64
   142 %64:
   143 	$(MAKE) LP64=1 ${@:%64=%}
   145 demo: $(TARGET) $(DEMO_TARGET)
   147 $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile
   148 	if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
   150 $(TARGET_DIR)/Makefile:
   151 	(cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
   153 $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
   154 	$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
   156 $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR)
   157 	$(CC) $(OUTFLAGS) -DTARGET_DIR=\"$(TARGET_DIR)\" $(CPPFLAGS) -g $(CFLAGS/$(ARCH)) $(DEMO_SOURCE) $(LDFLAGS)
   159 $(TARGET_DIR):
   160 	[ -d $@ ] || mkdir -p $@
   162 clean:
   163 	rm -rf $(TARGET_DIR)

mercurial