src/share/tools/hsdis/Makefile

Fri, 12 Apr 2013 15:53:30 -0700

author
drchase
date
Fri, 12 Apr 2013 15:53:30 -0700
changeset 4942
f36e073d56a4
parent 4093
5a98bf7d847b
child 6456
c9f0adfb4a8b
permissions
-rw-r--r--

7104565: trim jprt build targets
Summary: remove JPRT debug builds, remove -DDEBUG -DFASTDEBUG and use ASSERT instead in sources
Reviewed-by: dholmes, kvn, coleenp

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 #
jrose@535 5 # This code is free software; you can redistribute it and/or modify it
jrose@535 6 # under the terms of the GNU General Public License version 2 only, as
jrose@535 7 # published by the Free Software Foundation.
jrose@535 8 #
jrose@535 9 # This code is distributed in the hope that it will be useful, but WITHOUT
jrose@535 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jrose@535 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jrose@535 12 # version 2 for more details (a copy is included in the LICENSE file that
jrose@535 13 # accompanied this code).
jrose@535 14 #
jrose@535 15 # You should have received a copy of the GNU General Public License version
jrose@535 16 # 2 along with this work; if not, write to the Free Software Foundation,
jrose@535 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jrose@535 18 #
trims@1907 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 # or visit www.oracle.com if you need additional information or have any
trims@1907 21 # questions.
drchase@4942 22 #
jrose@535 23 #
jrose@535 24
never@1155 25 # Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw)
jrose@535 26
jrose@535 27 # Default arch; it is changed below as needed.
jrose@535 28 ARCH = i386
jrose@535 29 OS = $(shell uname)
jrose@535 30
jrose@535 31 ## OS = SunOS ##
jrose@535 32 ifeq ($(OS),SunOS)
never@1155 33 CPU = $(shell uname -p)
never@1155 34 ARCH1=$(CPU:i586=i386)
never@1155 35 ARCH=$(ARCH1:i686=i386)
jrose@535 36 OS = solaris
jrose@535 37 CC = cc
never@1155 38 CFLAGS += -KPIC
never@1155 39 ifdef LP64
never@1155 40 ifeq ($(ARCH),sparc)
never@1155 41 ARCH = sparcv9
never@1155 42 endif
never@1155 43 ifeq ($(ARCH),i386)
never@1155 44 ARCH = amd64
never@1155 45 endif
never@1155 46 endif
never@1155 47 CFLAGS/sparcv9 += -xarch=v9
never@1155 48 CFLAGS/amd64 += -m64
never@1155 49 CFLAGS += $(CFLAGS/$(ARCH))
jrose@535 50 DLDFLAGS += -G
never@1155 51 LDFLAGS += -ldl
jrose@535 52 OUTFLAGS += -o $@
jrose@535 53 LIB_EXT = .so
jrose@535 54 else
jrose@535 55 ## OS = Linux ##
jrose@535 56 ifeq ($(OS),Linux)
never@1155 57 ifneq ($(MINGW),)
never@1155 58 LIB_EXT = .dll
never@1155 59 CPPFLAGS += -I$(TARGET_DIR)/include
never@1155 60 LDFLAGS += -L$(TARGET_DIR)/lib
never@1155 61 OS=windows
never@1155 62 ifneq ($(findstring x86_64-,$(MINGW)),)
never@1155 63 ARCH=amd64
never@1155 64 else
never@1155 65 ARCH=i386
never@1155 66 endif
never@1155 67 CC = $(MINGW)-gcc
never@1155 68 CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
drchase@4942 69 else #linux
jrose@535 70 CPU = $(shell uname -m)
never@1155 71 ARCH1=$(CPU:x86_64=amd64)
never@1155 72 ARCH=$(ARCH1:i686=i386)
minqi@4093 73 ifdef LP64
minqi@4093 74 CFLAGS/sparcv9 += -m64
minqi@4093 75 CFLAGS/amd64 += -m64
minqi@4093 76 else
minqi@4093 77 ARCH=$(ARCH1:amd64=i386)
never@1155 78 CFLAGS/i386 += -m32
never@1155 79 CFLAGS/sparc += -m32
minqi@4093 80 endif
never@1155 81 CFLAGS += $(CFLAGS/$(ARCH))
never@1155 82 CFLAGS += -fPIC
jrose@535 83 OS = linux
never@1155 84 LIB_EXT = .so
jrose@535 85 CC = gcc
never@1155 86 endif
never@1155 87 CFLAGS += -O
jrose@535 88 DLDFLAGS += -shared
never@1155 89 LDFLAGS += -ldl
jrose@535 90 OUTFLAGS += -o $@
jrose@535 91 ## OS = Windows ##
minqi@4093 92 else # !SunOS, !Linux => Darwin or Windows
minqi@4093 93 ifeq ($(OS),Darwin)
minqi@4093 94 CPU = $(shell uname -m)
minqi@4093 95 ARCH1=$(CPU:x86_64=amd64)
minqi@4093 96 ARCH=$(ARCH1:i686=i386)
minqi@4093 97 ifdef LP64
minqi@4093 98 CFLAGS/sparcv9 += -m64
minqi@4093 99 CFLAGS/amd64 += -m64
minqi@4093 100 else
minqi@4093 101 ARCH=$(ARCH1:amd64=i386)
minqi@4093 102 CFLAGS/i386 += -m32
minqi@4093 103 CFLAGS/sparc += -m32
minqi@4093 104 endif # LP64
minqi@4093 105 CFLAGS += $(CFLAGS/$(ARCH))
minqi@4093 106 CFLAGS += -fPIC
minqi@4093 107 OS = macosx
minqi@4093 108 LIB_EXT = .dylib
minqi@4093 109 CC = gcc
minqi@4093 110 CFLAGS += -O
minqi@4093 111 # CFLAGS += -DZ_PREFIX
minqi@4093 112 DLDFLAGS += -shared
minqi@4093 113 DLDFLAGS += -lz
minqi@4093 114 LDFLAGS += -ldl
minqi@4093 115 OUTFLAGS += -o $@
minqi@4093 116 else #Windows
never@1155 117 OS = windows
never@1155 118 CC = gcc
never@1155 119 CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
minqi@4093 120 CFLAGS += LIBARCH=\"$(LIBARCH)\"
jrose@535 121 DLDFLAGS += /dll /subsystem:windows /incremental:no \
jrose@535 122 /export:decode_instruction
jrose@535 123 OUTFLAGS += /link /out:$@
jrose@535 124 LIB_EXT = .dll
minqi@4093 125 endif # Darwin
jrose@535 126 endif # Linux
jrose@535 127 endif # SunOS
jrose@535 128
jrose@535 129 LIBARCH = $(ARCH)
jrose@535 130 ifdef LP64
jrose@535 131 LIBARCH64/sparc = sparcv9
jrose@535 132 LIBARCH64/i386 = amd64
jrose@535 133 LIBARCH64 = $(LIBARCH64/$(ARCH))
jrose@535 134 ifneq ($(LIBARCH64),)
jrose@535 135 LIBARCH = $(LIBARCH64)
jrose@535 136 endif # LIBARCH64/$(ARCH)
jrose@535 137 endif # LP64
jrose@535 138
never@1155 139 JDKARCH=$(LIBARCH:i386=i586)
never@1155 140
never@1155 141 ifeq ($(BINUTILS),)
never@1155 142 # Pop all the way out of the workspace to look for binutils.
never@1155 143 # ...You probably want to override this setting.
never@1155 144 BINUTILSDIR = $(shell cd build/binutils;pwd)
never@1155 145 else
never@1155 146 BINUTILSDIR = $(shell cd $(BINUTILS);pwd)
never@1155 147 endif
never@1155 148
minqi@4093 149 CPPFLAGS += -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd
never@1155 150 CPPFLAGS += -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\"
never@1155 151
never@1155 152 TARGET_DIR = build/$(OS)-$(JDKARCH)
jrose@535 153 TARGET = $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT)
jrose@535 154
jrose@535 155 SOURCE = hsdis.c
jrose@535 156
never@1155 157 LIBRARIES = $(TARGET_DIR)/bfd/libbfd.a \
never@1155 158 $(TARGET_DIR)/opcodes/libopcodes.a \
never@1155 159 $(TARGET_DIR)/libiberty/libiberty.a
jrose@535 160
never@1155 161 DEMO_TARGET = $(TARGET_DIR)/hsdis-demo
jrose@535 162 DEMO_SOURCE = hsdis-demo.c
jrose@535 163
jrose@535 164 .PHONY: all clean demo both
jrose@535 165
never@1155 166 all: $(TARGET)
jrose@535 167
jrose@535 168 both: all all64
jrose@535 169
jrose@535 170 %64:
jrose@535 171 $(MAKE) LP64=1 ${@:%64=%}
jrose@535 172
jrose@535 173 demo: $(TARGET) $(DEMO_TARGET)
jrose@535 174
never@1155 175 $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile
never@1155 176 if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
never@1155 177
never@1155 178 $(TARGET_DIR)/Makefile:
never@1155 179 (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
jrose@535 180
jrose@535 181 $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
never@1155 182 $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
jrose@535 183
jrose@535 184 $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR)
never@1155 185 $(CC) $(OUTFLAGS) -DTARGET_DIR=\"$(TARGET_DIR)\" $(CPPFLAGS) -g $(CFLAGS/$(ARCH)) $(DEMO_SOURCE) $(LDFLAGS)
jrose@535 186
jrose@535 187 $(TARGET_DIR):
jrose@535 188 [ -d $@ ] || mkdir -p $@
jrose@535 189
jrose@535 190 clean:
jrose@535 191 rm -rf $(TARGET_DIR)

mercurial