Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

293 lines
9.5 KiB

  1. ##
  2. ## Copyright (c) 2000, Intel Corporation
  3. ## All rights reserved.
  4. ##
  5. ## WARRANTY DISCLAIMER
  6. ##
  7. ## THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  8. ## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  9. ## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  10. ## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
  11. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  12. ## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  13. ## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  14. ## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  15. ## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
  16. ## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
  17. ## MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  18. ##
  19. ## Intel Corporation is the author of the Materials, and requests that all
  20. ## problem reports or change requests be submitted to it directly at
  21. ## http://developer.intel.com/opensource.
  22. ##
  23. #LOCALBASEDIR = ../../../..
  24. TRIED_THIS_TRICK = 1
  25. ifeq ($(HOSTTYPE), WINNT)
  26. include $(SERVER_AREA)/include/Makefile.inc
  27. else
  28. include $(SERVER_AREA)/include/Makefile.inc
  29. endif
  30. ifdef AP32
  31. CC=ecl /Ap32 /As32 -Qapp_mode
  32. endif
  33. ifdef AP64
  34. CC=ecl -Qapp_mode
  35. endif
  36. ifeq ($(HOSTTYPE), WINNT)
  37. ###LOCALDIR = /x86sw
  38. VPATH = /topg_drive/x86sw/src/decem/build
  39. RM = $(RM_BIN) -f
  40. ifndef OPTIMIZE
  41. GCC_DEBUG = /Od
  42. else
  43. GCC_DEBUG =
  44. endif
  45. PERL = perl
  46. else
  47. ifeq ($(HOSTTYPE), i486-linux)
  48. PERL = perl
  49. else
  50. ifneq ($(OSTYPE),svr5)
  51. PERL = perl
  52. endif
  53. endif
  54. endif
  55. ifeq ($(HOSTTYPE), i486-linux)
  56. STRINGS_NOT_UNIQUIZE = -fwritable-strings
  57. endif
  58. ifeq ($(HOSTTYPE), hp9000s700)
  59. STRINGS_NOT_UNIQUIZE = -fwritable-strings
  60. endif
  61. EMDBDIR = ../../emdb
  62. ###EMDB_SPEC_TBLS = $(EMDBDIR)/emdb_merced.txt
  63. ###EMDB_ROWS = emdb_merced.txt
  64. vpath iel.h $(LOCALINC) $(INSTALLINC)
  65. vpath EM_perl.h $(LOCALINC) $(INSTALLINC)
  66. vpath %.h $(INSTALLINC)
  67. INSTALLINC_SEARCH_PATH = $(SERVER_AREA)/include
  68. LOCALINC = $(LOCALDIR)/include
  69. USER_CFLAGS = $(STRINGS_NOT_UNIQUIZE) -I . -I $(LOCALINC) -I $(INSTALLINC_SEARCH_PATH)
  70. PERL_INCLIST = -I $(LOCALINC) -I $(INSTALLINC_SEARCH_PATH)
  71. CURDIR = ../decem/build
  72. LIBPATH = -L$(LOCALLIB) -L$(INSTALLLIB)
  73. EMDB_ARGS = "-table -emdb_path . -dir $(CURDIR) -fields inst_id,format,major_opcode,template_role -prefix dec"
  74. EMDB_INST_ARGS = "-table -emdb_path . -dir $(CURDIR) -fields inst_id -prefix inst"
  75. COMMON_HEADERS = emdb_types.h EM.h EM_tools.h iel.h EM_hints.h
  76. EMDB_SOURCES = $(EMDBDIR)/emdb.txt $(EMDBDIR)/emdb_cut.pl \
  77. $(EMDBDIR)/decoder.txt
  78. ifeq ($(HOSTTYPE),WINNT)
  79. ifdef COVER
  80. %.obj: %.c
  81. chmod +w $<
  82. $(CC) /C /EP /DC_COVER_OFF="/* C-Cover off */" /DC_COVER_ON="/* C-Cover on */" $(CFLAGS) $< > $<.pp
  83. cp $<.pp $<
  84. rm $<.pp
  85. $(CC) $(CFLAGS) /Fo$@ /Tc$<
  86. endif
  87. endif
  88. #
  89. all: decision_tree.$(OEXT) decfn_emdb.$(OEXT) decfn_emdb.h \
  90. inst_ids.h dec_static.$(OEXT) #../dec_static.h
  91. decision_tree.c: tree_builder$(EEXT)
  92. "tree_builder$(EEXT)"
  93. decision_tree.$(OEXT): decision_tree.h
  94. tree_builder$(EEXT): tree.h tree_builder.h dec_ign_emdb.c inst_ids.h inst_ign_ids.h \
  95. builder_info.$(OEXT) dec_ign_emdb.$(OEXT) tree_builder.$(OEXT) tree_builder.c
  96. ifneq ($(HOSTTYPE),WINNT)
  97. $(CC) builder_info.o dec_ign_emdb.o tree_builder.o -o tree_builder$(EEXT) \
  98. $(LIBPATH) -liel -lm
  99. else
  100. $(CC) builder_info.obj dec_ign_emdb.obj tree_builder.obj -o tree_builder$(EEXT) libiel.lib
  101. endif
  102. dec_emdb.$(OEXT): func.h dec_priv_col.h
  103. dec_emdb.tab: $(EMDBDIR)/emdb.txt $(EMDBDIR)/emdb_cut.pl dec_priv_col.h
  104. echo "building dec_emdb.tab"
  105. cd "../../emdb" $(SEPR) \
  106. $(PERL) emdb_cut.pl -table -emdb_path . -dir $(CURDIR) -fields inst_id,format,major_opcode,template_role -prefix dec
  107. ###ign_inst.txt must be the last in '-row' sequence
  108. dec_ign_emdb.tab: $(EMDBDIR)/emdb.txt $(EMDBDIR)/emdb_cut.pl ign_inst.txt dec_priv_col.h
  109. echo "building dec_ign_emdb.tab"
  110. cd "../../emdb" $(SEPR) \
  111. $(PERL) emdb_cut.pl -rows $(CURDIR)/ign_inst.txt -table -emdb_path . \
  112. -dir $(CURDIR) -fields inst_id,format,major_opcode,template_role \
  113. -prefix dec_ign
  114. inst_ign_ids.h ign_inst.txt: $(EMDBDIR)/emdb.txt $(EMDBDIR)/emdb_formats.txt build_ignored_flds.pl
  115. $(PERL) $(PERL_INCLIST) build_ignored_flds.pl
  116. inst_emdb.tab: $(EMDBDIR)/emdb.txt $(EMDBDIR)/emdb_cut.pl dec_priv_col.h
  117. cd "../../emdb" $(SEPR) \
  118. $(PERL) emdb_cut.pl -table -emdb_path . -dir $(CURDIR) -fields inst_id -prefix inst
  119. builder_info.c builder_info.h: $(EMDBDIR)/emdb_formats.txt tree_builder.perl dec_ign_emdb.tab\
  120. EM_perl.h
  121. echo "building builder_info.c"
  122. $(PERL) $(PERL_INCLIST) tree_builder.perl
  123. decfn_emdb.c decfn_emdb.h func.h: deccpu_emdb.c deccpu_emdb.h func_build_1.pl hard_coded_fields_h.perl
  124. $(PERL) $(PERL_INCLIST) func_build_1.pl
  125. dec_static.c: dec1_emdb.c dec1_emdb.h build_static_info.pl EM_perl.h
  126. $(PERL) $(PERL_INCLIST) build_static_info.pl
  127. deccpu_emdb.c deccpu_emdb.h : $(EMDB_SOURCES)
  128. cd "../../emdb" $(SEPR) \
  129. $(PERL) emdb_cut.pl -emdb_path . -dir $(CURDIR) -columns decoder.txt \
  130. -fields inst_id,extensions,format,template_role,ops,flags,mem_size,dec_flags,impls \
  131. -include dec_priv_col.h -prefix deccpu
  132. ###ign_inst.txt must be the last in '-row' sequence
  133. dec_ign_emdb.c dec_ign_emdb.h : ign_inst.txt $(EMDB_SOURCES)
  134. cd "../../emdb" $(SEPR) \
  135. $(PERL) emdb_cut.pl -emdb_path . -dir $(CURDIR) -rows $(CURDIR)/ign_inst.txt \
  136. -fields inst_id,extensions,format,template_role,ops,flags \
  137. -include dec_priv_col.h -prefix dec_ign $(SEPR) cd "$(CURDIR)" $(SEPR) \
  138. $(PERL) -p -i.bak -e "s/_IGN\d+// if ( /\s*\{EM_\S*\_IGN\d+,/)" dec_ign_emdb.c
  139. dec1_emdb.c dec1_emdb.h : $(EMDBDIR)/emdb.txt $(EMDBDIR)/emdb_cut.pl \
  140. $(EMDBDIR)/decoder.txt $(EMDBDIR)/dec_stat.txt
  141. cd "../../emdb" $(SEPR) \
  142. $(PERL) emdb_cut.pl -emdb_path . -dir $(CURDIR) -columns\
  143. decoder.txt,dec_stat.txt -fields\
  144. mnemonic,dec_flags,template_role,ops,modifiers,flags,specul_flag,false_pred_flag,imp_dsts,imp_srcs,br_hint_flag,br_flag,adv_load_flag,control_transfer_flag\
  145. -prefix dec1
  146. decfn_emdb.$(OEXT): $(COMMON_HEADERS) inst_ids.h func.h
  147. dec_static.$(OEXT): $(COMMON_HEADERS) inst_ids.h
  148. tree_builder.h : tree_builder.c
  149. echo "building tree_builder.h"
  150. $(MHDR) tree_builder.h tree_builder.c
  151. tree_builder.$(OEXT): tree_builder.c tree_builder.h tree_builder.perl
  152. ifeq ($(HOSTTYPE),WINNT)
  153. ifdef COVER
  154. cov01 -0
  155. $(CC) /DC_COVER_OFF="" /DC_COVER_ON="" $(CFLAGS) /Fo$@ /Tc$<
  156. cov01 -1
  157. endif
  158. endif
  159. builder_info.$(OEXT): builder_info.c
  160. ifeq ($(HOSTTYPE),WINNT)
  161. ifdef COVER
  162. cov01 -0
  163. $(CC) /DC_COVER_OFF="" /DC_COVER_ON="" $(CFLAGS) /Fo$@ /Tc$<
  164. cov01 -1
  165. endif
  166. endif
  167. dec_ign_emdb.$(OEXT): dec_ign_emdb.c
  168. ifeq ($(HOSTTYPE),WINNT)
  169. ifdef COVER
  170. cov01 -0
  171. $(CC) /DC_COVER_OFF="" /DC_COVER_ON="" $(CFLAGS) /Fo$@ /Tc$<
  172. cov01 -1
  173. endif
  174. endif
  175. inst_ids.h: inst_emdb.tab inst_id.perl ../../copyright/external/c_file
  176. $(PERL) inst_id.perl
  177. $(EMDBDIR)/all_emdb.tab: $(EMDBDIR)/emdb.txt
  178. cd "../../emdb" $(SEPR) \
  179. $(PERL) emdb_cut.pl -table -emdb_path . -dir . -fields inst_id,mnemonic -prefix all
  180. $(EMDBDIR)/decoder.txt EM_hints.h: $(EMDBDIR)/all_emdb.tab $(EMDBDIR)/emdb_cut.pl
  181. cd "../../emdb" $(SEPR) $(PERL) dec_private.perl
  182. ###################################
  183. ##### Source release rules ####
  184. ###################################
  185. C_FILES = tree_builder.c
  186. H_FILES = dec_priv_col.h decision_tree.h tree.h
  187. PERL_FILES = build_ignored_flds.pl build_static_info.pl func_build_1.pl func_build_2.pl \
  188. inst_cpu_clmn.perl inst_id.perl tree_builder.perl hard_coded_fields_h.perl
  189. EMDB_FILES = $(EMDBDIR)/dec_private.perl $(EMDBDIR)/dec_stat.txt
  190. COPYRIGHT_EXTERNAL_FILES = ../../copyright/external/c_file
  191. SOURCE_RELEASE_DECEM_BUILD_DIR = $(TARGET_TREE)/src/decem/build
  192. SOURCE_RELEASE_EMDB_DIR = $(TARGET_TREE)/src/emdb
  193. SOURCE_RELEASE_COPYRIGHT_EXTERNAL_DIR = $(TARGET_TREE)/src/copyright/external
  194. SOURCE_RELEASE_FILES = Makefile $(PERL_FILES) $(C_FILES) $(H_FILES) $(EMDB_FILES) $(COPYRIGHT_EXTERNAL_FILES)
  195. source_release_copy: $(SOURCE_RELEASE_FILES)
  196. @echo Copying decem build source files to $(SOURCE_RELEASE_DECEM_BUILD_DIR)
  197. $(CP) Makefile $(PERL_FILES) $(C_FILES) $(H_FILES) $(SOURCE_RELEASE_DECEM_BUILD_DIR)
  198. @echo Copying decem emdb source files to $(SOURCE_RELEASE_EMDB_DIR)
  199. $(CP) $(EMDB_FILES) $(SOURCE_RELEASE_EMDB_DIR)
  200. @echo Copying decem copyright source files to $(SOURCE_RELEASE_COPYRIGHT_EXTERNAL_DIR)
  201. $(CP) $(COPYRIGHT_EXTERNAL_FILES) $(SOURCE_RELEASE_COPYRIGHT_EXTERNAL_DIR)
  202. source_release_clean:
  203. @echo Cleaning decem build source release files
  204. $(RM) *.$(OEXT) dec_emdb.c dec_emdb.h func.h dec_emdb.tab inst_emdb.tab dec1_emdb.c \
  205. dec1_emdb.h tree_builder$(EEXT) builder_info.* dec_frmt.txt \
  206. tree_builder.h inst_ids.h $(EM_HINTS_H) dec_ign_emdb.c dec_ign_emdb.c.bak inst_ign_ids.h \
  207. dec_ign_emdb.tab ign_inst.txt deccpu_emdb.c deccpu_emdb.h $(EMDBDIR)/all_emdb.tab
  208. source_release_check:
  209. ###################################
  210. clean:
  211. $(RM) *.$(OEXT) dec_emdb.c dec_emdb.h decfn_emdb.c decfn_emdb.h func.h \
  212. dec_emdb.tab inst_emdb.tab dec1_emdb.c dec1_emdb.h dec_static.c \
  213. tree_builder$(EEXT) builder_info.* decision_tree.c dec_frmt.txt \
  214. $(EMDBDIR)/decoder.txt tree_builder.h inst_ids.h $(EM_HINTS_H) \
  215. dec_ign_emdb.c dec_ign_emdb.c.bak inst_ign_ids.h dec_ign_emdb.tab \
  216. ign_inst.txt deccpu_emdb.c deccpu_emdb.h $(EMDBDIR)/all_emdb.tab