| OLD | NEW |
| (Empty) |
| 1 # | |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 # A simple GNU Makefile for enuminsts exhaustive instruction enumeration test. | |
| 7 # To build the 64bit test use: | |
| 8 # shell> make BITS=64 # the default | |
| 9 # To build the 32bit test use: | |
| 10 # shell> make BITS=32 | |
| 11 # note: run "make clean" between 32bit and 64bit builds. | |
| 12 | |
| 13 # Defines which version (64 vs 32 bit) you are generating. | |
| 14 BITS=64 | |
| 15 | |
| 16 # XED - Defines whether the xed decoder should be built into the | |
| 17 # executable. NOTE: If this is defined as XED=1, you must have the | |
| 18 # corresponding PIN tarfile in the same directory, so that it can | |
| 19 # untar it and add the corresponding library routines. | |
| 20 | |
| 21 # NACLV - If defined, the nacl revision number the executable was built using. | |
| 22 | |
| 23 # RAGEL - test the ragel decoder | |
| 24 | |
| 25 # Defines the pin version to use. Can be overridden on the command line, | |
| 26 # so that other versions can be used. | |
| 27 PINV=2.10-45467 | |
| 28 | |
| 29 PINBASE=pin-$(PINV)-gcc.3.4.6-ia32_intel64-linux | |
| 30 PINGZ=./$(PINBASE).tar.gz | |
| 31 PINDIR=./$(PINBASE) | |
| 32 XEDKIT=$(PINBASE)/extras/$(if $(filter 32,$(BITS)),xed2-ia32,xed2-intel64) | |
| 33 | |
| 34 NACLDIR=../../../../../.. | |
| 35 NACLSCONS =$(NACLDIR)/scons-out/opt-linux-x86-$(BITS) | |
| 36 NACLSCONS32 =$(NACLDIR)/scons-out/opt-linux-x86-32 | |
| 37 | |
| 38 # Define library that must be inserted into NACLLIBS (below) if compiling for 32
-bits. | |
| 39 ifeq ($(BITS),32) | |
| 40 LIB32INSERT=$(NACLSCONS32)/lib/libncdis_seg_sfi_verbose_x86_32.a | |
| 41 else | |
| 42 LIB32INSERT= | |
| 43 endif | |
| 44 | |
| 45 # NOTE: we need to include some print routines from x86-32 that | |
| 46 # are not in x86-64. | |
| 47 NACLLIBS=\ | |
| 48 $(NACLSCONS)/lib/libncdis_util_x86_$(BITS).a \ | |
| 49 $(NACLSCONS)/lib/libncvalidate_x86_$(BITS).a \ | |
| 50 $(NACLSCONS)/lib/libdfa_decode_x86_32.a \ | |
| 51 $(NACLSCONS)/lib/libdfa_decode_x86_64.a \ | |
| 52 $(NACLSCONS)/lib/libdfa_validate_x86_32.a \ | |
| 53 $(NACLSCONS)/lib/libdfa_validate_x86_64.a \ | |
| 54 $(LIB32INSERT) \ | |
| 55 $(NACLSCONS)/lib/libncval_reg_sfi_x86_$(BITS).a \ | |
| 56 $(NACLSCONS)/lib/libnc_decoder_x86_$(BITS).a \ | |
| 57 $(NACLSCONS)/lib/libnc_opcode_modeling_verbose_x86_$(BITS).a \ | |
| 58 $(NACLSCONS)/lib/libnc_opcode_modeling_x86_$(BITS).a \ | |
| 59 $(NACLSCONS)/lib/libncdis_decode_tables_x86_$(BITS).a \ | |
| 60 $(NACLSCONS)/lib/libncval_seg_sfi_x86_$(BITS).a \ | |
| 61 $(NACLSCONS)/lib/libncdis_seg_sfi_x86_$(BITS).a \ | |
| 62 $(NACLSCONS)/lib/libncval_base_verbose_x86_$(BITS).a \ | |
| 63 $(NACLSCONS)/lib/libncval_base_x86_$(BITS).a \ | |
| 64 $(NACLSCONS)/lib/libplatform.a \ | |
| 65 $(NACLSCONS)/lib/libgio.a \ | |
| 66 $(NACLSCONS)/lib/libutils.a -lpthread | |
| 67 | |
| 68 | |
| 69 NACLINCLUDE=-I$(NACLDIR)/.. | |
| 70 NACLDEFS=-DNACL_TARGET_SUBARCH=$(BITS) -DNACL_BUILD_SUBARCH=$(BITS) \ | |
| 71 -DNACL_TARGET_ARCH=x86 \ | |
| 72 -DNACL_LINUX -DNACL_TRUSTED_BUT_NOT_TCB -DNACL_PINV='"$(PINV)"' | |
| 73 | |
| 74 # Define XED specific command line arguments when including NaCl xed decoder: | |
| 75 # XEDLIB - libraries containing implementation of xed. | |
| 76 # XEDINCLUDE - Include directives for xed implementation. | |
| 77 # XEDDECODER - Object module implementing NaCl xed decoder. | |
| 78 # XEDDEFS - Defines to add when including NaCl xed decoder. | |
| 79 # XEDSUFFIX - Suffix to add to executable to state xed is included. | |
| 80 ifdef XED | |
| 81 XEDLIB=$(XEDKIT)/lib/libxed.a | |
| 82 XEDINCLUDE=-I$(XEDKIT)/include | |
| 83 XEDDECODER=xed_tester$(SUFFIX).o | |
| 84 XEDDEFS=-DNACL_XED_DECODER | |
| 85 XEDSUFFIX=-xed | |
| 86 else | |
| 87 XEDLIB= | |
| 88 XEDINCLUDE= | |
| 89 XEDDECODER= | |
| 90 XEDDEFS= | |
| 91 XEDSUFFIX= | |
| 92 endif | |
| 93 | |
| 94 # Define NACLV specific changes when NACLV is defined. | |
| 95 ifdef NACLV | |
| 96 NACLVDEFS=-DNACL_REVISION=$(NACLV) | |
| 97 NACLVSUFFIX=-$(NACLV) | |
| 98 else | |
| 99 NACLVDEFS= | |
| 100 NACLVSUFFIX= | |
| 101 endif | |
| 102 | |
| 103 ifdef RAGEL | |
| 104 RAGELDECODER=ragel_tester$(SUFFIX).o | |
| 105 RAGELDEFS=-DNACL_RAGEL_DECODER | |
| 106 else | |
| 107 RAGELDECODER= | |
| 108 RAGELDEFS= | |
| 109 endif | |
| 110 | |
| 111 SUFFIX=-$(BITS)$(XEDSUFFIX)$(NACLVSUFFIX) | |
| 112 OPTDBG=-g -O1 | |
| 113 CC=gcc -m$(BITS) | |
| 114 CXX=g++ -m$(BITS) | |
| 115 CCARGS = -c $(NACLDEFS) $(NACLVDEFS) $(XEDDEFS) $(XEDINCLUDE) $(NACLINCLUDE) $(R
AGELDEFS) | |
| 116 | |
| 117 enuminsts$(SUFFIX):$(XEDLIB) enuminsts$(SUFFIX).o str_utils$(SUFFIX).o \ | |
| 118 $(RAGELDECODER) \ | |
| 119 $(XEDDECODER) nacl_tester$(SUFFIX).o input_tester$(SUFFIX).o \ | |
| 120 text2hex$(SUFFIX).o | |
| 121 $(CXX) $(OPTDBG) -o $@ enuminsts$(SUFFIX).o str_utils$(SUFFIX).o \ | |
| 122 $(RAGELDECODER) \ | |
| 123 $(XEDDECODER) nacl_tester$(SUFFIX).o input_tester$(SUFFIX).o \ | |
| 124 text2hex$(SUFFIX).o $(XEDLIB) $(NACLLIBS) | |
| 125 | |
| 126 enuminsts$(SUFFIX).o: enuminsts.c | |
| 127 $(CC) $(OPTDBG) -o enuminsts$(SUFFIX).o $(CCARGS) enuminsts.c | |
| 128 | |
| 129 input_tester$(SUFFIX).o: input_tester.c | |
| 130 $(CC) $(OPTDBG) -o input_tester$(SUFFIX).o $(CCARGS) input_tester.c | |
| 131 | |
| 132 nacl_tester$(SUFFIX).o: nacl_tester.c | |
| 133 $(CC) $(OPTDBG) -o nacl_tester$(SUFFIX).o $(CCARGS) nacl_tester.c | |
| 134 | |
| 135 xed_tester$(SUFFIX).o: xed_tester.c | |
| 136 $(CC) $(OPTDBG) -o xed_tester$(SUFFIX).o $(CCARGS) xed_tester.c | |
| 137 | |
| 138 ragel_tester$(SUFFIX).o: ragel_tester.c | |
| 139 $(CC) $(OPTDBG) -o ragel_tester$(SUFFIX).o $(CCARGS) ragel_tester.c | |
| 140 | |
| 141 str_utils$(SUFFIX).o: str_utils.h str_utils.c | |
| 142 $(CC) $(OPTDBG) -o str_utils$(SUFFIX).o $(CCARGS) str_utils.c | |
| 143 | |
| 144 text2hex$(SUFFIX).o: text2hex.c | |
| 145 $(CC) $(OPTDBG) -o text2hex$(SUFFIX).o $(CCARGS) text2hex.c | |
| 146 | |
| 147 $(XEDLIB):$(PINGZ) | |
| 148 tar xzf $(PINGZ) $(XEDKIT) | |
| 149 touch $(XEDLIB) | |
| 150 | |
| 151 clean: | |
| 152 -rm -f *~ enuminsts$(SUFFIX) *$(SUFFIX).o | |
| 153 -rm -rf $(PINBASE) | |
| 154 | |
| 155 $(PINGZ): | |
| 156 @echo "This test requires downloading PIN first." | |
| 157 @echo "See ./README.txt for details." | |
| OLD | NEW |