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

     1 #
     2 # Copyright (c) 2008, 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20 # or visit www.oracle.com if you need additional information or have any
    21 # 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   #linux
    70 CPU             = $(shell uname -m)
    71 ARCH1=$(CPU:x86_64=amd64)
    72 ARCH=$(ARCH1:i686=i386)
    73 ifdef LP64
    74 CFLAGS/sparcv9	+= -m64
    75 CFLAGS/amd64	+= -m64
    76 else
    77 ARCH=$(ARCH1:amd64=i386)
    78 CFLAGS/i386	+= -m32
    79 CFLAGS/sparc	+= -m32
    80 endif
    81 CFLAGS		+= $(CFLAGS/$(ARCH))
    82 CFLAGS		+= -fPIC
    83 OS		= linux
    84 LIB_EXT		= .so
    85 CC 		= gcc
    86 endif
    87 CFLAGS		+= -O
    88 DLDFLAGS	+= -shared
    89 LDFLAGS         += -ldl
    90 OUTFLAGS	+= -o $@
    91 ## OS = Windows ##
    92 else   # !SunOS, !Linux => Darwin or Windows
    93 ifeq ($(OS),Darwin)
    94 CPU             = $(shell uname -m)
    95 ARCH1=$(CPU:x86_64=amd64)
    96 ARCH=$(ARCH1:i686=i386)
    97 ifdef LP64
    98 CFLAGS/sparcv9  += -m64
    99 CFLAGS/amd64    += -m64
   100 else
   101 ARCH=$(ARCH1:amd64=i386)
   102 CFLAGS/i386     += -m32
   103 CFLAGS/sparc    += -m32
   104 endif # LP64
   105 CFLAGS          += $(CFLAGS/$(ARCH))
   106 CFLAGS          += -fPIC
   107 OS              = macosx
   108 LIB_EXT         = .dylib
   109 CC              = gcc
   110 CFLAGS          += -O
   111 # CFLAGS        += -DZ_PREFIX
   112 DLDFLAGS        += -shared
   113 DLDFLAGS        += -lz
   114 LDFLAGS         += -ldl
   115 OUTFLAGS        += -o $@
   116 else #Windows
   117 OS		= windows
   118 CC		= gcc
   119 CFLAGS		+=  /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
   120 CFLAGS		+= LIBARCH=\"$(LIBARCH)\"
   121 DLDFLAGS	+= /dll /subsystem:windows /incremental:no \
   122 			/export:decode_instruction
   123 OUTFLAGS	+= /link /out:$@
   124 LIB_EXT		= .dll
   125 endif   # Darwin
   126 endif	# Linux
   127 endif	# SunOS
   129 LIBARCH		= $(ARCH)
   130 ifdef		LP64
   131 LIBARCH64/sparc	= sparcv9
   132 LIBARCH64/i386	= amd64
   133 LIBARCH64	= $(LIBARCH64/$(ARCH))
   134 ifneq		($(LIBARCH64),)
   135 LIBARCH		= $(LIBARCH64)
   136 endif   # LIBARCH64/$(ARCH)
   137 endif   # LP64
   139 JDKARCH=$(LIBARCH:i386=i586)
   141 ifeq            ($(BINUTILS),)
   142 # Pop all the way out of the workspace to look for binutils.
   143 # ...You probably want to override this setting.
   144 BINUTILSDIR	= $(shell cd build/binutils;pwd)
   145 else
   146 BINUTILSDIR	= $(shell cd $(BINUTILS);pwd)
   147 endif
   149 CPPFLAGS	+= -I$(BINUTILSDIR)/include -I$(BINUTILSDIR)/bfd -I$(TARGET_DIR)/bfd
   150 CPPFLAGS	+= -DLIBARCH_$(LIBARCH) -DLIBARCH=\"$(LIBARCH)\" -DLIB_EXT=\"$(LIB_EXT)\"
   152 TARGET_DIR	= build/$(OS)-$(JDKARCH)
   153 TARGET		= $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT)
   155 SOURCE		= hsdis.c
   157 LIBRARIES =	$(TARGET_DIR)/bfd/libbfd.a \
   158 		$(TARGET_DIR)/opcodes/libopcodes.a \
   159 		$(TARGET_DIR)/libiberty/libiberty.a
   161 DEMO_TARGET	= $(TARGET_DIR)/hsdis-demo
   162 DEMO_SOURCE	= hsdis-demo.c
   164 .PHONY:  all clean demo both
   166 all:  $(TARGET)
   168 both: all all64
   170 %64:
   171 	$(MAKE) LP64=1 ${@:%64=%}
   173 demo: $(TARGET) $(DEMO_TARGET)
   175 $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile
   176 	if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
   178 $(TARGET_DIR)/Makefile:
   179 	(cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
   181 $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
   182 	$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
   184 $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR)
   185 	$(CC) $(OUTFLAGS) -DTARGET_DIR=\"$(TARGET_DIR)\" $(CPPFLAGS) -g $(CFLAGS/$(ARCH)) $(DEMO_SOURCE) $(LDFLAGS)
   187 $(TARGET_DIR):
   188 	[ -d $@ ] || mkdir -p $@
   190 clean:
   191 	rm -rf $(TARGET_DIR)

mercurial