Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 1 | # Capstone Disassembler Engine |
Nguyen Anh Quynh | 5311ef2 | 2015-06-03 22:21:13 +0800 | [diff] [blame] | 2 | # By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 3 | |
| 4 | LIB = capstone |
| 5 | FLAGS = '-Wall -Wextra -Wwrite-strings' |
| 6 | |
Wolfgang Schwotzer | 22b4d0e | 2017-10-21 15:44:36 +0200 | [diff] [blame^] | 7 | all: arm_const.cmxa arm64_const.cmxa m680x_const.cmxa mips_const.cmxa ppc_const.cmxa sparc_const.cmxa sysz_const.cmxa x86_const.cmxa xcore_const.cmxa arm.cmxa arm64.cmxa m680x.cmxa mips.cmxa ppc.cmxa x86.cmxa sparc.cmxa systemz.cmxa xcore.cmxa capstone.cmxa test_basic.cmx test_detail.cmx test_x86.cmx test_arm.cmx test_arm64.cmx test_mips.cmx test_ppc.cmx test_sparc.cmx test_systemz.cmx test_xcore.cmx test_m680x.cmx ocaml.o |
Nguyen Anh Quynh | 5311ef2 | 2015-06-03 22:21:13 +0800 | [diff] [blame] | 8 | ocamlopt -o test_basic -ccopt $(FLAGS) ocaml.o capstone.cmx test_basic.cmx -cclib -l$(LIB) |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 9 | ocamlopt -o test_detail -ccopt $(FLAGS) capstone.cmx ocaml.o test_detail.cmx -cclib -l$(LIB) |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 10 | ocamlopt -o test_x86 -ccopt $(FLAGS) capstone.cmx ocaml.o x86.cmx x86_const.cmx test_x86.cmx -cclib -l$(LIB) |
| 11 | ocamlopt -o test_arm -ccopt $(FLAGS) capstone.cmx ocaml.o arm.cmx arm_const.cmx test_arm.cmx -cclib -l$(LIB) |
| 12 | ocamlopt -o test_arm64 -ccopt $(FLAGS) capstone.cmx ocaml.o arm64.cmx arm64_const.cmx test_arm64.cmx -cclib -l$(LIB) |
| 13 | ocamlopt -o test_mips -ccopt $(FLAGS) capstone.cmx ocaml.o mips.cmx mips_const.cmx test_mips.cmx -cclib -l$(LIB) |
| 14 | ocamlopt -o test_ppc -ccopt $(FLAGS) capstone.cmx ocaml.o ppc.cmx ppc_const.cmx test_ppc.cmx -cclib -l$(LIB) |
| 15 | ocamlopt -o test_sparc -ccopt $(FLAGS) capstone.cmx ocaml.o sparc.cmx sparc_const.cmx test_sparc.cmx -cclib -l$(LIB) |
| 16 | ocamlopt -o test_systemz -ccopt $(FLAGS) capstone.cmx ocaml.o systemz.cmx sysz_const.cmx test_systemz.cmx -cclib -l$(LIB) |
| 17 | ocamlopt -o test_xcore -ccopt $(FLAGS) capstone.cmx ocaml.o xcore.cmx xcore_const.cmx test_xcore.cmx -cclib -l$(LIB) |
Wolfgang Schwotzer | 22b4d0e | 2017-10-21 15:44:36 +0200 | [diff] [blame^] | 18 | ocamlopt -o test_m680x -ccopt $(FLAGS) capstone.cmx ocaml.o m680x.cmx m680x_const.cmx test_m680x.cmx -cclib -l$(LIB) |
Guillaume Jeanne | ae48c97 | 2014-08-19 14:46:06 +0200 | [diff] [blame] | 19 | |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 20 | |
Nguyen Anh Quynh | 5311ef2 | 2015-06-03 22:21:13 +0800 | [diff] [blame] | 21 | test_basic.cmx: test_basic.ml |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 22 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 23 | |
| 24 | test_detail.cmx: test_detail.ml |
| 25 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 26 | |
| 27 | test_x86.cmx: test_x86.ml |
| 28 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 29 | |
| 30 | test_arm.cmx: test_arm.ml |
| 31 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 32 | |
| 33 | test_arm64.cmx: test_arm64.ml |
| 34 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 35 | |
| 36 | test_mips.cmx: test_mips.ml |
| 37 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 38 | |
Guillaume Jeanne | da1c2d0 | 2014-06-30 15:59:21 +0200 | [diff] [blame] | 39 | test_ppc.cmx: test_ppc.ml |
| 40 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 41 | |
Guillaume Jeanne | ae48c97 | 2014-08-19 14:46:06 +0200 | [diff] [blame] | 42 | test_sparc.cmx: test_sparc.ml |
| 43 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 44 | |
| 45 | test_systemz.cmx: test_systemz.ml |
| 46 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 47 | |
| 48 | test_xcore.cmx: test_xcore.ml |
| 49 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 50 | |
Wolfgang Schwotzer | 22b4d0e | 2017-10-21 15:44:36 +0200 | [diff] [blame^] | 51 | test_m680x.cmx: test_m680x.ml |
| 52 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 53 | |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 54 | ocaml.o: ocaml.c |
| 55 | ocamlc -ccopt $(FLAGS) -c $< |
| 56 | |
| 57 | capstone.mli: capstone.ml |
| 58 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 59 | |
| 60 | capstone.cmi: capstone.mli |
| 61 | ocamlc -ccopt $(FLAGS) -c $< |
| 62 | |
| 63 | capstone.cmx: capstone.ml capstone.cmi |
| 64 | ocamlopt -ccopt $(FLAGS) -c $< -cclib -l$(LIB) |
| 65 | |
| 66 | capstone.cmxa: capstone.cmx |
| 67 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< -cclib -lsb_ocaml -cclib -l$(LIB) |
| 68 | |
| 69 | x86.mli: x86.ml |
| 70 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 71 | |
| 72 | x86.cmi: x86.mli |
| 73 | ocamlc -ccopt $(FLAGS) -c $< |
| 74 | |
| 75 | x86.cmx: x86.ml x86.cmi |
| 76 | ocamlopt -ccopt $(FLAGS) -c $< |
| 77 | |
| 78 | x86.cmxa: x86.cmx |
| 79 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 80 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 81 | x86_const.mli: x86_const.ml |
| 82 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 83 | |
| 84 | x86_const.cmi: x86_const.mli |
| 85 | ocamlc -ccopt $(FLAGS) -c $< |
| 86 | |
| 87 | x86_const.cmx: x86_const.ml x86_const.cmi |
| 88 | ocamlopt -ccopt $(FLAGS) -c $< |
| 89 | |
| 90 | x86_const.cmxa: x86_const.cmx |
| 91 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 92 | |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 93 | arm.mli: arm.ml |
| 94 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 95 | |
| 96 | arm.cmi: arm.mli |
| 97 | ocamlc -ccopt $(FLAGS) -c $< |
| 98 | |
| 99 | arm.cmx: arm.ml arm.cmi |
| 100 | ocamlopt -ccopt $(FLAGS) -c $< |
| 101 | |
| 102 | arm.cmxa: arm.cmx |
| 103 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 104 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 105 | arm_const.mli: arm_const.ml |
| 106 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 107 | |
| 108 | arm_const.cmi: arm_const.mli |
| 109 | ocamlc -ccopt $(FLAGS) -c $< |
| 110 | |
| 111 | arm_const.cmx: arm_const.ml arm_const.cmi |
| 112 | ocamlopt -ccopt $(FLAGS) -c $< |
| 113 | |
| 114 | arm_const.cmxa: arm_const.cmx |
| 115 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 116 | |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 117 | arm64.mli: arm64.ml |
| 118 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 119 | |
| 120 | arm64.cmi: arm64.mli |
| 121 | ocamlc -ccopt $(FLAGS) -c $< |
| 122 | |
| 123 | arm64.cmx: arm64.ml arm64.cmi |
| 124 | ocamlopt -ccopt $(FLAGS) -c $< |
| 125 | |
| 126 | arm64.cmxa: arm64.cmx |
| 127 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 128 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 129 | arm64_const.mli: arm64_const.ml |
| 130 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 131 | |
| 132 | arm64_const.cmi: arm64_const.mli |
| 133 | ocamlc -ccopt $(FLAGS) -c $< |
| 134 | |
| 135 | arm64_const.cmx: arm64_const.ml arm64_const.cmi |
| 136 | ocamlopt -ccopt $(FLAGS) -c $< |
| 137 | |
| 138 | arm64_const.cmxa: arm64_const.cmx |
| 139 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 140 | |
Wolfgang Schwotzer | 22b4d0e | 2017-10-21 15:44:36 +0200 | [diff] [blame^] | 141 | m680x.mli: m680x.ml |
| 142 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 143 | |
| 144 | m680x.cmi: m680x.mli |
| 145 | ocamlc -ccopt $(FLAGS) -c $< |
| 146 | |
| 147 | m680x.cmx: m680x.ml m680x.cmi |
| 148 | ocamlopt -ccopt $(FLAGS) -c $< |
| 149 | |
| 150 | m680x.cmxa: m680x.cmx |
| 151 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 152 | |
| 153 | m680x_const.mli: m680x_const.ml |
| 154 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 155 | |
| 156 | m680x_const.cmi: m680x_const.mli |
| 157 | ocamlc -ccopt $(FLAGS) -c $< |
| 158 | |
| 159 | m680x_const.cmx: m680x_const.ml m680x_const.cmi |
| 160 | ocamlopt -ccopt $(FLAGS) -c $< |
| 161 | |
| 162 | m680x_const.cmxa: m680x_const.cmx |
| 163 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 164 | |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 165 | mips.mli: mips.ml |
| 166 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 167 | |
| 168 | mips.cmi: mips.mli |
| 169 | ocamlc -ccopt $(FLAGS) -c $< |
| 170 | |
| 171 | mips.cmx: mips.ml mips.cmi |
| 172 | ocamlopt -ccopt $(FLAGS) -c $< |
| 173 | |
| 174 | mips.cmxa: mips.cmx |
| 175 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 176 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 177 | mips_const.mli: mips_const.ml |
| 178 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 179 | |
| 180 | mips_const.cmi: mips_const.mli |
| 181 | ocamlc -ccopt $(FLAGS) -c $< |
| 182 | |
| 183 | mips_const.cmx: mips_const.ml mips_const.cmi |
| 184 | ocamlopt -ccopt $(FLAGS) -c $< |
| 185 | |
| 186 | mips_const.cmxa: mips_const.cmx |
| 187 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 188 | |
Guillaume Jeanne | da1c2d0 | 2014-06-30 15:59:21 +0200 | [diff] [blame] | 189 | ppc.mli: ppc.ml |
| 190 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 191 | |
| 192 | ppc.cmi: ppc.mli |
| 193 | ocamlc -ccopt $(FLAGS) -c $< |
| 194 | |
| 195 | ppc.cmx: ppc.ml ppc.cmi |
| 196 | ocamlopt -ccopt $(FLAGS) -c $< |
| 197 | |
| 198 | ppc.cmxa: ppc.cmx |
| 199 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 200 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 201 | ppc_const.mli: ppc_const.ml |
| 202 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 203 | |
| 204 | ppc_const.cmi: ppc_const.mli |
| 205 | ocamlc -ccopt $(FLAGS) -c $< |
| 206 | |
| 207 | ppc_const.cmx: ppc_const.ml ppc_const.cmi |
| 208 | ocamlopt -ccopt $(FLAGS) -c $< |
| 209 | |
| 210 | ppc_const.cmxa: ppc_const.cmx |
| 211 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 212 | |
Guillaume Jeanne | ae48c97 | 2014-08-19 14:46:06 +0200 | [diff] [blame] | 213 | sparc.mli: sparc.ml |
| 214 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 215 | |
| 216 | sparc.cmi: sparc.mli |
| 217 | ocamlc -ccopt $(FLAGS) -c $< |
| 218 | |
| 219 | sparc.cmx: sparc.ml sparc.cmi |
| 220 | ocamlopt -ccopt $(FLAGS) -c $< |
| 221 | |
| 222 | sparc.cmxa: sparc.cmx |
| 223 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 224 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 225 | sparc_const.mli: sparc_const.ml |
| 226 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 227 | |
| 228 | sparc_const.cmi: sparc_const.mli |
| 229 | ocamlc -ccopt $(FLAGS) -c $< |
| 230 | |
| 231 | sparc_const.cmx: sparc_const.ml sparc_const.cmi |
| 232 | ocamlopt -ccopt $(FLAGS) -c $< |
| 233 | |
| 234 | sparc_const.cmxa: sparc_const.cmx |
| 235 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 236 | |
Guillaume Jeanne | ae48c97 | 2014-08-19 14:46:06 +0200 | [diff] [blame] | 237 | systemz.mli: systemz.ml |
| 238 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 239 | |
| 240 | systemz.cmi: systemz.mli |
| 241 | ocamlc -ccopt $(FLAGS) -c $< |
| 242 | |
| 243 | systemz.cmx: systemz.ml systemz.cmi |
| 244 | ocamlopt -ccopt $(FLAGS) -c $< |
| 245 | |
| 246 | systemz.cmxa: systemz.cmx |
| 247 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 248 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 249 | sysz_const.mli: sysz_const.ml |
| 250 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 251 | |
| 252 | sysz_const.cmi: sysz_const.mli |
| 253 | ocamlc -ccopt $(FLAGS) -c $< |
| 254 | |
| 255 | sysz_const.cmx: sysz_const.ml sysz_const.cmi |
| 256 | ocamlopt -ccopt $(FLAGS) -c $< |
| 257 | |
| 258 | sysz_const.cmxa: sysz_const.cmx |
| 259 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 260 | |
Guillaume Jeanne | ae48c97 | 2014-08-19 14:46:06 +0200 | [diff] [blame] | 261 | xcore.mli: xcore.ml |
| 262 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 263 | |
| 264 | xcore.cmi: xcore.mli |
| 265 | ocamlc -ccopt $(FLAGS) -c $< |
| 266 | |
| 267 | xcore.cmx: xcore.ml xcore.cmi |
| 268 | ocamlopt -ccopt $(FLAGS) -c $< |
| 269 | |
| 270 | xcore.cmxa: xcore.cmx |
| 271 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 272 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 273 | xcore_const.mli: xcore_const.ml |
| 274 | ocamlc -ccopt $(FLAGS) -i $< > $@ |
| 275 | |
| 276 | xcore_const.cmi: xcore_const.mli |
| 277 | ocamlc -ccopt $(FLAGS) -c $< |
| 278 | |
| 279 | xcore_const.cmx: xcore_const.ml xcore_const.cmi |
| 280 | ocamlopt -ccopt $(FLAGS) -c $< |
| 281 | |
| 282 | xcore_const.cmxa: xcore_const.cmx |
| 283 | ocamlopt -ccopt $(FLAGS) -a -o $@ $< |
| 284 | |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 285 | clean: |
Wolfgang Schwotzer | 22b4d0e | 2017-10-21 15:44:36 +0200 | [diff] [blame^] | 286 | rm -f *.[oa] *.so *.cm[ixoa] *.cmxa *.mli test_basic test_detail test_x86 test_arm test_arm64 test_mips test_ppc test_sparc test_systemz test_xcore test_m680x |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 287 | |
Nguyen Anh Quynh | 586be76 | 2014-09-21 23:23:38 +0800 | [diff] [blame] | 288 | gen_const: |
| 289 | cd .. && python const_generator.py ocaml |
| 290 | |
Wolfgang Schwotzer | 22b4d0e | 2017-10-21 15:44:36 +0200 | [diff] [blame^] | 291 | TESTS = test_basic test_detail test_arm test_arm64 test_m680x test_mips test_ppc |
Nguyen Anh Quynh | 984d450 | 2014-10-01 16:42:29 +0800 | [diff] [blame] | 292 | TESTS += test_sparc test_systemz test_x86 test_xcore |
| 293 | check: |
| 294 | @for t in $(TESTS); do \ |
| 295 | echo Check $$t ... ; \ |
| 296 | ./$$t > /dev/null && echo OK || echo FAILED; \ |
| 297 | done |
| 298 | |