1 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 16 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 41 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 86 87 PUB_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). 92 PRIV_INCLUDES = -Ipriv 93 94 95 ifndef CC 96 CC = gcc 97 endif 98 ifndef AR 99 AR = ar 100 endif 101 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 -std=gnu99 \ 109 $(EXTRA_CFLAGS) -g -O2 -fstrict-aliasing 110 111 #CC = icc 112 #CCFLAGS = -g -Wall -wd981 -wd279 -wd1287 -wd869 -wd111 -wd188 -wd186 113 # 981: operands are evaluated in unspecified order 114 # 279: controlling expression is constant 115 # 1287: invalid attribute for parameter 116 # 869: parameter "..." was never referenced 117 # 111: statement is unreachable 118 # 188: enumerated type mixed with another type 119 # (the above are for icc 8.0 -- 8.0.0.55 I think) 120 # 186: pointless comparison of unsigned integer with zero 121 122 # kludge: stops V biarch builds screwing up at -j 2 or above 123 # The Right fix is to autoconf/automake-ise vex. 124 .NOTPARALLEL: 125 126 all: vex 127 128 # Empty, needed for Valgrind 129 install: 130 131 scratch: clean all 132 133 vex: libvex.a 134 135 libvex.a: $(LIB_OBJS) 136 rm -f libvex.a 137 $(AR) crus libvex.a $(LIB_OBJS) 138 139 140 # The idea with these TAG-s is to mark the flavour of libvex.a 141 # most recently built, so if the same target is re-requested, we 142 # don't rebuild everything, but if a different one is requested 143 # then we scrub everything and start over. 144 145 libvex-x86-linux.a: TAG-x86-linux libvex.a 146 mv -f libvex.a libvex-x86-linux.a 147 TAG-x86-linux: 148 if [ ! -f TAG-x86-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 149 touch TAG-x86-linux 150 151 libvex-amd64-linux.a: TAG-amd64-linux libvex.a 152 mv -f libvex.a libvex-amd64-linux.a 153 TAG-amd64-linux: 154 if [ ! -f TAG-amd64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 155 touch TAG-amd64-linux 156 157 libvex-ppc32-linux.a: TAG-ppc32-linux libvex.a 158 mv -f libvex.a libvex-ppc32-linux.a 159 TAG-ppc32-linux: 160 if [ ! -f TAG-ppc32-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 161 touch TAG-ppc32-linux 162 163 libvex-ppc64-linux.a: TAG-ppc64-linux libvex.a 164 mv -f libvex.a libvex-ppc64-linux.a 165 TAG-ppc64-linux: 166 if [ ! -f TAG-ppc64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 167 touch TAG-ppc64-linux 168 169 libvex-mips-linux.a: TAG-mips32-linux libvex.a 170 mv -f libvex.a libvex-mips32-linux.a 171 TAG-mips-linux: 172 if [ ! -f TAG-mips32-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 173 touch TAG-mips32-linux 174 175 libvex-ppc32-aix5.a: TAG-ppc32-aix5 libvex.a 176 mv -f libvex.a libvex-ppc32-aix5.a 177 TAG-ppc32-aix5: 178 if [ ! -f TAG-ppc32-aix5 ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 179 touch TAG-ppc32-aix5 180 181 libvex-ppc64-aix5.a: TAG-ppc64-aix5 libvex.a 182 mv -f libvex.a libvex-ppc64-aix5.a 183 TAG-ppc64-aix5: 184 if [ ! -f TAG-ppc64-aix5 ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 185 touch TAG-ppc64-aix5 186 187 libvex-x86-darwin.a: TAG-x86-darwin libvex.a 188 mv -f libvex.a libvex-x86-darwin.a 189 TAG-x86-darwin: 190 if [ ! -f TAG-x86-darwin ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 191 touch TAG-x86-darwin 192 193 libvex-amd64-darwin.a: TAG-amd64-darwin libvex.a 194 mv -f libvex.a libvex-amd64-darwin.a 195 TAG-amd64-darwin: 196 if [ ! -f TAG-amd64-darwin ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 197 touch TAG-amd64-darwin 198 199 libvex-arm64-linux.a: TAG-arm64-linux libvex.a 200 mv -f libvex.a libvex-arm64-linux.a 201 TAG-arm64-linux: 202 if [ ! -f TAG-arm64-linux ] ; then rm -f $(LIB_OBJS) TAG-* libvex.a ; fi 203 touch TAG-arm64-linux 204 205 206 clean: 207 rm -f $(LIB_OBJS) *.a TAG-* \ 208 pub/libvex_guest_offsets.h \ 209 auxprogs/genoffsets.s 210 211 minidist: 212 rm -f vex--minidist-2005MMDD.tar 213 tar cf vex--minidist-2005MMDD.tar $(PUB_HEADERS) $(PRIV_HEADERS) \ 214 Makefile-gcc \ 215 `echo $(LIB_OBJS) | sed "s/\.o/\.c/g"` 216 @echo 217 @echo minidist done, size follows: 218 @ls -l vex--minidist-2005MMDD.tar 219 @echo 220 221 # This is very uggerly. Need to sed out both "xyzzyN" and 222 # "xyzzy$N" since gcc on different targets emits the constants 223 # differently -- with a leading $ on x86/amd64 but none on ppc32/64. 224 # ICC also emits the constants differently with a leading # #define 225 pub/libvex_guest_offsets.h: 226 rm -f auxprogs/genoffsets.s 227 $(CC) $(CCFLAGS) -O -S -o auxprogs/genoffsets.s \ 228 auxprogs/genoffsets.c 229 grep xyzzy auxprogs/genoffsets.s | grep "^[# ]*#define" \ 230 | sed "s/# #define/#define/g" \ 231 | sed "s/xyzzy\\$$//g" \ 232 | sed "s/xyzzy#//g" \ 233 | sed "s/xyzzy//g" \ 234 > pub/libvex_guest_offsets.h 235 rm -f auxprogs/genoffsets.s 236 237 238 ALL_HEADERS = $(PUB_HEADERS) $(PRIV_HEADERS) 239 ALL_INCLUDES = $(PUB_INCLUDES) $(PRIV_INCLUDES) 240 241 priv/ir_defs.o: $(ALL_HEADERS) priv/ir_defs.c 242 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_defs.o \ 243 -c priv/ir_defs.c 244 245 priv/ir_inject.o: $(ALL_HEADERS) priv/ir_inject.c 246 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_inject.o \ 247 -c priv/ir_inject.c 248 249 priv/ir_match.o: $(ALL_HEADERS) priv/ir_match.c 250 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_match.o \ 251 -c priv/ir_match.c 252 253 priv/ir_opt.o: $(ALL_HEADERS) priv/ir_opt.c 254 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/ir_opt.o \ 255 -c priv/ir_opt.c 256 257 priv/main_main.o: $(ALL_HEADERS) priv/main_main.c 258 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_main.o \ 259 -c priv/main_main.c 260 261 priv/main_globals.o: $(ALL_HEADERS) priv/main_globals.c 262 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_globals.o \ 263 -c priv/main_globals.c 264 265 priv/main_util.o: $(ALL_HEADERS) priv/main_util.c 266 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/main_util.o \ 267 -c priv/main_util.c 268 269 priv/host_x86_defs.o: $(ALL_HEADERS) priv/host_x86_defs.c 270 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_x86_defs.o \ 271 -c priv/host_x86_defs.c 272 273 priv/host_amd64_defs.o: $(ALL_HEADERS) priv/host_amd64_defs.c 274 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_amd64_defs.o \ 275 -c priv/host_amd64_defs.c 276 277 priv/host_arm_defs.o: $(ALL_HEADERS) priv/host_arm_defs.c 278 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm_defs.o \ 279 -c priv/host_arm_defs.c 280 281 priv/host_arm64_defs.o: $(ALL_HEADERS) priv/host_arm64_defs.c 282 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm64_defs.o \ 283 -c priv/host_arm64_defs.c 284 285 priv/host_ppc_defs.o: $(ALL_HEADERS) priv/host_ppc_defs.c 286 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_ppc_defs.o \ 287 -c priv/host_ppc_defs.c 288 289 priv/host_s390_defs.o: $(ALL_HEADERS) priv/host_s390_defs.c 290 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_s390_defs.o \ 291 -c priv/host_s390_defs.c 292 293 priv/host_mips_defs.o: $(ALL_HEADERS) priv/host_mips_defs.c 294 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_mips_defs.o \ 295 -c priv/host_mips_defs.c 296 297 priv/host_x86_isel.o: $(ALL_HEADERS) priv/host_x86_isel.c 298 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_x86_isel.o \ 299 -c priv/host_x86_isel.c 300 301 priv/host_amd64_isel.o: $(ALL_HEADERS) priv/host_amd64_isel.c 302 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_amd64_isel.o \ 303 -c priv/host_amd64_isel.c 304 305 priv/host_arm_isel.o: $(ALL_HEADERS) priv/host_arm_isel.c 306 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm_isel.o \ 307 -c priv/host_arm_isel.c 308 309 priv/host_arm64_isel.o: $(ALL_HEADERS) priv/host_arm64_isel.c 310 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_arm64_isel.o \ 311 -c priv/host_arm64_isel.c 312 313 priv/host_ppc_isel.o: $(ALL_HEADERS) priv/host_ppc_isel.c 314 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_ppc_isel.o \ 315 -c priv/host_ppc_isel.c 316 317 priv/host_s390_isel.o: $(ALL_HEADERS) priv/host_s390_isel.c 318 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_s390_isel.o \ 319 -c priv/host_s390_isel.c 320 321 priv/host_mips_isel.o: $(ALL_HEADERS) priv/host_mips_isel.c 322 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_mips_isel.o \ 323 -c priv/host_mips_isel.c 324 325 priv/host_generic_maddf.o: $(ALL_HEADERS) priv/host_generic_maddf.c 326 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_maddf.o \ 327 -c priv/host_generic_maddf.c 328 329 priv/host_generic_regs.o: $(ALL_HEADERS) priv/host_generic_regs.c 330 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_regs.o \ 331 -c priv/host_generic_regs.c 332 333 priv/host_generic_simd64.o: $(ALL_HEADERS) priv/host_generic_simd64.c 334 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd64.o \ 335 -c priv/host_generic_simd64.c 336 337 priv/host_generic_simd128.o: $(ALL_HEADERS) priv/host_generic_simd128.c 338 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd128.o \ 339 -c priv/host_generic_simd128.c 340 341 priv/host_generic_simd256.o: $(ALL_HEADERS) priv/host_generic_simd256.c 342 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_simd256.o \ 343 -c priv/host_generic_simd256.c 344 345 priv/host_generic_reg_alloc2.o: $(ALL_HEADERS) priv/host_generic_reg_alloc2.c 346 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/host_generic_reg_alloc2.o \ 347 -c priv/host_generic_reg_alloc2.c 348 349 priv/guest_x86_toIR.o: $(ALL_HEADERS) priv/guest_x86_toIR.c 350 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_toIR.o \ 351 -c priv/guest_x86_toIR.c 352 353 priv/guest_generic_x87.o: $(ALL_HEADERS) priv/guest_generic_x87.c 354 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_generic_x87.o \ 355 -c priv/guest_generic_x87.c 356 357 priv/guest_generic_bb_to_IR.o: $(ALL_HEADERS) priv/guest_generic_bb_to_IR.c 358 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_generic_bb_to_IR.o \ 359 -c priv/guest_generic_bb_to_IR.c 360 361 priv/guest_x86_helpers.o: $(ALL_HEADERS) priv/guest_x86_helpers.c 362 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_x86_helpers.o \ 363 -c priv/guest_x86_helpers.c 364 365 priv/guest_amd64_helpers.o: $(ALL_HEADERS) priv/guest_amd64_helpers.c 366 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_amd64_helpers.o \ 367 -c priv/guest_amd64_helpers.c 368 369 priv/guest_amd64_toIR.o: $(ALL_HEADERS) priv/guest_amd64_toIR.c 370 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_amd64_toIR.o \ 371 -c priv/guest_amd64_toIR.c 372 373 priv/guest_arm_helpers.o: $(ALL_HEADERS) priv/guest_arm_helpers.c 374 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm_helpers.o \ 375 -c priv/guest_arm_helpers.c 376 377 priv/guest_arm64_helpers.o: $(ALL_HEADERS) priv/guest_arm64_helpers.c 378 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm64_helpers.o \ 379 -c priv/guest_arm64_helpers.c 380 381 priv/guest_arm_toIR.o: $(ALL_HEADERS) priv/guest_arm_toIR.c 382 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm_toIR.o \ 383 -c priv/guest_arm_toIR.c 384 385 priv/guest_arm64_toIR.o: $(ALL_HEADERS) priv/guest_arm64_toIR.c 386 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_arm64_toIR.o \ 387 -c priv/guest_arm64_toIR.c 388 389 priv/guest_ppc_helpers.o: $(ALL_HEADERS) priv/guest_ppc_helpers.c 390 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_ppc_helpers.o \ 391 -c priv/guest_ppc_helpers.c 392 393 priv/guest_s390_helpers.o: $(ALL_HEADERS) priv/guest_s390_helpers.c 394 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_s390_helpers.o \ 395 -c priv/guest_s390_helpers.c 396 397 priv/guest_ppc_toIR.o: $(ALL_HEADERS) priv/guest_ppc_toIR.c 398 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_ppc_toIR.o \ 399 -c priv/guest_ppc_toIR.c 400 401 priv/guest_s390_toIR.o: $(ALL_HEADERS) priv/guest_s390_toIR.c 402 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_s390_toIR.o \ 403 -c priv/guest_s390_toIR.c 404 405 priv/s390_disasm.o: $(ALL_HEADERS) priv/s390_disasm.c 406 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/s390_disasm.o \ 407 -c priv/s390_disasm.c 408 409 priv/guest_mips_helpers.o: $(ALL_HEADERS) priv/guest_mips_helpers.c 410 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_mips_helpers.o \ 411 -c priv/guest_mips_helpers.c 412 413 priv/guest_mips_toIR.o: $(ALL_HEADERS) priv/guest_mips_toIR.c 414 $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest_mips_toIR.o \ 415 -c priv/guest_mips_toIR.c 416