Add a test program for the membarrier() system call
[valgrind.git] / VEX / Makefile-gcc
blob0822712debbfb436f69ef4de9831f7dec1483622
2 PUB_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
17 PRIV_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
42 LIB_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
87 PUB_INCLUDES = -Ipub
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).
92 PRIV_INCLUDES = -Ipriv
95 ifndef CC
96    CC = gcc 
97 endif 
98 ifndef AR
99    AR = ar 
100 endif
102 # Put -g -O2 after any flags we inherit from V.  -O2 vs -O
103 # makes a significant difference, at least with gcc4.
104 CCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow \
105                 -Wpointer-arith -Wbad-function-cast -Wcast-qual \
106                 -Wcast-align -Wmissing-declarations \
107                 -Wwrite-strings -Wformat -Wformat-security \
108                 $(EXTRA_CFLAGS) -g -O2 -fstrict-aliasing
110 #CC = icc
111 #CCFLAGS = -g -Wall -wd981 -wd279 -wd1287 -wd869 -wd111 -wd188 -wd186
112 # 981: operands are evaluated in unspecified order
113 # 279: controlling expression is constant
114 # 1287: invalid attribute for parameter
115 # 869: parameter "..." was never referenced
116 # 111: statement is unreachable
117 # 188: enumerated type mixed with another type
118 # (the above are for icc 8.0 -- 8.0.0.55 I think)
119 # 186: pointless comparison of unsigned integer with zero
121 # kludge: stops V biarch builds screwing up at -j 2 or above
122 # The Right fix is to autoconf/automake-ise vex.
123 .NOTPARALLEL:
125 all: vex
127 # Empty, needed for Valgrind
128 install:
130 scratch: clean all
132 vex: libvex.a
134 libvex.a: $(LIB_OBJS)
135         rm -f libvex.a
136         $(AR) crus libvex.a $(LIB_OBJS)
139 # The idea with these TAG-s is to mark the flavour of libvex.a 
140 # most recently built, so if the same target is re-requested, we
141 # don't rebuild everything, but if a different one is requested
142 # then we scrub everything and start over.
144 libvex-x86-linux.a: TAG-x86-linux libvex.a
145         mv -f libvex.a libvex-x86-linux.a
146 TAG-x86-linux:
147         if [ ! -f TAG-x86-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
148         touch TAG-x86-linux
150 libvex-amd64-linux.a: TAG-amd64-linux libvex.a
151         mv -f libvex.a libvex-amd64-linux.a
152 TAG-amd64-linux:
153         if [ ! -f TAG-amd64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
154         touch TAG-amd64-linux
156 libvex-ppc32-linux.a: TAG-ppc32-linux libvex.a
157         mv -f libvex.a libvex-ppc32-linux.a
158 TAG-ppc32-linux:
159         if [ ! -f TAG-ppc32-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
160         touch TAG-ppc32-linux
162 libvex-ppc64-linux.a: TAG-ppc64-linux libvex.a
163         mv -f libvex.a libvex-ppc64-linux.a
164 TAG-ppc64-linux:
165         if [ ! -f TAG-ppc64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
166         touch TAG-ppc64-linux
168 libvex-mips-linux.a: TAG-mips32-linux libvex.a
169         mv -f libvex.a libvex-mips32-linux.a
170 TAG-mips-linux:
171         if [ ! -f TAG-mips32-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
172         touch TAG-mips32-linux
174 libvex-ppc32-aix5.a: TAG-ppc32-aix5 libvex.a
175         mv -f libvex.a libvex-ppc32-aix5.a
176 TAG-ppc32-aix5:
177         if [ ! -f TAG-ppc32-aix5 ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
178         touch TAG-ppc32-aix5
180 libvex-ppc64-aix5.a: TAG-ppc64-aix5 libvex.a
181         mv -f libvex.a libvex-ppc64-aix5.a
182 TAG-ppc64-aix5:
183         if [ ! -f TAG-ppc64-aix5 ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
184         touch TAG-ppc64-aix5
186 libvex-x86-darwin.a: TAG-x86-darwin libvex.a
187         mv -f libvex.a libvex-x86-darwin.a
188 TAG-x86-darwin:
189         if [ ! -f TAG-x86-darwin ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
190         touch TAG-x86-darwin
192 libvex-amd64-darwin.a: TAG-amd64-darwin libvex.a
193         mv -f libvex.a libvex-amd64-darwin.a
194 TAG-amd64-darwin:
195         if [ ! -f TAG-amd64-darwin ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
196         touch TAG-amd64-darwin
198 libvex-arm64-linux.a: TAG-arm64-linux libvex.a
199         mv -f libvex.a libvex-arm64-linux.a
200 TAG-arm64-linux:
201         if [ ! -f TAG-arm64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi
202         touch TAG-arm64-linux
205 clean:
206         rm -f $(LIB_OBJS) *.a TAG-* \
207                 pub/libvex_guest_offsets.h \
208                 auxprogs/genoffsets.s
210 minidist:
211         rm -f vex--minidist-2005MMDD.tar
212         tar cf vex--minidist-2005MMDD.tar $(PUB_HEADERS) $(PRIV_HEADERS) \
213                 Makefile-gcc                                    \
214                 `echo $(LIB_OBJS) | sed "s/\.o/\.c/g"`
215         @echo 
216         @echo minidist done, size follows:
217         @ls -l vex--minidist-2005MMDD.tar
218         @echo
220 # This is very uggerly.  Need to sed out both "xyzzyN" and
221 # "xyzzy$N" since gcc on different targets emits the constants
222 # differently -- with a leading $ on x86/amd64 but none on ppc32/64.
223 # ICC also emits the constants differently with a leading # #define
224 pub/libvex_guest_offsets.h:
225         rm -f auxprogs/genoffsets.s
226         $(CC) $(CCFLAGS) -O -S -o auxprogs/genoffsets.s \
227                                 auxprogs/genoffsets.c
228         grep xyzzy auxprogs/genoffsets.s | grep "^[# ]*#define" \
229            | sed "s/# #define/#define/g" \
230            | sed "s/xyzzy\\$$//g" \
231            | sed "s/xyzzy#//g" \
232            | sed "s/xyzzy//g" \
233            > pub/libvex_guest_offsets.h
234         rm -f auxprogs/genoffsets.s
237 ALL_HEADERS  = $(PUB_HEADERS) $(PRIV_HEADERS)
238 ALL_INCLUDES = $(PUB_INCLUDES) $(PRIV_INCLUDES)
240 priv/ir_defs.o: $(ALL_HEADERS) priv/ir_defs.c
241         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_defs.o \
242                                          -c priv/ir_defs.c
244 priv/ir_inject.o: $(ALL_HEADERS) priv/ir_inject.c
245         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_inject.o \
246                                          -c priv/ir_inject.c
248 priv/ir_match.o: $(ALL_HEADERS) priv/ir_match.c
249         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_match.o \
250                                          -c priv/ir_match.c
252 priv/ir_opt.o: $(ALL_HEADERS) priv/ir_opt.c
253         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_opt.o \
254                                          -c priv/ir_opt.c
256 priv/main_main.o: $(ALL_HEADERS) priv/main_main.c
257         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_main.o \
258                                          -c priv/main_main.c
260 priv/main_globals.o: $(ALL_HEADERS) priv/main_globals.c
261         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_globals.o \
262                                          -c priv/main_globals.c
264 priv/main_util.o: $(ALL_HEADERS) priv/main_util.c
265         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_util.o \
266                                          -c priv/main_util.c
268 priv/host_x86_defs.o: $(ALL_HEADERS) priv/host_x86_defs.c
269         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_x86_defs.o \
270                                          -c priv/host_x86_defs.c
272 priv/host_amd64_defs.o: $(ALL_HEADERS) priv/host_amd64_defs.c
273         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_amd64_defs.o \
274                                          -c priv/host_amd64_defs.c
276 priv/host_arm_defs.o: $(ALL_HEADERS) priv/host_arm_defs.c
277         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm_defs.o \
278                                          -c priv/host_arm_defs.c
280 priv/host_arm64_defs.o: $(ALL_HEADERS) priv/host_arm64_defs.c
281         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm64_defs.o \
282                                          -c priv/host_arm64_defs.c
284 priv/host_ppc_defs.o: $(ALL_HEADERS) priv/host_ppc_defs.c
285         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_ppc_defs.o \
286                                          -c priv/host_ppc_defs.c
288 priv/host_s390_defs.o: $(ALL_HEADERS) priv/host_s390_defs.c
289         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_s390_defs.o \
290                                          -c priv/host_s390_defs.c
292 priv/host_mips_defs.o: $(ALL_HEADERS) priv/host_mips_defs.c
293         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_mips_defs.o \
294                                          -c priv/host_mips_defs.c
296 priv/host_x86_isel.o: $(ALL_HEADERS) priv/host_x86_isel.c
297         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_x86_isel.o \
298                                          -c priv/host_x86_isel.c
300 priv/host_amd64_isel.o: $(ALL_HEADERS) priv/host_amd64_isel.c
301         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_amd64_isel.o \
302                                          -c priv/host_amd64_isel.c
304 priv/host_arm_isel.o: $(ALL_HEADERS) priv/host_arm_isel.c
305         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm_isel.o \
306                                          -c priv/host_arm_isel.c
308 priv/host_arm64_isel.o: $(ALL_HEADERS) priv/host_arm64_isel.c
309         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm64_isel.o \
310                                          -c priv/host_arm64_isel.c
312 priv/host_ppc_isel.o: $(ALL_HEADERS) priv/host_ppc_isel.c
313         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_ppc_isel.o \
314                                          -c priv/host_ppc_isel.c
316 priv/host_s390_isel.o: $(ALL_HEADERS) priv/host_s390_isel.c
317         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_s390_isel.o \
318                                          -c priv/host_s390_isel.c
320 priv/host_mips_isel.o: $(ALL_HEADERS) priv/host_mips_isel.c
321         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_mips_isel.o \
322                                          -c priv/host_mips_isel.c
324 priv/host_generic_maddf.o: $(ALL_HEADERS) priv/host_generic_maddf.c
325         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_maddf.o \
326                                          -c priv/host_generic_maddf.c
328 priv/host_generic_regs.o: $(ALL_HEADERS) priv/host_generic_regs.c
329         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_regs.o \
330                                          -c priv/host_generic_regs.c
332 priv/host_generic_simd64.o: $(ALL_HEADERS) priv/host_generic_simd64.c
333         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd64.o \
334                                          -c priv/host_generic_simd64.c
336 priv/host_generic_simd128.o: $(ALL_HEADERS) priv/host_generic_simd128.c
337         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd128.o \
338                                          -c priv/host_generic_simd128.c
340 priv/host_generic_simd256.o: $(ALL_HEADERS) priv/host_generic_simd256.c
341         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd256.o \
342                                          -c priv/host_generic_simd256.c
344 priv/host_generic_reg_alloc2.o: $(ALL_HEADERS) priv/host_generic_reg_alloc2.c
345         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_reg_alloc2.o \
346                                          -c priv/host_generic_reg_alloc2.c
348 priv/guest_x86_toIR.o: $(ALL_HEADERS) priv/guest_x86_toIR.c
349         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_toIR.o \
350                                          -c priv/guest_x86_toIR.c
352 priv/guest_generic_x87.o: $(ALL_HEADERS) priv/guest_generic_x87.c
353         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_generic_x87.o \
354                                          -c priv/guest_generic_x87.c
356 priv/guest_generic_bb_to_IR.o: $(ALL_HEADERS) priv/guest_generic_bb_to_IR.c
357         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_generic_bb_to_IR.o \
358                                          -c priv/guest_generic_bb_to_IR.c
360 priv/guest_x86_helpers.o: $(ALL_HEADERS) priv/guest_x86_helpers.c
361         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_helpers.o \
362                                          -c priv/guest_x86_helpers.c
364 priv/guest_amd64_helpers.o: $(ALL_HEADERS) priv/guest_amd64_helpers.c
365         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_amd64_helpers.o \
366                                          -c priv/guest_amd64_helpers.c
368 priv/guest_amd64_toIR.o: $(ALL_HEADERS) priv/guest_amd64_toIR.c
369         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_amd64_toIR.o \
370                                          -c priv/guest_amd64_toIR.c
372 priv/guest_arm_helpers.o: $(ALL_HEADERS) priv/guest_arm_helpers.c
373         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm_helpers.o \
374                                          -c priv/guest_arm_helpers.c
376 priv/guest_arm64_helpers.o: $(ALL_HEADERS) priv/guest_arm64_helpers.c
377         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm64_helpers.o \
378                                          -c priv/guest_arm64_helpers.c
380 priv/guest_arm_toIR.o: $(ALL_HEADERS) priv/guest_arm_toIR.c
381         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm_toIR.o \
382                                          -c priv/guest_arm_toIR.c
384 priv/guest_arm64_toIR.o: $(ALL_HEADERS) priv/guest_arm64_toIR.c
385         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm64_toIR.o \
386                                          -c priv/guest_arm64_toIR.c
388 priv/guest_ppc_helpers.o: $(ALL_HEADERS) priv/guest_ppc_helpers.c
389         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_ppc_helpers.o \
390                                          -c priv/guest_ppc_helpers.c
392 priv/guest_s390_helpers.o: $(ALL_HEADERS) priv/guest_s390_helpers.c
393         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_s390_helpers.o \
394                                          -c priv/guest_s390_helpers.c
396 priv/guest_ppc_toIR.o: $(ALL_HEADERS) priv/guest_ppc_toIR.c
397         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_ppc_toIR.o \
398                                          -c priv/guest_ppc_toIR.c
400 priv/guest_s390_toIR.o: $(ALL_HEADERS) priv/guest_s390_toIR.c
401         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_s390_toIR.o \
402                                          -c priv/guest_s390_toIR.c
404 priv/s390_disasm.o: $(ALL_HEADERS) priv/s390_disasm.c
405         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/s390_disasm.o \
406                                          -c priv/s390_disasm.c
408 priv/guest_mips_helpers.o: $(ALL_HEADERS) priv/guest_mips_helpers.c
409         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_mips_helpers.o \
410                                          -c priv/guest_mips_helpers.c
412 priv/guest_mips_toIR.o: $(ALL_HEADERS) priv/guest_mips_toIR.c
413         $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_mips_toIR.o \
414                                          -c priv/guest_mips_toIR.c