Add .PHONY targets for building source and binary RPM packages. You can
[oota-llvm.git] / Makefile
1 #===- ./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
10 LEVEL := .
11 DIRS := lib/System lib/Support utils lib/VMCore lib tools runtime docs
12 OPTIONAL_DIRS := examples projects
13 EXTRA_DIST := test llvm.spec include win32 Xcode
14
15 include $(LEVEL)/Makefile.config 
16
17 # llvm-gcc4 doesn't need runtime libs.
18 ifeq ($(LLVMGCC_MAJVERS),4)
19   DIRS := $(filter-out runtime, $(DIRS))
20 endif
21
22 ifeq ($(MAKECMDGOALS),libs-only)
23   DIRS := $(filter-out tools runtime docs, $(DIRS))
24   OPTIONAL_DIRS :=
25 endif
26
27 ifeq ($(MAKECMDGOALS),tools-only)
28   DIRS := $(filter-out runtime docs, $(DIRS))
29   OPTIONAL_DIRS :=
30 endif
31
32 # Don't install utils, examples, or projects they are only used to 
33 # build LLVM.
34 ifeq ($(MAKECMDGOALS),install)
35   DIRS := $(filter-out utils, $(DIRS))
36   OPTIONAL_DIRS :=
37 endif
38
39 # Include the main makefile machinery.
40 include $(LLVM_SRC_ROOT)/Makefile.rules
41
42 # Specify options to pass to configure script when we're
43 # running the dist-check target
44 DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
45
46 .PHONY: debug-opt-prof
47 debug-opt-prof:
48         $(Echo) Building Debug Version
49         $(Verb) $(MAKE)
50         $(Echo)
51         $(Echo) Building Optimized Version
52         $(Echo)
53         $(Verb) $(MAKE) ENABLE_OPTIMIZED=1
54         $(Echo)
55         $(Echo) Building Profiling Version
56         $(Echo)
57         $(Verb) $(MAKE) ENABLE_PROFILING=1
58
59 dist-hook::
60         $(Echo) Eliminating files constructed by configure
61         $(Verb) $(RM) -f \
62           $(TopDistDir)/include/llvm/ADT/hash_map  \
63           $(TopDistDir)/include/llvm/ADT/hash_set  \
64           $(TopDistDir)/include/llvm/ADT/iterator  \
65           $(TopDistDir)/include/llvm/Config/config.h  \
66           $(TopDistDir)/include/llvm/Support/DataTypes.h  \
67           $(TopDistDir)/include/llvm/Support/ThreadSupport.h
68
69 tools-only: all
70 libs-only: all
71
72 #------------------------------------------------------------------------
73 # Make sure the generated headers are up-to-date. This must be kept in
74 # sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
75 #------------------------------------------------------------------------
76 FilesToConfig := \
77   include/llvm/Config/config.h \
78   include/llvm/Support/DataTypes.h \
79   include/llvm/ADT/hash_map \
80   include/llvm/ADT/hash_set \
81   include/llvm/ADT/iterator
82 FilesToConfigPATH  := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
83
84 all-local:: $(FilesToConfigPATH)
85 $(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in 
86         $(Echo) Regenerating $*
87         $(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
88 .PRECIOUS: $(FilesToConfigPATH)
89
90 # NOTE: This needs to remain as the last target definition in this file so
91 # that it gets executed last.
92 all:: 
93         $(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
94 ifeq ($(BuildMode),Debug)
95         $(Echo) '*****' Note: Debug build can be 10 times slower than an
96         $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
97         $(Echo) '*****' make an optimized build.
98 endif
99
100 check-llvm2cpp:
101         $(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
102
103 srpm: $(LLVM_OBJ_ROOT)/llvm.spec 
104         rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
105
106 rpm: $(LLVM_OBJ_ROOT)/llvm.spec 
107         rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
108
109 .PHONY: srpm rpm