equal
deleted
inserted
replaced
25 # Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw) |
25 # Single gnu makefile for solaris, linux and windows (windows requires cygwin and mingw) |
26 |
26 |
27 # Default arch; it is changed below as needed. |
27 # Default arch; it is changed below as needed. |
28 ARCH = i386 |
28 ARCH = i386 |
29 OS = $(shell uname) |
29 OS = $(shell uname) |
|
30 AR = ar |
30 |
31 |
31 ## OS = SunOS ## |
32 ## OS = SunOS ## |
32 ifeq ($(OS),SunOS) |
33 ifeq ($(OS),SunOS) |
33 CPU = $(shell uname -p) |
34 CPU = $(shell uname -p) |
34 ARCH1=$(CPU:i586=i386) |
35 ARCH1=$(CPU:i586=i386) |
71 ARCH1=$(CPU:x86_64=amd64) |
72 ARCH1=$(CPU:x86_64=amd64) |
72 ARCH=$(ARCH1:i686=i386) |
73 ARCH=$(ARCH1:i686=i386) |
73 ifdef LP64 |
74 ifdef LP64 |
74 CFLAGS/sparcv9 += -m64 |
75 CFLAGS/sparcv9 += -m64 |
75 CFLAGS/amd64 += -m64 |
76 CFLAGS/amd64 += -m64 |
|
77 CFLAGS/ppc64 += -m64 |
76 else |
78 else |
77 ARCH=$(ARCH1:amd64=i386) |
79 ARCH=$(ARCH1:amd64=i386) |
78 CFLAGS/i386 += -m32 |
80 CFLAGS/i386 += -m32 |
79 CFLAGS/sparc += -m32 |
81 CFLAGS/sparc += -m32 |
80 endif |
82 endif |
86 endif |
88 endif |
87 CFLAGS += -O |
89 CFLAGS += -O |
88 DLDFLAGS += -shared |
90 DLDFLAGS += -shared |
89 LDFLAGS += -ldl |
91 LDFLAGS += -ldl |
90 OUTFLAGS += -o $@ |
92 OUTFLAGS += -o $@ |
91 ## OS = Windows ## |
93 else |
92 else # !SunOS, !Linux => Darwin or Windows |
94 ## OS = AIX ## |
|
95 ifeq ($(OS),AIX) |
|
96 OS = aix |
|
97 ARCH = ppc64 |
|
98 CC = xlc_r |
|
99 CFLAGS += -DAIX -g -qpic=large -q64 |
|
100 CFLAGS/ppc64 += -q64 |
|
101 AR = ar -X64 |
|
102 DLDFLAGS += -qmkshrobj -lz |
|
103 OUTFLAGS += -o $@ |
|
104 LIB_EXT = .so |
|
105 else |
|
106 ## OS = Darwin ## |
93 ifeq ($(OS),Darwin) |
107 ifeq ($(OS),Darwin) |
94 CPU = $(shell uname -m) |
108 CPU = $(shell uname -m) |
95 ARCH1=$(CPU:x86_64=amd64) |
109 ARCH1=$(CPU:x86_64=amd64) |
96 ARCH=$(ARCH1:i686=i386) |
110 ARCH=$(ARCH1:i686=i386) |
97 ifdef LP64 |
111 ifdef LP64 |
111 # CFLAGS += -DZ_PREFIX |
125 # CFLAGS += -DZ_PREFIX |
112 DLDFLAGS += -shared |
126 DLDFLAGS += -shared |
113 DLDFLAGS += -lz |
127 DLDFLAGS += -lz |
114 LDFLAGS += -ldl |
128 LDFLAGS += -ldl |
115 OUTFLAGS += -o $@ |
129 OUTFLAGS += -o $@ |
116 else #Windows |
130 else |
|
131 ## OS = Windows ## |
117 OS = windows |
132 OS = windows |
118 CC = gcc |
133 CC = gcc |
119 CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi- |
134 CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi- |
120 CFLAGS += LIBARCH=\"$(LIBARCH)\" |
135 CFLAGS += LIBARCH=\"$(LIBARCH)\" |
121 DLDFLAGS += /dll /subsystem:windows /incremental:no \ |
136 DLDFLAGS += /dll /subsystem:windows /incremental:no \ |
122 /export:decode_instruction |
137 /export:decode_instruction |
123 OUTFLAGS += /link /out:$@ |
138 OUTFLAGS += /link /out:$@ |
124 LIB_EXT = .dll |
139 LIB_EXT = .dll |
125 endif # Darwin |
140 endif # Darwin |
|
141 endif # AIX |
126 endif # Linux |
142 endif # Linux |
127 endif # SunOS |
143 endif # SunOS |
128 |
144 |
129 LIBARCH = $(ARCH) |
145 LIBARCH = $(ARCH) |
130 ifdef LP64 |
146 ifdef LP64 |
174 |
190 |
175 $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile |
191 $(LIBRARIES): $(TARGET_DIR) $(TARGET_DIR)/Makefile |
176 if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi |
192 if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi |
177 |
193 |
178 $(TARGET_DIR)/Makefile: |
194 $(TARGET_DIR)/Makefile: |
179 (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS)) |
195 (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" AR="$(AR)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS)) |
180 |
196 |
181 $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR) |
197 $(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR) |
182 $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) |
198 $(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) |
183 |
199 |
184 $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR) |
200 $(DEMO_TARGET): $(DEMO_SOURCE) $(TARGET) $(TARGET_DIR) |