• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2PUB_HEADERS = 	pub/libvex_basictypes.h 		\
3		pub/libvex_ir.h				\
4		pub/libvex.h				\
5		pub/libvex_trc_values.h			\
6		pub/libvex_emnote.h			\
7		pub/libvex_guest_x86.h			\
8		pub/libvex_guest_amd64.h		\
9		pub/libvex_guest_arm.h			\
10		pub/libvex_guest_ppc32.h		\
11		pub/libvex_guest_ppc64.h		\
12		pub/libvex_guest_s390x.h		\
13		pub/libvex_s390x_common.h		\
14		pub/libvex_guest_mips32.h		\
15		pub/libvex_guest_offsets.h
16
17PRIV_HEADERS = 	priv/host_x86_defs.h			\
18		priv/host_amd64_defs.h			\
19		priv/host_arm_defs.h			\
20		priv/host_ppc_defs.h			\
21		priv/host_s390_defs.h			\
22		priv/host_mips_defs.h			\
23		priv/host_generic_maddf.h	        \
24		priv/host_generic_regs.h	        \
25		priv/host_generic_simd64.h	        \
26		priv/host_generic_simd128.h	        \
27		priv/host_generic_simd256.h	        \
28		priv/main_globals.h			\
29		priv/main_util.h			\
30		priv/guest_generic_x87.h               	\
31		priv/guest_generic_bb_to_IR.h		\
32		priv/guest_x86_defs.h			\
33		priv/guest_amd64_defs.h	               	\
34		priv/guest_arm_defs.h			\
35		priv/guest_ppc_defs.h			\
36		priv/guest_mips_defs.h			\
37		priv/s390_disasm.h		        \
38		priv/s390_defs.h		        \
39		priv/ir_match.h			        \
40		priv/ir_opt.h
41
42LIB_OBJS = 	priv/ir_defs.o                          \
43		priv/ir_match.o			        \
44		priv/ir_opt.o				\
45		priv/ir_inject.o			\
46		priv/main_main.o			\
47		priv/main_globals.o			\
48		priv/main_util.o			\
49		priv/s390_disasm.o			\
50		priv/host_x86_defs.o			\
51		priv/host_amd64_defs.o			\
52		priv/host_arm_defs.o			\
53		priv/host_arm64_defs.o			\
54		priv/host_ppc_defs.o			\
55		priv/host_s390_defs.o			\
56		priv/host_mips_defs.o			\
57		priv/host_x86_isel.o			\
58		priv/host_amd64_isel.o			\
59		priv/host_arm_isel.o			\
60		priv/host_arm64_isel.o			\
61		priv/host_ppc_isel.o			\
62		priv/host_s390_isel.o			\
63		priv/host_mips_isel.o			\
64		priv/host_generic_maddf.o	        \
65		priv/host_generic_regs.o	        \
66		priv/host_generic_simd64.o	        \
67		priv/host_generic_simd128.o	        \
68		priv/host_generic_simd256.o	        \
69		priv/host_generic_reg_alloc2.o		\
70		priv/guest_generic_x87.o	        \
71		priv/guest_generic_bb_to_IR.o		\
72		priv/guest_x86_helpers.o		\
73		priv/guest_amd64_helpers.o		\
74		priv/guest_arm_helpers.o		\
75		priv/guest_arm64_helpers.o		\
76		priv/guest_ppc_helpers.o		\
77		priv/guest_s390_helpers.o		\
78		priv/guest_mips_helpers.o		\
79		priv/guest_x86_toIR.o			\
80		priv/guest_amd64_toIR.o			\
81		priv/guest_arm_toIR.o			\
82		priv/guest_arm64_toIR.o			\
83		priv/guest_ppc_toIR.o                   \
84		priv/guest_s390_toIR.o			\
85		priv/guest_mips_toIR.o
86
87PUB_INCLUDES = -Ipub
88
89# Do not add any priv/host-ARCH or priv/guest-ARCH directories to this
90# list, as they contain duplicate file names (each host has a hdefs.h,
91# for example).
92PRIV_INCLUDES = -Ipriv
93
94
95ifndef CC
96   CC = gcc
97endif
98ifndef AR
99   AR = ar
100endif
101
102# Put -g -O2 after any flags we inherit from V.  -O2 vs -O
103# makes a significant difference, at least with gcc4.
104CCFLAGS = -Wall -Wmissing-prototypes -Wshadow \
105		-Wpointer-arith -Wbad-function-cast -Wcast-qual \
106		-Wcast-align -Wmissing-declarations \
107		-Wno-pointer-sign \
108		$(EXTRA_CFLAGS) -g -O2 -fstrict-aliasing \
109                \
110                -O
111
112#CC = icc
113#CCFLAGS = -g -Wall -wd981 -wd279 -wd1287 -wd869 -wd111 -wd188 -wd186
114# 981: operands are evaluated in unspecified order
115# 279: controlling expression is constant
116# 1287: invalid attribute for parameter
117# 869: parameter "..." was never referenced
118# 111: statement is unreachable
119# 188: enumerated type mixed with another type
120# (the above are for icc 8.0 -- 8.0.0.55 I think)
121# 186: pointless comparison of unsigned integer with zero
122
123# kludge: stops V biarch builds screwing up at -j 2 or above
124# The Right fix is to autoconf/automake-ise vex.
125.NOTPARALLEL:
126
127all: vex
128
129# Empty, needed for Valgrind
130install:
131
132scratch: clean all
133
134vex: libvex.a test_main.o
135	$(CC) $(CCFLAGS) -o vex test_main.o libvex.a
136
137libvex.a: $(LIB_OBJS)
138	rm -f libvex.a
139	$(AR) crus libvex.a $(LIB_OBJS)
140
141
142# The idea with these TAG-s is to mark the flavour of libvex.a
143# most recently built, so if the same target is re-requested, we
144# don't rebuild everything, but if a different one is requested
145# then we scrub everything and start over.
146
147libvex-x86-linux.a: TAG-x86-linux libvex.a
148	mv -f libvex.a libvex-x86-linux.a
149TAG-x86-linux:
150	if [ ! -f TAG-x86-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
151	touch TAG-x86-linux
152
153libvex-amd64-linux.a: TAG-amd64-linux libvex.a
154	mv -f libvex.a libvex-amd64-linux.a
155TAG-amd64-linux:
156	if [ ! -f TAG-amd64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
157	touch TAG-amd64-linux
158
159libvex-ppc32-linux.a: TAG-ppc32-linux libvex.a
160	mv -f libvex.a libvex-ppc32-linux.a
161TAG-ppc32-linux:
162	if [ ! -f TAG-ppc32-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
163	touch TAG-ppc32-linux
164
165libvex-ppc64-linux.a: TAG-ppc64-linux libvex.a
166	mv -f libvex.a libvex-ppc64-linux.a
167TAG-ppc64-linux:
168	if [ ! -f TAG-ppc64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
169	touch TAG-ppc64-linux
170
171libvex-mips-linux.a: TAG-mips32-linux libvex.a
172	mv -f libvex.a libvex-mips32-linux.a
173TAG-mips-linux:
174	if [ ! -f TAG-mips32-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
175	touch TAG-mips32-linux
176
177libvex-ppc32-aix5.a: TAG-ppc32-aix5 libvex.a
178	mv -f libvex.a libvex-ppc32-aix5.a
179TAG-ppc32-aix5:
180	if [ ! -f TAG-ppc32-aix5 ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
181	touch TAG-ppc32-aix5
182
183libvex-ppc64-aix5.a: TAG-ppc64-aix5 libvex.a
184	mv -f libvex.a libvex-ppc64-aix5.a
185TAG-ppc64-aix5:
186	if [ ! -f TAG-ppc64-aix5 ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
187	touch TAG-ppc64-aix5
188
189libvex-x86-darwin.a: TAG-x86-darwin libvex.a
190	mv -f libvex.a libvex-x86-darwin.a
191TAG-x86-darwin:
192	if [ ! -f TAG-x86-darwin ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
193	touch TAG-x86-darwin
194
195libvex-amd64-darwin.a: TAG-amd64-darwin libvex.a
196	mv -f libvex.a libvex-amd64-darwin.a
197TAG-amd64-darwin:
198	if [ ! -f TAG-amd64-darwin ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
199	touch TAG-amd64-darwin
200
201libvex-arm64-linux.a: TAG-arm64-linux libvex.a
202	mv -f libvex.a libvex-arm64-linux.a
203TAG-arm64-linux:
204	if [ ! -f TAG-arm64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
205	touch TAG-arm64-linux
206
207
208clean:
209	rm -f $(LIB_OBJS) *.a vex test_main.o TAG-* \
210		pub/libvex_guest_offsets.h \
211		auxprogs/genoffsets.s
212
213minidist:
214	rm -f vex--minidist-2005MMDD.tar
215	tar cf vex--minidist-2005MMDD.tar $(PUB_HEADERS) $(PRIV_HEADERS) \
216		test_main.c test_main.h				\
217		Makefile					\
218		`echo $(LIB_OBJS) | sed "s/\.o/\.c/g"`
219	@echo
220	@echo minidist done, size follows:
221	@ls -l vex--minidist-2005MMDD.tar
222	@echo
223
224# This is very uggerly.  Need to sed out both "xyzzyN" and
225# "xyzzy$N" since gcc on different targets emits the constants
226# differently -- with a leading $ on x86/amd64 but none on ppc32/64.
227pub/libvex_guest_offsets.h:
228	rm -f auxprogs/genoffsets.s
229	$(CC) $(CCFLAGS) -O -S -o auxprogs/genoffsets.s \
230				auxprogs/genoffsets.c
231	grep xyzzy auxprogs/genoffsets.s | grep "^#define" \
232	   | sed "s/xyzzy\\$$//g" \
233	   | sed "s/xyzzy#//g" \
234	   | sed "s/xyzzy//g" \
235	   > pub/libvex_guest_offsets.h
236	rm -f auxprogs/genoffsets.s
237
238
239ALL_HEADERS  = $(PUB_HEADERS) $(PRIV_HEADERS)
240ALL_INCLUDES = $(PUB_INCLUDES) $(PRIV_INCLUDES)
241
242test_main.o: $(PUB_HEADERS) test_main.c test_main.h
243	$(CC) $(CCFLAGS) $(PUB_INCLUDES) -o test_main.o \
244					 -c test_main.c
245
246priv/ir_defs.o: $(ALL_HEADERS) priv/ir_defs.c
247	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_defs.o \
248					 -c priv/ir_defs.c
249
250priv/ir_inject.o: $(ALL_HEADERS) priv/ir_inject.c
251	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_inject.o \
252					 -c priv/ir_inject.c
253
254priv/ir_match.o: $(ALL_HEADERS) priv/ir_match.c
255	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_match.o \
256					 -c priv/ir_match.c
257
258priv/ir_opt.o: $(ALL_HEADERS) priv/ir_opt.c
259	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_opt.o \
260					 -c priv/ir_opt.c
261
262priv/main_main.o: $(ALL_HEADERS) priv/main_main.c
263	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_main.o \
264					 -c priv/main_main.c
265
266priv/main_globals.o: $(ALL_HEADERS) priv/main_globals.c
267	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_globals.o \
268					 -c priv/main_globals.c
269
270priv/main_util.o: $(ALL_HEADERS) priv/main_util.c
271	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_util.o \
272					 -c priv/main_util.c
273
274priv/host_x86_defs.o: $(ALL_HEADERS) priv/host_x86_defs.c
275	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_x86_defs.o \
276					 -c priv/host_x86_defs.c
277
278priv/host_amd64_defs.o: $(ALL_HEADERS) priv/host_amd64_defs.c
279	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_amd64_defs.o \
280					 -c priv/host_amd64_defs.c
281
282priv/host_arm_defs.o: $(ALL_HEADERS) priv/host_arm_defs.c
283	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm_defs.o \
284					 -c priv/host_arm_defs.c
285
286priv/host_arm64_defs.o: $(ALL_HEADERS) priv/host_arm64_defs.c
287	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm64_defs.o \
288					 -c priv/host_arm64_defs.c
289
290priv/host_ppc_defs.o: $(ALL_HEADERS) priv/host_ppc_defs.c
291	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_ppc_defs.o \
292					 -c priv/host_ppc_defs.c
293
294priv/host_s390_defs.o: $(ALL_HEADERS) priv/host_s390_defs.c
295	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_s390_defs.o \
296					 -c priv/host_s390_defs.c
297
298priv/host_mips_defs.o: $(ALL_HEADERS) priv/host_mips_defs.c
299	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_mips_defs.o \
300					 -c priv/host_mips_defs.c
301
302priv/host_x86_isel.o: $(ALL_HEADERS) priv/host_x86_isel.c
303	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_x86_isel.o \
304					 -c priv/host_x86_isel.c
305
306priv/host_amd64_isel.o: $(ALL_HEADERS) priv/host_amd64_isel.c
307	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_amd64_isel.o \
308					 -c priv/host_amd64_isel.c
309
310priv/host_arm_isel.o: $(ALL_HEADERS) priv/host_arm_isel.c
311	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm_isel.o \
312					 -c priv/host_arm_isel.c
313
314priv/host_arm64_isel.o: $(ALL_HEADERS) priv/host_arm64_isel.c
315	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm64_isel.o \
316					 -c priv/host_arm64_isel.c
317
318priv/host_ppc_isel.o: $(ALL_HEADERS) priv/host_ppc_isel.c
319	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_ppc_isel.o \
320					 -c priv/host_ppc_isel.c
321
322priv/host_s390_isel.o: $(ALL_HEADERS) priv/host_s390_isel.c
323	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_s390_isel.o \
324					 -c priv/host_s390_isel.c
325
326priv/host_mips_isel.o: $(ALL_HEADERS) priv/host_mips_isel.c
327	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_mips_isel.o \
328					 -c priv/host_mips_isel.c
329
330priv/host_generic_maddf.o: $(ALL_HEADERS) priv/host_generic_maddf.c
331	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_maddf.o \
332					 -c priv/host_generic_maddf.c
333
334priv/host_generic_regs.o: $(ALL_HEADERS) priv/host_generic_regs.c
335	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_regs.o \
336					 -c priv/host_generic_regs.c
337
338priv/host_generic_simd64.o: $(ALL_HEADERS) priv/host_generic_simd64.c
339	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd64.o \
340					 -c priv/host_generic_simd64.c
341
342priv/host_generic_simd128.o: $(ALL_HEADERS) priv/host_generic_simd128.c
343	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd128.o \
344					 -c priv/host_generic_simd128.c
345
346priv/host_generic_simd256.o: $(ALL_HEADERS) priv/host_generic_simd256.c
347	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd256.o \
348					 -c priv/host_generic_simd256.c
349
350priv/host_generic_reg_alloc2.o: $(ALL_HEADERS) priv/host_generic_reg_alloc2.c
351	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_reg_alloc2.o \
352					 -c priv/host_generic_reg_alloc2.c
353
354priv/guest_x86_toIR.o: $(ALL_HEADERS) priv/guest_x86_toIR.c
355	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_toIR.o \
356					 -c priv/guest_x86_toIR.c
357
358priv/guest_generic_x87.o: $(ALL_HEADERS) priv/guest_generic_x87.c
359	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_generic_x87.o \
360					 -c priv/guest_generic_x87.c
361
362priv/guest_generic_bb_to_IR.o: $(ALL_HEADERS) priv/guest_generic_bb_to_IR.c
363	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_generic_bb_to_IR.o \
364					 -c priv/guest_generic_bb_to_IR.c
365
366priv/guest_x86_helpers.o: $(ALL_HEADERS) priv/guest_x86_helpers.c
367	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_helpers.o \
368					 -c priv/guest_x86_helpers.c
369
370priv/guest_amd64_helpers.o: $(ALL_HEADERS) priv/guest_amd64_helpers.c
371	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_amd64_helpers.o \
372					 -c priv/guest_amd64_helpers.c
373
374priv/guest_amd64_toIR.o: $(ALL_HEADERS) priv/guest_amd64_toIR.c
375	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_amd64_toIR.o \
376					 -c priv/guest_amd64_toIR.c
377
378priv/guest_arm_helpers.o: $(ALL_HEADERS) priv/guest_arm_helpers.c
379	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm_helpers.o \
380					 -c priv/guest_arm_helpers.c
381
382priv/guest_arm64_helpers.o: $(ALL_HEADERS) priv/guest_arm64_helpers.c
383	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm64_helpers.o \
384					 -c priv/guest_arm64_helpers.c
385
386priv/guest_arm_toIR.o: $(ALL_HEADERS) priv/guest_arm_toIR.c
387	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm_toIR.o \
388					 -c priv/guest_arm_toIR.c
389
390priv/guest_arm64_toIR.o: $(ALL_HEADERS) priv/guest_arm64_toIR.c
391	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm64_toIR.o \
392					 -c priv/guest_arm64_toIR.c
393
394priv/guest_ppc_helpers.o: $(ALL_HEADERS) priv/guest_ppc_helpers.c
395	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_ppc_helpers.o \
396					 -c priv/guest_ppc_helpers.c
397
398priv/guest_s390_helpers.o: $(ALL_HEADERS) priv/guest_s390_helpers.c
399	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_s390_helpers.o \
400					 -c priv/guest_s390_helpers.c
401
402priv/guest_ppc_toIR.o: $(ALL_HEADERS) priv/guest_ppc_toIR.c
403	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_ppc_toIR.o \
404					 -c priv/guest_ppc_toIR.c
405
406priv/guest_s390_toIR.o: $(ALL_HEADERS) priv/guest_s390_toIR.c
407	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_s390_toIR.o \
408					 -c priv/guest_s390_toIR.c
409
410priv/s390_disasm.o: $(ALL_HEADERS) priv/s390_disasm.c
411	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/s390_disasm.o \
412					 -c priv/s390_disasm.c
413
414priv/guest_mips_helpers.o: $(ALL_HEADERS) priv/guest_mips_helpers.c
415	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_mips_helpers.o \
416					 -c priv/guest_mips_helpers.c
417
418priv/guest_mips_toIR.o: $(ALL_HEADERS) priv/guest_mips_toIR.c
419	$(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_mips_toIR.o \
420					 -c priv/guest_mips_toIR.c
421