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