Remove duplication.

Factor out common preprocessor-related bits to Makefile.rules.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74153 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mikhail Glushenkov 2009-06-25 01:07:00 +00:00
parent 7dcf4a826c
commit 0a1cb1ea86
6 changed files with 47 additions and 130 deletions

View File

@ -214,6 +214,49 @@ endif
endif # LLVMC_PLUGIN
ifdef LLVMC_BASED_DRIVER
TOOLNAME = $(LLVMC_BASED_DRIVER)
LLVMLIBS = CompilerDriver.a
LINK_COMPONENTS = support system
REQUIRES_EH := 1
# Preprocessor magic that generates references to static variables in built-in
# plugins.
ifneq ($(LLVMC_BUILTIN_PLUGINS),)
USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS))
ifneq ($(LLVMC_BUILTIN_PLUGIN_1),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_2),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_3),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_4),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_5),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5)
endif
endif
endif # LLVMC_BASED_DRIVER
###############################################################################
# VARIABLES: Set up various variables based on configuration data
###############################################################################

View File

@ -8,46 +8,6 @@
##===----------------------------------------------------------------------===##
LEVEL = ../../..
include $(LEVEL)/Makefile.config
TOOLNAME = $(LLVMC_BASED_DRIVER_NAME)
LLVMLIBS = CompilerDriver.a
LINK_COMPONENTS = support system
REQUIRES_EH := 1
# Preprocessor magic that generates references to static variables in built-in
# plugins.
# TODO: Move this to Makefile.rules? (also used by examples/{Skeleton, mcc16})
ifneq ($(LLVMC_BUILTIN_PLUGINS),)
USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS))
ifneq ($(LLVMC_BUILTIN_PLUGIN_1),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_2),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_3),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_4),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_5),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5)
endif
endif
LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
include $(LEVEL)/Makefile.common

View File

@ -8,7 +8,7 @@
##===----------------------------------------------------------------------===##
# Change this so that $(BASE_LEVEL)/Makefile.common refers to
# $LLVM_DIR/Makefile.common.
# $LLVM_DIR/Makefile.common or $YOUR_LLVM_BASED_PROJECT/Makefile.common.
export LLVMC_BASE_LEVEL = ../../../..
# Change this to the name of your LLVMC-based driver.

View File

@ -8,46 +8,6 @@
##===----------------------------------------------------------------------===##
LEVEL = $(LLVMC_BASE_LEVEL)/..
include $(LEVEL)/Makefile.config
TOOLNAME = $(LLVMC_BASED_DRIVER_NAME)
LLVMLIBS = CompilerDriver.a
LINK_COMPONENTS = support system
REQUIRES_EH := 1
# Preprocessor magic that generates references to static variables in built-in
# plugins.
# TODO: Move this to Makefile.rules? (also used by examples/{Skeleton, mcc16})
ifneq ($(LLVMC_BUILTIN_PLUGINS),)
USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS))
ifneq ($(LLVMC_BUILTIN_PLUGIN_1),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_2),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_3),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_4),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_5),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5)
endif
endif
LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
include $(LEVEL)/Makefile.common

View File

@ -7,14 +7,8 @@
#
##===----------------------------------------------------------------------===##
# Change this so that $(BASE_LEVEL)/Makefile.common refers to
# $LLVM_DIR/Makefile.common.
export LLVMC_BASE_LEVEL = ../../../..
# Change this to the name of your LLVMC-based driver.
export LLVMC_BASED_DRIVER_NAME = mcc16
# List your plugin names here
export LLVMC_BUILTIN_PLUGINS = PIC16Base
LEVEL = $(LLVMC_BASE_LEVEL)

View File

@ -8,46 +8,6 @@
##===----------------------------------------------------------------------===##
LEVEL = $(LLVMC_BASE_LEVEL)/..
include $(LEVEL)/Makefile.config
TOOLNAME = $(LLVMC_BASED_DRIVER_NAME)
LLVMLIBS = CompilerDriver.a
LINK_COMPONENTS = support system
REQUIRES_EH := 1
# Preprocessor magic that generates references to static variables in built-in
# plugins.
# TODO: Move this to Makefile.rules? (also used by examples/{Skeleton, mcc16})
ifneq ($(LLVMC_BUILTIN_PLUGINS),)
USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_1 = $(word 1, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_2 = $(word 2, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_3 = $(word 3, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_4 = $(word 4, $(LLVMC_BUILTIN_PLUGINS))
LLVMC_BUILTIN_PLUGIN_5 = $(word 5, $(LLVMC_BUILTIN_PLUGINS))
ifneq ($(LLVMC_BUILTIN_PLUGIN_1),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_1=$(LLVMC_BUILTIN_PLUGIN_1)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_2),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_2=$(LLVMC_BUILTIN_PLUGIN_2)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_3),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_3=$(LLVMC_BUILTIN_PLUGIN_3)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_4),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_4=$(LLVMC_BUILTIN_PLUGIN_4)
endif
ifneq ($(LLVMC_BUILTIN_PLUGIN_5),)
CPP.Flags += -DLLVMC_BUILTIN_PLUGIN_5=$(LLVMC_BUILTIN_PLUGIN_5)
endif
endif
LLVMC_BASED_DRIVER = $(LLVMC_BASED_DRIVER_NAME)
include $(LEVEL)/Makefile.common