hotspot/src/share/tools/hsdis/Makefile
author jrose
Wed, 02 Apr 2008 12:09:59 -0700
changeset 347 df859fcca515
child 2564 85c3ae53ca1c
permissions -rw-r--r--
6667042: PrintAssembly option does not work without special plugin Summary: remove old private plugin interface, simplify, rework old plugin to use unchanged Gnu sources Reviewed-by: kvn, rasbold
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     1
#
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     2
# Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     4
#
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     7
# published by the Free Software Foundation.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     8
#
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    13
# accompanied this code).
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    14
#
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    18
#
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    19
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    20
# CA 95054 USA or visit www.sun.com if you need additional information or
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    21
# have any questions.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    22
#  
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    23
#
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    24
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    25
# Single gnu makefile for solaris, linux and windows (windows requires mks or
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    26
# cygwin).
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    27
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    28
ifeq            ($(BINUTILS),)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    29
# Pop all the way out of the workspace to look for binutils.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    30
# ...You probably want to override this setting.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    31
BINUTILS	= $(shell cd ../../../../..;pwd)/binutils-2.17-$(LIBARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    32
endif
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    33
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    34
# Default arch; it is changed below as needed.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    35
ARCH		= i386
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    36
OS		= $(shell uname)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    37
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    38
CPPFLAGS	+= -I$(BINUTILS)/include -I$(BINUTILS)/bfd
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    39
CPPFLAGS	+= -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" -DLIBARCH_$(LIBARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    40
CPPFLAGS	+= -DHOTSPOT_OS=\"$(OS)\" -DOS_$(OS)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    41
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    42
## OS = SunOS ##
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    43
ifeq		($(OS),SunOS)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    44
ARCH    	= $(shell uname -p)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    45
OS		= solaris
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    46
CC 		= cc
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    47
CCFLAGS		+= -Kpic -g
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    48
CCFLAGS/amd64   += -xarch=amd64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    49
CCFLAGS/sparcv9 += -xarch=v9
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    50
CCFLAGS		+= $(CCFLAGS/$(LIBARCH))
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    51
DLDFLAGS	+= -G
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    52
OUTFLAGS	+= -o $@
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    53
LIB_EXT		= .so
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    54
else
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    55
## OS = Linux ##
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    56
ifeq		($(OS),Linux)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    57
CPU             = $(shell uname -m)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    58
ifeq		($(CPU),ia64)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    59
ARCH    	= ia64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    60
else
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    61
ifeq		($(CPU),x86_64)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    62
CCFLAGS		+= -fPIC
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    63
endif   # x86_64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    64
endif   # ia64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    65
OS		= linux
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    66
CC 		= gcc
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    67
CCFLAGS		+= -O
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    68
DLDFLAGS	+= -shared
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    69
OUTFLAGS	+= -o $@
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    70
LIB_EXT		= .so
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    71
CPPFLAGS	+= -Iinclude -Iinclude/$(OS)_$(ARCH)/
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    72
## OS = Windows ##
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    73
else   # !SunOS, !Linux => Windows
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    74
OS		= win
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    75
CC		= cl
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    76
#CPPFLAGS	+= /D"WIN32" /D"_WINDOWS" /D"DEBUG" /D"NDEBUG"
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    77
CCFLAGS		+=  /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    78
CCFLAGS		+= -Iinclude -Iinclude/gnu -Iinclude/$(OS)_$(ARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    79
CCFLAGS		+= /D"HOTSPOT_LIB_ARCH=\"$(LIBARCH)\""
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    80
DLDFLAGS	+= /dll /subsystem:windows /incremental:no \
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    81
			/export:decode_instruction
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    82
OUTFLAGS	+= /link /out:$@
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    83
LIB_EXT		= .dll
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    84
endif	# Linux
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    85
endif	# SunOS
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    86
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    87
LIBARCH		= $(ARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    88
ifdef		LP64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    89
LIBARCH64/sparc	= sparcv9
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    90
LIBARCH64/i386	= amd64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    91
LIBARCH64	= $(LIBARCH64/$(ARCH))
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    92
ifneq		($(LIBARCH64),)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    93
LIBARCH		= $(LIBARCH64)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    94
endif   # LIBARCH64/$(ARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    95
endif   # LP64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    96
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    97
TARGET_DIR	= bin/$(OS)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    98
TARGET		= $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    99
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   100
SOURCE		= hsdis.c
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   101
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   102
LIBRARIES =	$(BINUTILS)/bfd/libbfd.a \
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   103
		$(BINUTILS)/opcodes/libopcodes.a \
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   104
		$(BINUTILS)/libiberty/libiberty.a
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   105
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   106
DEMO_TARGET	= $(TARGET_DIR)/hsdis-demo-$(LIBARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   107
DEMO_SOURCE	= hsdis-demo.c
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   108
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   109
.PHONY:  all clean demo both
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   110
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   111
all:  $(TARGET) demo
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   112
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   113
both: all all64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   114
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   115
%64:
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   116
	$(MAKE) LP64=1 ${@:%64=%}
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   117
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   118
demo: $(TARGET) $(DEMO_TARGET)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   119
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   120
$(LIBRARIES):
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   121
	@echo "*** Please build binutils first; see ./README: ***"
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   122
	@sed < ./README '1,/__________/d' | head -20
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   123
	@echo "..."; exit 1
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   124
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   125
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   126
	$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CCFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   127
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   128
$(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   129
	$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CCFLAGS) $(DEMO_SOURCE) $(LDFLAGS)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   130
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   131
$(TARGET_DIR):
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   132
	[ -d $@ ] || mkdir -p $@
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   133
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   134
clean:
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   135
	rm -rf $(TARGET_DIR)