src/utils/hsdis/Makefile
author herrick
Tue, 24 Sep 2019 13:41:16 -0400
branchJDK-8200758-branch
changeset 58301 e0efb29609bd
parent 54212 ed40b61fed96
permissions -rw-r--r--
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code Submitted-by: asemenyuk Reviewed-by: herrick, almatvee
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
#
54212
ed40b61fed96 8220784: hsdis cannot be built with MinGW64
ysuenaga
parents: 51271
diff changeset
     2
# Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
347
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
#
51202
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
     5
# The Universal Permissive License (UPL), Version 1.0
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
     6
#
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
     7
# Subject to the condition set forth below, permission is hereby granted to
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
     8
# any person obtaining a copy of this software, associated documentation
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
     9
# and/or data (collectively the "Software"), free of charge and under any
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    10
# and all copyright rights in the Software, and any and all patent rights
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    11
# owned or freely licensable by each licensor hereunder covering either (i)
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    12
# the unmodified Software as contributed to or provided by such licensor,
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    13
# or (ii) the Larger Works (as defined below), to deal in both
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    14
#
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    15
# (a) the Software, and
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    16
#
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    17
# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file
51271
b6e0bfe4a6ec 8208541: non-ASCII characters in hsdis UPL text
dbuck
parents: 51202
diff changeset
    18
# if one is included with the Software (each a "Larger Work" to which the
51202
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    19
# Software is contributed by such licensors),
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    20
#
51202
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    21
# without restriction, including without limitation the rights to copy,
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    22
# create derivative works of, display, perform, and distribute the Software
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    23
# and make, use, sell, offer for sale, import, export, have made, and have
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    24
# sold the Software and the Larger Work(s), and to sublicense the foregoing
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    25
# rights on either these or other terms.
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    26
#
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    27
# This license is subject to the following condition:
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    28
#
51202
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    29
# The above copyright notice and either this complete permission notice or
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    30
# at a minimum a reference to the UPL must be included in all copies or
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    31
# substantial portions of the Software.
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    32
#
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    33
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    34
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    35
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    36
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    37
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    38
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
59b0d8afc831 8208183: update HSDIS plugin license to UPL
dbuck
parents: 47216
diff changeset
    39
# USE OR OTHER DEALINGS IN THE SOFTWARE.
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    40
#
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    41
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    42
# or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    43
# questions.
17006
b9bfa72b7dda 7104565: trim jprt build targets
drchase
parents: 13873
diff changeset
    44
#
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    45
#
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    46
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    47
# Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw)
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    48
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    49
# Default arch; it is changed below as needed.
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    50
ARCH		= i386
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    51
OS		= $(shell uname)
22822
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
    52
AR		= ar
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    53
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    54
## OS = SunOS ##
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    55
ifeq		($(OS),SunOS)
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    56
CPU             = $(shell uname -p)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    57
ARCH1=$(CPU:i586=i386)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    58
ARCH=$(ARCH1:i686=i386)
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    59
OS		= solaris
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    60
CC 		= cc
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    61
CFLAGS		+= -KPIC
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    62
ifdef LP64
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    63
ifeq ($(ARCH),sparc)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    64
ARCH            = sparcv9
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    65
endif
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    66
ifeq ($(ARCH),i386)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    67
ARCH            = amd64
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    68
endif
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    69
endif
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    70
CFLAGS/sparcv9	+= -xarch=v9
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    71
CFLAGS/amd64	+= -m64
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    72
CFLAGS		+= $(CFLAGS/$(ARCH))
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    73
DLDFLAGS	+= -G
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    74
LDFLAGS         += -ldl
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    75
OUTFLAGS	+= -o $@
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    76
LIB_EXT		= .so
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    77
else
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    78
## OS = Linux ##
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
    79
ifeq		($(OS),Linux)
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    80
ifneq           ($(MINGW),)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    81
LIB_EXT		= .dll
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    82
CPPFLAGS += -I$(TARGET_DIR)/include
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    83
LDFLAGS += -L$(TARGET_DIR)/lib
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    84
OS=windows
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    85
ifneq           ($(findstring x86_64-,$(MINGW)),)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    86
ARCH=amd64
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    87
else
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    88
ARCH=i386
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    89
endif
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    90
CC 		= $(MINGW)-gcc
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    91
CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
17006
b9bfa72b7dda 7104565: trim jprt build targets
drchase
parents: 13873
diff changeset
    92
else   #linux
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    93
CPU             = $(shell uname -m)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
    94
ARCH1=$(CPU:x86_64=amd64)
46748
4aeae5b90e60 8185567: fix hsdis cpu to architecture mapping on various Linux platforms
dbuck
parents: 35075
diff changeset
    95
ARCH2=$(ARCH1:i686=i386)
4aeae5b90e60 8185567: fix hsdis cpu to architecture mapping on various Linux platforms
dbuck
parents: 35075
diff changeset
    96
ARCH=$(ARCH2:sparc64=sparcv9)
13873
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
    97
ifdef LP64
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
    98
CFLAGS/sparcv9	+= -m64
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
    99
CFLAGS/amd64	+= -m64
22822
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   100
CFLAGS/ppc64	+= -m64
35075
ca79cbf3f106 8073139: PPC64: User-visible arch directory and os.arch value on ppc64le cause issues with Java tooling
asmundak
parents: 31589
diff changeset
   101
CFLAGS/ppc64le  += -m64 -DABI_ELFv2
13873
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   102
else
46748
4aeae5b90e60 8185567: fix hsdis cpu to architecture mapping on various Linux platforms
dbuck
parents: 35075
diff changeset
   103
ARCH=$(ARCH2:amd64=i386)
4aeae5b90e60 8185567: fix hsdis cpu to architecture mapping on various Linux platforms
dbuck
parents: 35075
diff changeset
   104
ifneq ($(findstring arm,$(ARCH)),)
4aeae5b90e60 8185567: fix hsdis cpu to architecture mapping on various Linux platforms
dbuck
parents: 35075
diff changeset
   105
ARCH=arm
4aeae5b90e60 8185567: fix hsdis cpu to architecture mapping on various Linux platforms
dbuck
parents: 35075
diff changeset
   106
endif
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   107
CFLAGS/i386	+= -m32
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   108
CFLAGS/sparc	+= -m32
13873
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   109
endif
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   110
CFLAGS		+= $(CFLAGS/$(ARCH))
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   111
CFLAGS		+= -fPIC
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   112
OS		= linux
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   113
LIB_EXT		= .so
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   114
CC 		= gcc
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   115
endif
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   116
CFLAGS		+= -O
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   117
DLDFLAGS	+= -shared
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   118
LDFLAGS         += -ldl
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   119
OUTFLAGS	+= -o $@
22822
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   120
else
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   121
## OS = AIX ##
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   122
ifeq		($(OS),AIX)
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   123
OS              = aix
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   124
ARCH            = ppc64
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   125
CC              = xlc_r
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   126
CFLAGS          += -DAIX -g -qpic=large -q64
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   127
CFLAGS/ppc64    += -q64
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   128
AR              = ar -X64
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   129
DLDFLAGS        += -qmkshrobj -lz
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   130
OUTFLAGS        += -o $@
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   131
LIB_EXT		= .so
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   132
else
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   133
## OS = Darwin ##
13873
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   134
ifeq ($(OS),Darwin)
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   135
CPU             = $(shell uname -m)
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   136
ARCH1=$(CPU:x86_64=amd64)
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   137
ARCH=$(ARCH1:i686=i386)
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   138
ifdef LP64
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   139
CFLAGS/sparcv9  += -m64
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   140
CFLAGS/amd64    += -m64
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   141
else
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   142
ARCH=$(ARCH1:amd64=i386)
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   143
CFLAGS/i386     += -m32
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   144
CFLAGS/sparc    += -m32
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   145
endif # LP64
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   146
CFLAGS          += $(CFLAGS/$(ARCH))
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   147
CFLAGS          += -fPIC
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   148
OS              = macosx
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   149
LIB_EXT         = .dylib
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   150
CC              = gcc
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   151
CFLAGS          += -O
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   152
# CFLAGS        += -DZ_PREFIX
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   153
DLDFLAGS        += -shared
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   154
DLDFLAGS        += -lz
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   155
LDFLAGS         += -ldl
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   156
OUTFLAGS        += -o $@
22822
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   157
else
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   158
## OS = Windows ##
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   159
OS		= windows
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   160
CC		= gcc
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   161
CFLAGS		+=  /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
13873
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   162
CFLAGS		+= LIBARCH=\"$(LIBARCH)\"
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   163
DLDFLAGS	+= /dll /subsystem:windows /incremental:no \
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   164
			/export:decode_instruction
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   165
OUTFLAGS	+= /link /out:$@
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   166
LIB_EXT		= .dll
13873
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   167
endif   # Darwin
22822
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   168
endif   # AIX
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   169
endif	# Linux
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   170
endif	# SunOS
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   171
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   172
LIBARCH		= $(ARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   173
ifdef		LP64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   174
LIBARCH64/sparc	= sparcv9
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   175
LIBARCH64/i386	= amd64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   176
LIBARCH64	= $(LIBARCH64/$(ARCH))
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   177
ifneq		($(LIBARCH64),)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   178
LIBARCH		= $(LIBARCH64)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   179
endif   # LIBARCH64/$(ARCH)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   180
endif   # LP64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   181
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   182
JDKARCH=$(LIBARCH:i386=i586)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   183
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   184
ifeq            ($(BINUTILS),)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   185
# Pop all the way out of the workspace to look for binutils.
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   186
# ...You probably want to override this setting.
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   187
BINUTILSDIR	= $(shell cd build/binutils;pwd)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   188
else
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   189
BINUTILSDIR	= $(shell cd $(BINUTILS);pwd)
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   190
endif
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   191
13873
7b72e3873785 6879063: SA should use hsdis for disassembly
minqi
parents: 5547
diff changeset
   192
CPPFLAGS	+= -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   193
CPPFLAGS	+= -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\"
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   194
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   195
TARGET_DIR	= build/$(OS)-$(JDKARCH)
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   196
TARGET		= $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   197
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   198
SOURCE		= hsdis.c
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   199
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   200
LIBRARIES =	$(TARGET_DIR)/bfd/libbfd.a \
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   201
		$(TARGET_DIR)/opcodes/libopcodes.a \
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   202
		$(TARGET_DIR)/libiberty/libiberty.a
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   203
54212
ed40b61fed96 8220784: hsdis cannot be built with MinGW64
ysuenaga
parents: 51271
diff changeset
   204
ifneq ($(MINGW),)
ed40b61fed96 8220784: hsdis cannot be built with MinGW64
ysuenaga
parents: 51271
diff changeset
   205
LIBRARIES +=	$(TARGET_DIR)/zlib/libz.a
ed40b61fed96 8220784: hsdis cannot be built with MinGW64
ysuenaga
parents: 51271
diff changeset
   206
endif
ed40b61fed96 8220784: hsdis cannot be built with MinGW64
ysuenaga
parents: 51271
diff changeset
   207
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   208
DEMO_TARGET	= $(TARGET_DIR)/hsdis-demo
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   209
DEMO_SOURCE	= hsdis-demo.c
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   210
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   211
.PHONY:  all clean demo both
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   212
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   213
all:  $(TARGET)
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   214
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   215
both: all all64
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   216
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   217
%64:
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   218
	$(MAKE) LP64=1 ${@:%64=%}
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   219
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   220
demo: $(TARGET) $(DEMO_TARGET)
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   221
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   222
$(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   223
	if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   224
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   225
$(TARGET_DIR)/Makefile:
22822
696e77cc8e7b 8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
simonis
parents: 17006
diff changeset
   226
	(cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" AR="$(AR)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   227
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   228
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   229
	$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   230
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   231
$(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR)
2564
85c3ae53ca1c 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 347
diff changeset
   232
	$(CC) $(OUTFLAGS) -DTARGET_DIR=\"$(TARGET_DIR)\" $(CPPFLAGS) -g $(CFLAGS/$(ARCH)) $(DEMO_SOURCE) $(LDFLAGS)
347
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   233
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   234
$(TARGET_DIR):
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   235
	[ -d $@ ] || mkdir -p $@
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   236
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   237
clean:
df859fcca515 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
   238
	rm -rf $(TARGET_DIR)