#,===-- Makefile.rules.am - Common make rules for LLVM ------*- Makefile -*--===# # # The LLVM Compiler Infrastructure # # This file was developed by Reid Spencer and is distributed under the # University of Illinois Open Source License. See LICENSE.TXT for details. # #===------------------------------------------------------------------------===# # Options for all makefiles ACLOCAL_AMFLAGS = -I autoconf -I autoconf/m4 --output=autoconf/aclocal.m4 AUTOMAKE_OPTIONS = foreign dejagnu dist-zip nostdinc # # Install Directories as local makefile variables # LLVM_PREFIX := @LLVM_PREFIX@ LLVM_BINDIR := @LLVM_BINDIR@ LLVM_LIBDIR := @LLVM_LIBDIR@ LLVM_DATADIR := @LLVM_DATADIR@ LLVM_DOCSDIR := @LLVM_DOCSDIR@ LLVM_ETCDIR := @LLVM_ETCDIR@ LLVM_INCLUDEDIR:= @LLVM_INCLUDEDIR@ LLVM_INFODIR := @LLVM_INFODIR@ LLVM_MANDIR := @LLVM_MANDIR@ # # LLVM Specific C/C++ compiler flags # LLVM_COMMONFLAGS := -Wall -W -Wwrite-strings -Wno-unused -Wcast-align LLVM_CXXFLAGS := LLVM_CFLAGS := LLVM_CPPFLAGS := \ -I. \ -I$(srcdir) \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -D_RENTRANT -D_GNU_SOURCE -D__STDC_LIMIT_MACROS if ENABLE_PROFILED LLVM_CPPFLAGS += -DNDEBUG LLVM_CXXFLAGS += -pg -O3 -finline-functions -felide-constructors LLVM_CXXFLAGS += -pg -O3 -finline-functions LLVM_CFLAGS += -pg endif if ENABLE_OPTIMIZED LLVM_CPPFLAGS += -DNDEBUG LLVM_CXXFLAGS += -O3 -finline-functions -fomit-frame-pointer -felide-constructors else LLVM_CPPFLAGS += -D_DEBUG endif # Required tool definitions as macros so they can be overridden VERB := @ SED := sed RM := rm CMP := cmp MV := mv ECHO := echo IGNORE := true LINKLIB := ${LIBTOOL} --tag=CXX --mode=link $(CXX) -o BURG := $(top_builddir)/utils/Burg/burg$(EXEEXT) RunBurg := $(BURG) -I TBLGEN := $(top_builddir)/utils/TableGen/TableGen$(EXEEXT) LGCCLDPROG := $(top_builddir)/tools/gccld/gccld$(EXEEXT) # Set up the standard automake variables # AM_CPPFLAGS = $(LLVM_CPPFLAGS) AM_CXXFLAGS = $(LLVM_COMMONFLAGS) $(LLVM_CXXFLAGS) AM_CFLAGS = $(LLVM_COMMONFLAGS) $(LLVM_CFLAGS) # LLVM GMake Function macros FIXOBJ = $(top_builddir)/lib/$(2)/LLVM$(1).o FIXLIB = $(top_builddir)/lib/$(2)/libLLVM$(1).a FINDPATH = $(if $(findstring Support,$(1)),Support,$(strip \ $(if $(findstring System,$(1)),System,$(strip \ $(if $(findstring IPA,$(1)),Analysis/IPA,$(strip \ $(if $(findstring DataStructure,$(1)),Analysis/DataStructure,$(strip \ $(if $(findstring Analysis,$(1)),Analysis,$(strip \ $(if $(findstring SparcV9RegAlloc,$(1)),Target/SparcV9/RegAlloc,$(strip \ $(if $(findstring Target,$(1)),Target,$(strip \ $(if $(findstring IPO,$(1)),Transforms/IPO,$(strip \ $(if $(findstring Instrument,$(1)),Transforms/Instrumentation,$(strip \ $(if $(findstring ScalarOpts,$(1)),Transforms/Scalar,$(strip \ $(if $(findstring TransformUtils,$(1)),Transforms/Utils,$(strip \ $(if $(findstring Transforms,$(1)),Transforms,$(strip \ $(if $(findstring Core,$(1)),VMCore,$(strip \ $(if $(findstring AsmParser,$(1)),AsmParser,$(strip \ $(if $(findstring BCReader,$(1)),Bytecode/Reader,$(strip \ $(if $(findstring BCWriter,$(1)),Bytecode/Writer,$(strip \ $(if $(findstring InstrSched,$(1)),CodeGen/InstrSched,$(strip \ $(if $(findstring ModuloScheduling,$(1)),CodeGen/ModuloScheduling,$(strip \ $(if $(findstring SelectionDAG,$(1)),CodeGen/SelectionDAG,$(strip \ $(if $(findstring CodeGen,$(1)),CodeGen,$(strip \ $(if $(findstring Debugger,$(1)),Debugger,$(strip \ $(if $(findstring Interpreter,$(1)),ExecutionEngine/Interpreter,$(strip \ $(if $(findstring JIT,$(1)),ExecutionEngine/JIT,$(strip \ $(if $(findstring ExecutionEngine,$(1)),ExecutionEngine,$(strip \ $(if $(findstring CWriter,$(1)),Target/CBackend,$(strip \ $(if $(findstring PowerPC,$(1)),Target/PowerPC,$(strip \ $(if $(findstring Skeleton,$(1)),Target/Skeleton,$(strip \ $(if $(findstring SparcV9LiveVar,$(1)),Target/SparcV9/LiveVar,$(strip \ $(if $(findstring SparcV9,$(1)),Target/SparcV9,$(strip \ $(if $(findstring X86,$(1)),Target/X86,$(strip \ $(if $(findstring ProfilePaths,$(1)),Transforms/Instrumentation/ProfilePaths,$(strip \ $(if $(findstring Hello,$(1)),Transforms/Hello,$strip \ PATH_TO_UNKNOWN_OBJECT))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) GETOBJ = $(call FIXOBJ,$(1),$(call FINDPATH,$(1))) GETLIB = $(call FIXLIB,$(1),$(call FINDPATH,$(1))) GETOBJS = $(foreach I,$(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9) $(10),$(call GETOBJ,$(I))) GETLIBS = $(foreach I,$(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9) $(10),$(call GETLIB,$(I))) # LLVM Rules %.cpp: %.l @${ECHO} Flexing $< $(VERB) $(FLEX) -t $< | \ $(SED) '/^find_rule/d' | \ $(SED) 's/void yyunput/inline void yyunput/' | \ $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \ $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@.tmp $(VERB) $(CMP) -s $@ $@.tmp > /dev/null || ${MV} -f $@.tmp $@ @# remove the output of flex if it didn't get moved over... @$(RM) -f $@.tmp SUFFIXES = .td %.c: %.y # Cancel built-in rules for yacc %.h: %.y # Cancel built-in rules for yacc %.cpp %.h : %.y @${ECHO} "Bisoning `basename $<`" $(VERB) $(BISON) -v -d -p $( /dev/null || ${MV} -f $*.tab.c $*.cpp $(VERB) $(CMP) -s $*.tab.h $*.h > /dev/null || ${MV} -f $*.tab.h $*.h @# If the files were not updated, don't leave them lying around... @$(RM) -f $*.tab.c $*.tab.h %GenRegisterNames.inc : %.td @echo "Building $< register names with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-register-enums -o $@ %GenRegisterInfo.h.inc : %.td @echo "Building $< register information header with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-register-desc-header -o $@ %GenRegisterInfo.inc : %.td @echo "Building $< register info implementation with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-register-desc -o $@ %GenInstrNames.inc : %.td @echo "Building $< instruction names with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-instr-enums -o $@ %GenInstrInfo.inc : %.td @echo "Building $< instruction information with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-instr-desc -o $@ %GenAsmWriter.inc : %.td @echo "Building $< assembly writer with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-asm-writer -o $@ %GenATTAsmWriter.inc : %.td @echo "Building $< AT&T assembly writer with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-asm-writer -o $@ %GenIntelAsmWriter.inc : %.td @echo "Building $< Intel assembly writer with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-asm-writer -asmwriternum=1 -o $@ %GenInstrSelector.inc: %.td @echo "Building $< instruction selector with tblgen" $(VERB) $(TBLGEN) -I $(srcdir) $< -gen-instr-selector -o $@ TDFILES = $(wildcard $(srcdir)/*.td ) $(srcdir)/../Target.td