1 #,===-- Makefile.rules.am - Common make rules for LLVM ------*- Makefile -*--===#
3 # The LLVM Compiler Infrastructure
5 # This file was developed by Reid Spencer and is distributed under the
6 # University of Illinois Open Source License. See LICENSE.TXT for details.
8 #===------------------------------------------------------------------------===#
10 # Options for all makefiles
11 ACLOCAL_AMFLAGS = -I autoconf -I autoconf/m4 --output=autoconf/aclocal.m4
12 AUTOMAKE_OPTIONS = foreign dejagnu dist-zip nostdinc
15 # Install Directories as local makefile variables
17 LLVM_PREFIX := @LLVM_PREFIX@
18 LLVM_BINDIR := @LLVM_BINDIR@
19 LLVM_LIBDIR := @LLVM_LIBDIR@
20 LLVM_DATADIR := @LLVM_DATADIR@
21 LLVM_DOCSDIR := @LLVM_DOCSDIR@
22 LLVM_ETCDIR := @LLVM_ETCDIR@
23 LLVM_INCLUDEDIR:= @LLVM_INCLUDEDIR@
24 LLVM_INFODIR := @LLVM_INFODIR@
25 LLVM_MANDIR := @LLVM_MANDIR@
28 # LLVM Specific C/C++ compiler flags
30 LLVM_COMMONFLAGS := -Wall -W -Wwrite-strings -Wno-unused -Wcast-align
36 -I$(top_srcdir)/include \
37 -I$(top_builddir)/include \
38 -D_RENTRANT -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
41 LLVM_CPPFLAGS += -DNDEBUG
42 LLVM_CXXFLAGS += -pg -O3 -finline-functions -felide-constructors
43 LLVM_CXXFLAGS += -pg -O3 -finline-functions
48 LLVM_CPPFLAGS += -DNDEBUG
49 LLVM_CXXFLAGS += -O3 -finline-functions -fomit-frame-pointer -felide-constructors
51 LLVM_CPPFLAGS += -D_DEBUG
54 # Required tool definitions as macros so they can be overridden
62 LINKLIB := ${LIBTOOL} --tag=CXX --mode=link $(CXX) -o
64 BURG := $(top_builddir)/utils/Burg/burg$(EXEEXT)
66 TBLGEN := $(top_builddir)/utils/TableGen/TableGen$(EXEEXT)
67 LGCCLDPROG := $(top_builddir)/tools/gccld/gccld$(EXEEXT)
70 # Set up the standard automake variables
72 AM_CPPFLAGS = $(LLVM_CPPFLAGS)
73 AM_CXXFLAGS = $(LLVM_COMMONFLAGS) $(LLVM_CXXFLAGS)
74 AM_CFLAGS = $(LLVM_COMMONFLAGS) $(LLVM_CFLAGS)
76 # LLVM GMake Function macros
77 FIXOBJ = $(top_builddir)/lib/$(2)/LLVM$(1).o
78 FIXLIB = $(top_builddir)/lib/$(2)/libLLVM$(1).a
79 FINDPATH = $(if $(findstring Support,$(1)),Support,$(strip \
80 $(if $(findstring System,$(1)),System,$(strip \
81 $(if $(findstring IPA,$(1)),Analysis/IPA,$(strip \
82 $(if $(findstring DataStructure,$(1)),Analysis/DataStructure,$(strip \
83 $(if $(findstring Analysis,$(1)),Analysis,$(strip \
84 $(if $(findstring SparcV9RegAlloc,$(1)),Target/SparcV9/RegAlloc,$(strip \
85 $(if $(findstring Target,$(1)),Target,$(strip \
86 $(if $(findstring IPO,$(1)),Transforms/IPO,$(strip \
87 $(if $(findstring Instrument,$(1)),Transforms/Instrumentation,$(strip \
88 $(if $(findstring ScalarOpts,$(1)),Transforms/Scalar,$(strip \
89 $(if $(findstring TransformUtils,$(1)),Transforms/Utils,$(strip \
90 $(if $(findstring Transforms,$(1)),Transforms,$(strip \
91 $(if $(findstring Core,$(1)),VMCore,$(strip \
92 $(if $(findstring AsmParser,$(1)),AsmParser,$(strip \
93 $(if $(findstring BCReader,$(1)),Bytecode/Reader,$(strip \
94 $(if $(findstring BCWriter,$(1)),Bytecode/Writer,$(strip \
95 $(if $(findstring InstrSched,$(1)),CodeGen/InstrSched,$(strip \
96 $(if $(findstring ModuloScheduling,$(1)),CodeGen/ModuloScheduling,$(strip \
97 $(if $(findstring SelectionDAG,$(1)),CodeGen/SelectionDAG,$(strip \
98 $(if $(findstring CodeGen,$(1)),CodeGen,$(strip \
99 $(if $(findstring Debugger,$(1)),Debugger,$(strip \
100 $(if $(findstring Interpreter,$(1)),ExecutionEngine/Interpreter,$(strip \
101 $(if $(findstring JIT,$(1)),ExecutionEngine/JIT,$(strip \
102 $(if $(findstring ExecutionEngine,$(1)),ExecutionEngine,$(strip \
103 $(if $(findstring CWriter,$(1)),Target/CBackend,$(strip \
104 $(if $(findstring PowerPC,$(1)),Target/PowerPC,$(strip \
105 $(if $(findstring Skeleton,$(1)),Target/Skeleton,$(strip \
106 $(if $(findstring SparcV9LiveVar,$(1)),Target/SparcV9/LiveVar,$(strip \
107 $(if $(findstring SparcV9,$(1)),Target/SparcV9,$(strip \
108 $(if $(findstring X86,$(1)),Target/X86,$(strip \
109 $(if $(findstring ProfilePaths,$(1)),Transforms/Instrumentation/ProfilePaths,$(strip \
110 $(if $(findstring Hello,$(1)),Transforms/Hello,$strip \
111 PATH_TO_UNKNOWN_OBJECT)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
113 GETOBJ = $(call FIXOBJ,$(1),$(call FINDPATH,$(1)))
114 GETLIB = $(call FIXLIB,$(1),$(call FINDPATH,$(1)))
115 GETOBJS = $(foreach I,$(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9) $(10),$(call GETOBJ,$(I)))
116 GETLIBS = $(foreach I,$(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9) $(10),$(call GETLIB,$(I)))
122 $(VERB) $(FLEX) -t $< | \
123 $(SED) '/^find_rule/d' | \
124 $(SED) 's/void yyunput/inline void yyunput/' | \
125 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
126 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@.tmp
127 $(VERB) $(CMP) -s $@ $@.tmp > /dev/null || ${MV} -f $@.tmp $@
128 @# remove the output of flex if it didn't get moved over...
133 %.c: %.y # Cancel built-in rules for yacc
135 %.h: %.y # Cancel built-in rules for yacc
138 @${ECHO} "Bisoning `basename $<`"
139 $(VERB) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
140 $(VERB) $(CMP) -s $*.tab.c $*.cpp > /dev/null || ${MV} -f $*.tab.c $*.cpp
141 $(VERB) $(CMP) -s $*.tab.h $*.h > /dev/null || ${MV} -f $*.tab.h $*.h
142 @# If the files were not updated, don't leave them lying around...
143 @$(RM) -f $*.tab.c $*.tab.h
146 %GenRegisterNames.inc : %.td
147 @echo "Building $< register names with tblgen"
148 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-register-enums -o $@
150 %GenRegisterInfo.h.inc : %.td
151 @echo "Building $< register information header with tblgen"
152 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-register-desc-header -o $@
154 %GenRegisterInfo.inc : %.td
155 @echo "Building $< register info implementation with tblgen"
156 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-register-desc -o $@
158 %GenInstrNames.inc : %.td
159 @echo "Building $< instruction names with tblgen"
160 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-instr-enums -o $@
162 %GenInstrInfo.inc : %.td
163 @echo "Building $< instruction information with tblgen"
164 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-instr-desc -o $@
166 %GenAsmWriter.inc : %.td
167 @echo "Building $< assembly writer with tblgen"
168 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-asm-writer -o $@
170 %GenATTAsmWriter.inc : %.td
171 @echo "Building $< AT&T assembly writer with tblgen"
172 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-asm-writer -o $@
174 %GenIntelAsmWriter.inc : %.td
175 @echo "Building $< Intel assembly writer with tblgen"
176 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-asm-writer -asmwriternum=1 -o $@
178 %GenInstrSelector.inc: %.td
179 @echo "Building $< instruction selector with tblgen"
180 $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-instr-selector -o $@
182 TDFILES = $(wildcard $(srcdir)/*.td ) $(srcdir)/../Target.td