Mercurial > hg > truffle
annotate src/share/tools/hsdis/Makefile @ 458:95cad1ab2510
Merge
author | jmasa |
---|---|
date | Wed, 03 Dec 2008 14:44:48 -0800 |
parents | c7c777385a15 |
children | 67a2f5ba5582 |
rev | line source |
---|---|
100
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
1 # |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
2 # Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
c7c777385a15
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. |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
4 # |
c7c777385a15
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 |
c7c777385a15
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 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
7 # published by the Free Software Foundation. |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
8 # |
c7c777385a15
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 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c7c777385a15
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 |
c7c777385a15
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 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
13 # accompanied this code). |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
14 # |
c7c777385a15
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 |
c7c777385a15
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, |
c7c777385a15
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. |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
18 # |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
c7c777385a15
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 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
21 # have any questions. |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
22 # |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
23 # |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
24 |
c7c777385a15
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 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
26 # cygwin). |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
27 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
28 ifeq ($(BINUTILS),) |
c7c777385a15
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. |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
30 # ...You probably want to override this setting. |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
31 BINUTILS = $(shell cd ../../../../..;pwd)/binutils-2.17-$(LIBARCH) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
32 endif |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
33 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
34 # Default arch; it is changed below as needed. |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
35 ARCH = i386 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
36 OS = $(shell uname) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
37 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
38 CPPFLAGS += -I$(BINUTILS)/include -I$(BINUTILS)/bfd |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
39 CPPFLAGS += -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" -DLIBARCH_$(LIBARCH) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
40 CPPFLAGS += -DHOTSPOT_OS=\"$(OS)\" -DOS_$(OS) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
41 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
42 ## OS = SunOS ## |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
43 ifeq ($(OS),SunOS) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
44 ARCH = $(shell uname -p) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
45 OS = solaris |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
46 CC = cc |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
47 CCFLAGS += -Kpic -g |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
48 CCFLAGS/amd64 += -xarch=amd64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
49 CCFLAGS/sparcv9 += -xarch=v9 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
50 CCFLAGS += $(CCFLAGS/$(LIBARCH)) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
51 DLDFLAGS += -G |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
52 OUTFLAGS += -o $@ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
53 LIB_EXT = .so |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
54 else |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
55 ## OS = Linux ## |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
56 ifeq ($(OS),Linux) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
57 CPU = $(shell uname -m) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
58 ifeq ($(CPU),ia64) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
59 ARCH = ia64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
60 else |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
61 ifeq ($(CPU),x86_64) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
62 CCFLAGS += -fPIC |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
63 endif # x86_64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
64 endif # ia64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
65 OS = linux |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
66 CC = gcc |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
67 CCFLAGS += -O |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
68 DLDFLAGS += -shared |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
69 OUTFLAGS += -o $@ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
70 LIB_EXT = .so |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
71 CPPFLAGS += -Iinclude -Iinclude/$(OS)_$(ARCH)/ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
72 ## OS = Windows ## |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
73 else # !SunOS, !Linux => Windows |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
74 OS = win |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
75 CC = cl |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
76 #CPPFLAGS += /D"WIN32" /D"_WINDOWS" /D"DEBUG" /D"NDEBUG" |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
77 CCFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi- |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
78 CCFLAGS += -Iinclude -Iinclude/gnu -Iinclude/$(OS)_$(ARCH) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
79 CCFLAGS += /D"HOTSPOT_LIB_ARCH=\"$(LIBARCH)\"" |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
80 DLDFLAGS += /dll /subsystem:windows /incremental:no \ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
81 /export:decode_instruction |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
82 OUTFLAGS += /link /out:$@ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
83 LIB_EXT = .dll |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
84 endif # Linux |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
85 endif # SunOS |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
86 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
87 LIBARCH = $(ARCH) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
88 ifdef LP64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
89 LIBARCH64/sparc = sparcv9 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
90 LIBARCH64/i386 = amd64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
91 LIBARCH64 = $(LIBARCH64/$(ARCH)) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
92 ifneq ($(LIBARCH64),) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
93 LIBARCH = $(LIBARCH64) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
94 endif # LIBARCH64/$(ARCH) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
95 endif # LP64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
96 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
97 TARGET_DIR = bin/$(OS) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
98 TARGET = $(TARGET_DIR)/hsdis-$(LIBARCH)$(LIB_EXT) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
99 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
100 SOURCE = hsdis.c |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
101 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
102 LIBRARIES = $(BINUTILS)/bfd/libbfd.a \ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
103 $(BINUTILS)/opcodes/libopcodes.a \ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
104 $(BINUTILS)/libiberty/libiberty.a |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
105 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
106 DEMO_TARGET = $(TARGET_DIR)/hsdis-demo-$(LIBARCH) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
107 DEMO_SOURCE = hsdis-demo.c |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
108 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
109 .PHONY: all clean demo both |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
110 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
111 all: $(TARGET) demo |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
112 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
113 both: all all64 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
114 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
115 %64: |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
116 $(MAKE) LP64=1 ${@:%64=%} |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
117 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
118 demo: $(TARGET) $(DEMO_TARGET) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
119 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
120 $(LIBRARIES): |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
121 @echo "*** Please build binutils first; see ./README: ***" |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
122 @sed < ./README '1,/__________/d' | head -20 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
123 @echo "..."; exit 1 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
124 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
125 $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
126 $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CCFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
127 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
128 $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
129 $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CCFLAGS) $(DEMO_SOURCE) $(LDFLAGS) |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
130 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
131 $(TARGET_DIR): |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
132 [ -d $@ ] || mkdir -p $@ |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
133 |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
134 clean: |
c7c777385a15
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
135 rm -rf $(TARGET_DIR) |