src/share/tools/hsdis/Makefile

Wed, 01 Aug 2018 04:15:43 -0400

author
dbuck
date
Wed, 01 Aug 2018 04:15:43 -0400
changeset 9476
9a18c71dbd25
parent 9473
d0613fb2fc3b
child 9493
882a55369341
permissions
-rw-r--r--

8208541: non-ASCII characters in hsdis UPL text
Summary: replace Unicode left/right double quote pair with normal ASCII double quotes
Reviewed-by: jrose

jrose@535 1 #
drchase@4942 2 # Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
jrose@535 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jrose@535 4 #
dbuck@9473 5 # The Universal Permissive License (UPL), Version 1.0
jrose@535 6 #
dbuck@9473 7 # Subject to the condition set forth below, permission is hereby granted to
dbuck@9473 8 # any person obtaining a copy of this software, associated documentation
dbuck@9473 9 # and/or data (collectively the "Software"), free of charge and under any
dbuck@9473 10 # and all copyright rights in the Software, and any and all patent rights
dbuck@9473 11 # owned or freely licensable by each licensor hereunder covering either (i)
dbuck@9473 12 # the unmodified Software as contributed to or provided by such licensor,
dbuck@9473 13 # or (ii) the Larger Works (as defined below), to deal in both
jrose@535 14 #
dbuck@9473 15 # (a) the Software, and
dbuck@9473 16 #
dbuck@9473 17 # (b) any piece of software and/or hardware listed in the lrgrwrks.txt file
dbuck@9476 18 # if one is included with the Software (each a "Larger Work" to which the
dbuck@9473 19 # Software is contributed by such licensors),
dbuck@9473 20 #
dbuck@9473 21 # without restriction, including without limitation the rights to copy,
dbuck@9473 22 # create derivative works of, display, perform, and distribute the Software
dbuck@9473 23 # and make, use, sell, offer for sale, import, export, have made, and have
dbuck@9473 24 # sold the Software and the Larger Work(s), and to sublicense the foregoing
dbuck@9473 25 # rights on either these or other terms.
dbuck@9473 26 #
dbuck@9473 27 # This license is subject to the following condition:
dbuck@9473 28 #
dbuck@9473 29 # The above copyright notice and either this complete permission notice or
dbuck@9473 30 # at a minimum a reference to the UPL must be included in all copies or
dbuck@9473 31 # substantial portions of the Software.
dbuck@9473 32 #
dbuck@9473 33 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
dbuck@9473 34 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
dbuck@9473 35 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
dbuck@9473 36 # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
dbuck@9473 37 # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
dbuck@9473 38 # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
dbuck@9473 39 # USE OR OTHER DEALINGS IN THE SOFTWARE.
jrose@535 40 #
trims@1907 41 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 42 # or visit www.oracle.com if you need additional information or have any
trims@1907 43 # questions.
drchase@4942 44 #
jrose@535 45 #
jrose@535 46
never@1155 47 # Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw)
jrose@535 48
jrose@535 49 # Default arch; it is changed below as needed.
jrose@535 50 ARCH = i386
jrose@535 51 OS = $(shell uname)
simonis@6456 52 AR = ar
jrose@535 53
jrose@535 54 ## OS = SunOS ##
jrose@535 55 ifeq ($(OS),SunOS)
never@1155 56 CPU = $(shell uname -p)
never@1155 57 ARCH1=$(CPU:i586=i386)
never@1155 58 ARCH=$(ARCH1:i686=i386)
jrose@535 59 OS = solaris
jrose@535 60 CC = cc
never@1155 61 CFLAGS += -KPIC
never@1155 62 ifdef LP64
never@1155 63 ifeq ($(ARCH),sparc)
never@1155 64 ARCH = sparcv9
never@1155 65 endif
never@1155 66 ifeq ($(ARCH),i386)
never@1155 67 ARCH = amd64
never@1155 68 endif
never@1155 69 endif
never@1155 70 CFLAGS/sparcv9 += -xarch=v9
never@1155 71 CFLAGS/amd64 += -m64
never@1155 72 CFLAGS += $(CFLAGS/$(ARCH))
jrose@535 73 DLDFLAGS += -G
never@1155 74 LDFLAGS += -ldl
jrose@535 75 OUTFLAGS += -o $@
jrose@535 76 LIB_EXT = .so
jrose@535 77 else
jrose@535 78 ## OS = Linux ##
jrose@535 79 ifeq ($(OS),Linux)
never@1155 80 ifneq ($(MINGW),)
never@1155 81 LIB_EXT = .dll
never@1155 82 CPPFLAGS += -I$(TARGET_DIR)/include
never@1155 83 LDFLAGS += -L$(TARGET_DIR)/lib
never@1155 84 OS=windows
never@1155 85 ifneq ($(findstring x86_64-,$(MINGW)),)
never@1155 86 ARCH=amd64
never@1155 87 else
never@1155 88 ARCH=i386
never@1155 89 endif
never@1155 90 CC = $(MINGW)-gcc
never@1155 91 CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
drchase@4942 92 else #linux
jrose@535 93 CPU = $(shell uname -m)
never@1155 94 ARCH1=$(CPU:x86_64=amd64)
never@1155 95 ARCH=$(ARCH1:i686=i386)
minqi@4093 96 ifdef LP64
minqi@4093 97 CFLAGS/sparcv9 += -m64
minqi@4093 98 CFLAGS/amd64 += -m64
simonis@6456 99 CFLAGS/ppc64 += -m64
minqi@4093 100 else
minqi@4093 101 ARCH=$(ARCH1:amd64=i386)
never@1155 102 CFLAGS/i386 += -m32
never@1155 103 CFLAGS/sparc += -m32
minqi@4093 104 endif
never@1155 105 CFLAGS += $(CFLAGS/$(ARCH))
never@1155 106 CFLAGS += -fPIC
jrose@535 107 OS = linux
never@1155 108 LIB_EXT = .so
jrose@535 109 CC = gcc
never@1155 110 endif
never@1155 111 CFLAGS += -O
jrose@535 112 DLDFLAGS += -shared
never@1155 113 LDFLAGS += -ldl
jrose@535 114 OUTFLAGS += -o $@
simonis@6456 115 else
simonis@6456 116 ## OS = AIX ##
simonis@6456 117 ifeq ($(OS),AIX)
simonis@6456 118 OS = aix
simonis@6456 119 ARCH = ppc64
simonis@6456 120 CC = xlc_r
simonis@6456 121 CFLAGS += -DAIX -g -qpic=large -q64
simonis@6456 122 CFLAGS/ppc64 += -q64
simonis@6456 123 AR = ar -X64
simonis@6456 124 DLDFLAGS += -qmkshrobj -lz
simonis@6456 125 OUTFLAGS += -o $@
simonis@6456 126 LIB_EXT = .so
simonis@6456 127 else
simonis@6456 128 ## OS = Darwin ##
minqi@4093 129 ifeq ($(OS),Darwin)
minqi@4093 130 CPU = $(shell uname -m)
minqi@4093 131 ARCH1=$(CPU:x86_64=amd64)
minqi@4093 132 ARCH=$(ARCH1:i686=i386)
minqi@4093 133 ifdef LP64
minqi@4093 134 CFLAGS/sparcv9 += -m64
minqi@4093 135 CFLAGS/amd64 += -m64
minqi@4093 136 else
minqi@4093 137 ARCH=$(ARCH1:amd64=i386)
minqi@4093 138 CFLAGS/i386 += -m32
minqi@4093 139 CFLAGS/sparc += -m32
minqi@4093 140 endif # LP64
minqi@4093 141 CFLAGS += $(CFLAGS/$(ARCH))
minqi@4093 142 CFLAGS += -fPIC
minqi@4093 143 OS = macosx
minqi@4093 144 LIB_EXT = .dylib
minqi@4093 145 CC = gcc
minqi@4093 146 CFLAGS += -O
minqi@4093 147 # CFLAGS += -DZ_PREFIX
minqi@4093 148 DLDFLAGS += -shared
minqi@4093 149 DLDFLAGS += -lz
minqi@4093 150 LDFLAGS += -ldl
minqi@4093 151 OUTFLAGS += -o $@
simonis@6456 152 else
simonis@6456 153 ## OS = Windows ##
never@1155 154 OS = windows
never@1155 155 CC = gcc
never@1155 156 CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
minqi@4093 157 CFLAGS += LIBARCH=\"$(LIBARCH)\"
jrose@535 158 DLDFLAGS += /dll /subsystem:windows /incremental:no \
jrose@535 159 /export:decode_instruction
jrose@535 160 OUTFLAGS += /link /out:$@
jrose@535 161 LIB_EXT = .dll
minqi@4093 162 endif # Darwin
simonis@6456 163 endif # AIX
jrose@535 164 endif # Linux
jrose@535 165 endif # SunOS
jrose@535 166
jrose@535 167 LIBARCH = $(ARCH)
jrose@535 168 ifdef LP64
jrose@535 169 LIBARCH64/sparc = sparcv9
jrose@535 170 LIBARCH64/i386 = amd64
jrose@535 171 LIBARCH64 = $(LIBARCH64/$(ARCH))
jrose@535 172 ifneq ($(LIBARCH64),)
jrose@535 173 LIBARCH = $(LIBARCH64)
jrose@535 174 endif # LIBARCH64/$(ARCH)
jrose@535 175 endif # LP64
jrose@535 176
never@1155 177 JDKARCH=$(LIBARCH:i386=i586)
never@1155 178
never@1155 179 ifeq ($(BINUTILS),)
never@1155 180 # Pop all the way out of the workspace to look for binutils.
never@1155 181 # ...You probably want to override this setting.
never@1155 182 BINUTILSDIR = $(shell cd build/binutils;pwd)
never@1155 183 else
never@1155 184 BINUTILSDIR = $(shell cd $(BINUTILS);pwd)
never@1155 185 endif
never@1155 186
minqi@4093 187 CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd
never@1155 188 CPPFLAGS += -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\"
never@1155 189
never@1155 190 TARGET_DIR = build/$(OS)-$(JDKARCH)
jrose@535 191 TARGET = $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT)
jrose@535 192
jrose@535 193 SOURCE = hsdis.c
jrose@535 194
never@1155 195 LIBRARIES = $(TARGET_DIR)/bfd/libbfd.a \
never@1155 196 $(TARGET_DIR)/opcodes/libopcodes.a \
never@1155 197 $(TARGET_DIR)/libiberty/libiberty.a
jrose@535 198
never@1155 199 DEMO_TARGET = $(TARGET_DIR)/hsdis-demo
jrose@535 200 DEMO_SOURCE = hsdis-demo.c
jrose@535 201
jrose@535 202 .PHONY: all clean demo both
jrose@535 203
never@1155 204 all: $(TARGET)
jrose@535 205
jrose@535 206 both: all all64
jrose@535 207
jrose@535 208 %64:
jrose@535 209 $(MAKE) LP64=1 ${@:%64=%}
jrose@535 210
jrose@535 211 demo: $(TARGET) $(DEMO_TARGET)
jrose@535 212
never@1155 213 $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile
never@1155 214 if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
never@1155 215
never@1155 216 $(TARGET_DIR)/Makefile:
simonis@6456 217 (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" AR="$(AR)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
jrose@535 218
jrose@535 219 $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
never@1155 220 $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
jrose@535 221
jrose@535 222 $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR)
never@1155 223 $(CC) $(OUTFLAGS) -DTARGET_DIR=\"$(TARGET_DIR)\" $(CPPFLAGS) -g $(CFLAGS/$(ARCH)) $(DEMO_SOURCE) $(LDFLAGS)
jrose@535 224
jrose@535 225 $(TARGET_DIR):
jrose@535 226 [ -d $@ ] || mkdir -p $@
jrose@535 227
jrose@535 228 clean:
jrose@535 229 rm -rf $(TARGET_DIR)

mercurial