Home | History | Annotate | Download | only in clang
      1 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 # Makefile to build the PPAPI Clang plugins
      6 
      7 .PHONY: all clean
      8 
      9 PLUGINS = PrintNamesAndSizes FindAffectedInterfaces
     10 
     11 all: $(foreach plugin,$(PLUGINS),$(plugin))
     12 
     13 clean: $(foreach plugin,$(PLUGINS),clean_$(plugin))
     14 
     15 # This makefile assumes that you checked out llvm in a subdirectory of your
     16 # home directory called 'llvm'.  The source of llvm itself should be one level
     17 # deeper at ~/llvm/llvm.  It also assumes that you also have the clang component
     18 # of llvm installed.
     19 # It further assumes that clang has been built in Debug mode following the
     20 # usual instructions, with a build directory parallel to the llvm directory.
     21 #   See instructions here:  http://clang.llvm.org/get_started.html
     22 # If you didn't configure Clang this way, you can set environment variables
     23 # appropriately to work with your configuration of Clang and LLVM.
     24 LLVM_ROOT ?= ~/llvm
     25 LLVM_SOURCE_ROOT ?= $(LLVM_ROOT)/llvm
     26 LLVM_BUILD_ROOT?=$(LLVM_ROOT)/build
     27 LLVM_INCLUDES?=-I$(LLVM_BUILD_ROOT)/include -I$(LLVM_SOURCE_ROOT)/include
     28 LLVM_LIB_PATHS?=-L$(LLVM_BUILD_ROOT)/Debug+Asserts/lib
     29 
     30 CLANG_ROOT=$(LLVM_SOURCE_ROOT)/tools/clang
     31 CLANG_BUILD_ROOT=$(LLVM_BUILD_ROOT)/tools/clang
     32 CLANG_INCLUDES=-I$(CLANG_ROOT)/include -I$(CLANG_BUILD_ROOT)/include
     33 
     34 INCLUDES=$(LLVM_INCLUDES) $(CLANG_INCLUDES) -I.
     35 
     36 CLANG_DEFINITIONS=-D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS\
     37  -D__STDC_CONSTANT_MACROS
     38 
     39 COMMON_CCFLAGS=-fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual\
     40  -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter\
     41  -Wwrite-strings
     42 
     43 CCFLAGS=$(INCLUDES) $(CLANG_DEFINITIONS) $(COMMON_CCFLAGS) -O2
     44 LDFLAGS = -Wl,-R $(LLVM_LIB_PATHS) -lpthread -ldl -lm -shared
     45 
     46 CPP=g++
     47 
     48 %.o: %.cc
     49 	$(CPP) $(CCFLAGS) -c -o $@ $<
     50 
     51 PRINT_NAMES_AND_SIZES_OBJECTS=print_names_and_sizes.o
     52 
     53 PrintNamesAndSizes: $(PRINT_NAMES_AND_SIZES_OBJECTS)
     54 	$(CPP) $^ $(LDFLAGS) -o libPrintNamesAndSizes.so
     55 
     56 clean_PrintNamesAndSizes:
     57 	rm -f $(PRINT_NAMES_AND_SIZES_OBJECTS) libPrintNamesAndSizes.so
     58 
     59 FIND_AFFECTED_INTERFACES_OBJECTS=find_affected_interfaces.o
     60 
     61 FindAffectedInterfaces: $(FIND_AFFECTED_INTERFACES_OBJECTS)
     62 	$(CPP) $^ $(LDFLAGS) -o libFindAffectedInterfaces.so
     63 
     64 clean_FindAffectedInterfaces:
     65 	rm -f $(FIND_AFFECTED_INTERFACES_OBJECTS) libFindAffectedInterfaces.so
     66 
     67 
     68