Factor a bunch of the rules and add support for generating the asmwriter.
[oota-llvm.git] / lib / Target / X86 / Makefile
1 ##===- lib/Target/X86/Makefile -----------------------------*- Makefile -*-===##
2
3 #                     The LLVM Compiler Infrastructure
4 #
5 # This file was developed by the LLVM research group and is distributed under
6 # the University of Illinois Open Source License. See LICENSE.TXT for details.
7
8 ##===----------------------------------------------------------------------===##
9 LEVEL = ../../..
10 LIBRARYNAME = x86
11 include $(LEVEL)/Makefile.common
12
13 TARGET = X86
14
15 # Make sure that tblgen is run, first thing.
16 $(SourceDepend): X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \
17                  X86GenRegisterInfo.inc X86GenInstrNames.inc \
18                  X86GenInstrInfo.inc X86GenAsmWriter.inc \
19                  X86GenInstrSelector.inc
20
21 TDFILES = $(SourceDir)/$(TARGET).td $(wildcard $(SourceDir)/*.td) \
22           $(SourceDir)/../Target.td
23
24 $(TARGET)GenRegisterNames.inc::  $(TDFILES) $(TBLGEN)
25         @echo "Building $(TARGET).td register names with tblgen"
26         $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-enums -o $@
27
28 $(TARGET)GenRegisterInfo.h.inc:: $(TDFILES) $(TBLGEN)
29         @echo "Building $(TARGET).td register information header with tblgen"
30         $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-desc-header -o $@
31
32 $(TARGET)GenRegisterInfo.inc:: $(TDFILES) $(TBLGEN)
33         @echo "Building $(TARGET).td register info implementation with tblgen"
34         $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-desc -o $@
35
36 $(TARGET)GenInstrNames.inc:: $(TDFILES) $(TBLGEN)
37         @echo "Building $(TARGET).td instruction names with tblgen"
38         $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-enums -o $@
39
40 $(TARGET)GenInstrInfo.inc:: $(TDFILES) $(TBLGEN)
41         @echo "Building $(TARGET).td instruction information with tblgen"
42         $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-desc -o $@
43
44 $(TARGET)GenAsmWriter.inc:: $(TDFILES) $(TBLGEN)
45         @echo "Building $(TARGET).td assembly writer with tblgen"
46         $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-asm-writer -o $@
47
48 $(TARGET)GenInstrSelector.inc:: $(TDFILES) $(TBLGEN)
49         @echo "Building $(TARGET).td instruction selector with tblgen"
50         $(VERB) $(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-selector -o $@
51
52 clean::
53         $(VERB) rm -f *.inc