Fix file mode.
[llvm-testsuite.git] / Makefile.rules
blob9483b73283c1a8c632650ac107662fa2bd2d0e69
1 #===-- Makefile.rules - Common make rules for LLVM ---------*- Makefile -*--===#
3 #                     The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
7
8 #===------------------------------------------------------------------------===#
10 # This file is included by all of the LLVM makefiles.  This file defines common
11 # rules to do things like compile a .cpp file or generate dependency info.
12 # These are platform dependent, so this is the file used to specify these
13 # system dependent operations.
15 # The following functionality can be set by setting incoming variables.
16 # The variable $(LEVEL) *must* be set:
18 # 1. LEVEL - The level of the current subdirectory from the top of the 
19 #    MagicStats view.  This level should be expressed as a path, for 
20 #    example, ../.. for two levels deep.
22 # 2. DIRS - A list of subdirectories to be built.  Fake targets are set up
23 #    so that each of the targets "all", "install", and "clean" each build
24 #    the subdirectories before the local target.  DIRS are guaranteed to be
25 #    built in order.
27 # 3. PARALLEL_DIRS - A list of subdirectories to be built, but that may be
28 #    built in any order.  All DIRS are built in order before PARALLEL_DIRS are
29 #    built, which are then built in any order.
31 # 4. Source - If specified, this sets the source code filenames.  If this
32 #    is not set, it defaults to be all of the .cpp, .c, .y, and .l files 
33 #    in the current directory.  Also, if you want to build files in addition
34 #    to the local files, you can use the ExtraSource variable
36 # 5. SourceDir - If specified, this specifies a directory that the source files
37 #    are in, if they are not in the current directory.  This should include a
38 #    trailing / character.
40 # 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree.
42 # 8. PROJ_SRC_DIR - The directory which contains the current set of Makefiles
43 #    and usually the source code too (unless SourceDir is set).
45 # 9. PROJ_SRC_ROOT - The root directory of the source code being compiled.
47 # 10. PROJ_OBJ_DIR - The directory where object code should be placed.
49 # 11. PROJ_OBJ_ROOT - The root directory for where object code should be
50 #     placed.
52 # For building,
53 #       LLVM, LLVM_SRC_ROOT = PROJ_SRC_ROOT
55 #===-----------------------------------------------------------------------====
58 # Set the VPATH so that we can find source files.
60 VPATH=$(SourceDir)
62 ###########################################################################
63 # Default Targets:
64 #       The following targets are the standard top level targets for
65 #       building.
66 ###########################################################################
68 # Ensure people re-run configure when it gets updated
69 ifeq ($(HAS_LLVM),1)
70 all::$(LLVM_OBJ_ROOT)/config.status
71 endif
73 ifdef SHARED_LIBRARY
74 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
75 all:: dynamic
76 install:: install-dynamic-library
77 endif
79 ifdef BYTECODE_LIBRARY
80 # if BYTECODE_LIBRARY is specified, the default is to build the bytecode lib
81 all:: bytecodelib
82 install:: install-bytecode-library
83 install-bytecode:: install-bytecode-library
84 endif
86 # Default Rule:  Make sure it's also a :: rule
87 all ::
89 # Default for install is to at least build everything...
90 install ::
92 # Default rule for test.  It ensures everything has a test rule
93 test::
95 # Default rule for building only bytecode.
96 bytecode::
98 # Default rule for installing only bytecode.
99 install-bytecode::
101 # Print out the directories used for building
102 prdirs::
103         @${ECHO} "Build Source Root: " $(PROJ_SRC_ROOT)
104         @${ECHO} "Build Source Dir : " $(PROJ_SRC_DIR)
105         @${ECHO} "Build Object Root: " $(PROJ_OBJ_ROOT)
106         @${ECHO} "Build Object Dir : " $(PROJ_OBJ_DIR)
107         @${ECHO} "LLVM  Source Root: " $(LLVM_SRC_ROOT)
108         @${ECHO} "LLVM  Object Root: " $(LLVM_OBJ_ROOT)
109         @${ECHO} "CONFIGURATION    : " $(CONFIGURATION)
111 ###########################################################################
112 # Suffixes and implicit rules:
113 #       Empty out the list of suffixes, generate a list that is only
114 #       used by this Makefile, and cancel useless implicit rules.   This
115 #       will hopefully speed up compilation a little bit.
116 ###########################################################################
117 .SUFFIXES:
118 .SUFFIXES: .c .cpp .h .hpp .y .l
119 .SUFFIXES: .lo .o .a $(SHLIBEXT) .bc .td
120 .SUFFIXES: .ps .dot .d
123 # Mark all of these targets as phony.  This will hopefully speed up builds
124 # slightly since GNU Make will not try to find implicit rules for targets
125 # which are marked as Phony.
127 .PHONY: all dynamic bytecodelib install-bytecode-library
128 .PHONY: clean distclean install test bytecode native prdirs dbg
130 ###########################################################################
131 # Miscellaneous paths and commands:
132 #       This section defines various configuration macros, such as where
133 #       to find burg, tblgen, and libtool.
134 ###########################################################################
136 #--------------------------------------------------------------------
137 # Variables derived from configuration options... 
138 #--------------------------------------------------------------------
140 ifeq ($(ENABLE_PROFILING),1)
141   ENABLE_OPTIMIZED = 1
142 endif
144 ifeq ($(ENABLE_OPTIMIZED),1)
145   CONFIGURATION := Release
146   ifdef DEBUG_SYMBOLS
147     CONFIGURATION := $(CONFIGURATION)+Debug
148   endif
149 else
150   CONFIGURATION := Debug
151 endif
153 ifeq ($(ENABLE_PROFILING),1)
154   CONFIGURATION := $(CONFIGURATION)+Profile
155 endif
157 # We cleverly reversed the sense of this variable in r107758, support use of
158 # LLVM_RELEASE_IS_PLUS_ASSERTS to allow testing old LLVM revs. We can eliminate
159 # this when we kill the dependency on LLVM's Makefiles.
160 ifeq ($(LLVM_RELEASE_IS_PLUS_ASSERTS),1)
162 ifeq ($(DISABLE_ASSERTIONS),1)
163   CONFIGURATION := $(CONFIGURATION)-Asserts
164 endif
166 else
168 # Unless DISABLE_ASSERTIONS=1 is specified (make command line or configured),
169 # adjust the CONFIGURATION name appropriately (to match LLVM makefiles)
170 ifneq ($(DISABLE_ASSERTIONS),1)
171   CONFIGURATION := $(CONFIGURATION)+Asserts
172 endif
174 endif
176 # If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
177 # configured), then adjust the CONFIGURATION name appropriately
178 # (to match LLVM makefiles)
179 ifeq ($(ENABLE_EXPENSIVE_CHECKS),1)
180   CONFIGURATION := $(CONFIGURATION)+Checks
181 endif
184 # Enable this for profiling support with 'gprof'
185 # This automatically enables optimized builds.
187 ifeq ($(ENABLE_PROFILING),1)
188   PROFILE = -pg
189 endif
191 ###########################################################################
192 # Library Locations:
193 #       These variables describe various library locations:
195 #       DEST* = Location of where libraries that are built will be placed.
196 #       LLVM* = Location of LLVM libraries used for linking.
197 #       PROJ* = Location of previously built libraries used for linking.
198 ###########################################################################
200 # Libraries that are being built
201 DESTLIBDEBUG    := $(PROJ_OBJ_ROOT)/Debug/lib
202 DESTLIBRELEASE  := $(PROJ_OBJ_ROOT)/Release/lib
203 DESTLIBPROFILE  := $(PROJ_OBJ_ROOT)/Profile/lib
204 DESTLIBBYTECODE := $(PROJ_OBJ_ROOT)/BytecodeLibs/lib
205 DESTLIBCURRENT  := $(PROJ_OBJ_ROOT)/$(CONFIGURATION)/lib
207 # LLVM libraries used for linking
208 LLVMLIBDEBUGSOURCE    := $(LLVM_OBJ_ROOT)/Debug/lib
209 LLVMLIBRELEASESOURCE  := $(LLVM_OBJ_ROOT)/Release/lib
210 LLVMLIBPROFILESOURCE  := $(LLVM_OBJ_ROOT)/Profile/lib
211 LLVMLIBCURRENTSOURCE  := $(LLVM_OBJ_ROOT)/$(CONFIGURATION)/lib
213 # Libraries that were built that will now be used for linking
214 PROJLIBDEBUGSOURCE    := $(PROJ_OBJ_ROOT)/Debug/lib
215 PROJLIBRELEASESOURCE  := $(PROJ_OBJ_ROOT)/Release/lib
216 PROJLIBPROFILESOURCE  := $(PROJ_OBJ_ROOT)/Profile/lib
217 PROJLIBCURRENTSOURCE  := $(PROJ_OBJ_ROOT)/$(CONFIGURATION)/lib
219 ###########################################################################
220 # Tool Locations
221 #       These variables describe various tool locations:
223 #       DEST* = Location of where tools that are built will be placed.
224 #       LLVM* = Location of LLVM tools used for building.
225 #       PROJ* = Location of previously built tools used for linking.
226 ###########################################################################
228 DESTTOOLDEBUG   := $(PROJ_OBJ_ROOT)/Debug/bin
229 DESTTOOLRELEASE := $(PROJ_OBJ_ROOT)/Release/bin
230 DESTTOOLPROFILE := $(PROJ_OBJ_ROOT)/Profile/bin
231 DESTTOOLCURRENT := $(PROJ_OBJ_ROOT)/$(CONFIGURATION)/bin
233 LLVMTOOLDEBUG   := $(LLVM_OBJ_ROOT)/Debug/bin
234 LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/Release/bin
235 LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/Profile/bin
236 LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/$(CONFIGURATION)/bin
238 PROJTOOLDEBUG   := $(PROJ_OBJ_ROOT)/Debug/bin
239 PROJTOOLRELEASE := $(PROJ_OBJ_ROOT)/Release/bin
240 PROJTOOLPROFILE := $(PROJ_OBJ_ROOT)/Profile/bin
241 PROJTOOLCURRENT := $(PROJ_OBJ_ROOT)/$(CONFIGURATION)/bin
244 # Libtool is found in the current directory.
246 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
249 # If we're not building a shared library, use the disable-shared tag with
250 # libtool.  This will disable the building of objects for shared libraries and
251 # only generate static library objects.
253 # For dynamic libraries, we'll take the performance hit for now, since we
254 # almost never build them.
256 # This should speed up compilation and require no modifications to future
257 # versions of libtool.
259 ifndef SHARED_LIBRARY
260 LIBTOOL += --tag=disable-shared
261 endif
264 # Verbosity levels
266 ifndef VERBOSE
267 VERB := @
268 LIBTOOL += --silent
269 endif
271 #--------------------------------------------------------------------
272 # LLVM Capable Compiler
273 #--------------------------------------------------------------------
275 # FIXME: We shouldn't need to duplicate this from LLVM's Makefile.rules.
277 ifeq ($(LLVMCC_OPTION),llvm-gcc)
278   LLVMCC := $(LLVMGCC)
279   LLVMCXX := $(LLVMGXX)
280 else
281   ifeq ($(LLVMCC_OPTION),clang)
282     ifneq ($(CLANGPATH),)
283       LLVMCC := $(CLANGPATH)
284       LLVMCXX := $(CLANGXXPATH)
285     else
286       ifeq ($(ENABLE_BUILT_CLANG),1)
287         LLVMCC := $(LLVMTOOLCURRENT)/clang
288         LLVMCXX := $(LLVMTOOLCURRENT)/clang++
289       endif
290     endif
291   else
292     # Compatibility with older LLVM checkouts.
293     LLVMCC := $(LLVMGCC)
294     LLVMCXX := $(LLVMGXX)
295   endif
296 endif
298 ###########################################################################
299 # Miscellaneous paths and commands (part deux):
300 #       This section defines various configuration macros, such as where
301 #       to find burg, tblgen, and libtool.
302 ###########################################################################
304 #--------------------------------------------------------------------------
305 # The compiled LLVM tools
308 LLVMAS  := $(LLVMTOOLCURRENT)/llvm-as$(EXEEXT)
309 # LLVM Tool Definitions (LLVMGCC, LLVMGXX, LLVMAS are provided by
310 # Makefile.rules) 
311 LLI       = $(LLVMTOOLCURRENT)/lli$(EXEEXT)
312 LLC       = $(LLVMTOOLCURRENT)/llc$(EXEEXT)
313 LLVMLD    = $(LLVMTOOLCURRENT)/llvm-ld$(EXEEXT)
314 LDIS      = $(LLVMTOOLCURRENT)/llvm-dis$(EXEEXT)
315 LOPT      = $(LLVMTOOLCURRENT)/opt$(EXEEXT)
316 LLINK     = $(LLVMTOOLCURRENT)/llvm-link$(EXEEXT)
317 LPROF     = $(LLVMTOOLCURRENT)/llvm-prof$(EXEEXT)
318 LBUGPOINT = $(LLVMTOOLCURRENT)/bugpoint$(EXEEXT)
319 LFINDMISOPT= $(LLVM_SRC_ROOT)/utils/findmisopt
321 ifeq ($(HAS_LLVM),1)
322 FPCMP     = $(LLVMTOOLCURRENT)/fpcmp
323 else
324 FPCMP     = $(PROJ_OBJ_ROOT)/tools/fpcmp
325 endif
327 ifeq ($(HAS_LLVM),0)
328 # Not strictly related to HAS_LLVM, but otherwise in generally tools weren't
329 # being built.
330 TIMEIT    = $(PROJ_OBJ_ROOT)/tools/timeit
331 endif
333 LCC := $(LLVMCC)
334 LCXX := $(LLVMCXX)
336 # FIXME: Fix these dependencies for Clang, and for overridden TARGET_LLVMGCC.
337 LCC_PROGRAMS :=
338 ifeq ($(LLVMCC_OPTION),llvm-gcc)
339   LCC_PROGRAMS += $(LLVMCC1) $(LLVMCC1PLUS)
340 endif
343 ###########################################################################
344 # Compile Time Flags
345 ###########################################################################
348 # Include both the project headers and the LLVM headers for compilation and
349 # dependency computation.
351 # PROJ_OBJ_DIR          : Files local to the particular object directory
352 #                          (locallly generated header files).
353 # PROJ_SRC_DIR          : Files local to the particular source directory.
354 # PROJ_SRC_ROOT/include : Files global to the project.
355 # LLVM_OBJ_ROOT/include  : config.h files generated by autoconf
356 # LEVEL/include          : config.h files for the project
357 # LLVM_SRC_ROOT/include  : Files global to LLVM.
359 CPPFLAGS += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
360             -I$(PROJ_SRC_ROOT)/include -I$(LEVEL)/include
361 ifeq ($(HAS_LLVM),1)
362 CPPFLAGS += -I$(LLVM_OBJ_ROOT)/include -I$(LLVM_SRC_ROOT)/include
363 endif
365 # By default, strip symbol information from executable
366 ifndef KEEP_SYMBOLS
367 STRIP = $(PLATFORMSTRIPOPTS)
368 STRIP_WARN_MSG = "(without symbols)"
369 endif
371 # Allow GNU extensions:
372 CPPFLAGS += -D_GNU_SOURCE
373 # Pull in limit macros from stdint.h, even in C++:
374 CPPFLAGS += -D__STDC_LIMIT_MACROS
375 CPPFLAGS += -DNDEBUG
377 # Default optimization level:
378 OPTFLAGS := -O3
380 # If LTO is on, compile each .c .cpp file with -mllvm -disable-llvm-optzns.
381 # This is similar to -O0, except it just disables optimizations and doesn't
382 # change the behavior of the front-end. Optimization will be done separately
383 # with opt and llvm-ld.
384 ifdef DISABLE_LTO
385 LOPTFLAGS := $(OPTFLAGS)
386 else
387 LOPTFLAGS := $(OPTFLAGS) $(LLVMCC_DISABLEOPT_FLAGS)
388 endif
390 # Explicitly specify -m32 / -m64 so there is no mismatch between llvm-gcc
391 # default and system compiler default.
392 ifeq ($(ARCH),x86)
393 TEST_TARGET_FLAGS += -m32
394 endif
396 ifeq ($(ARCH),x86_64)
397 TEST_TARGET_FLAGS += -m64
398 endif
400 ifeq ($(ARCH),Alpha)
401 CPPFLAGS += -mieee
402 CFLAGS += -mieee
403 endif
405 # Set llc / lli optimization level
406 LLC_OPTFLAGS := $(OPTFLAGS)
407 LLI_OPTFLAGS := $(OPTFLAGS)
409 # gcc / llvm-gcc default is -fPIC -fno-omit-frame-pointer
410 # llc / lli default is equal to -mdynamic-no-pic -fomit-frame-pointer
411 ifdef PIC_CODEGEN
412 TARGET_LLCFLAGS += -relocation-model=pic -disable-fp-elim
413 TARGET_LLIFLAGS += -relocation-model=pic -disable-fp-elim
414   ifeq ($(TARGET_OS),Darwin)
415     TARGET_LLIFLAGS += -code-model=small
416   endif
417 else
418 TEST_TARGET_FLAGS += -fomit-frame-pointer
419   ifeq ($(TARGET_OS),Darwin)
420   TEST_TARGET_FLAGS += -mdynamic-no-pic
421   endif
422 endif
424 ifdef EXTRA_OPTIONS
425 TEST_TARGET_FLAGS += $(EXTRA_OPTIONS)
426 endif
428 ifdef SMALL_PROBLEM_SIZE
429 CPPFLAGS += -DSMALL_PROBLEM_SIZE
430 endif
432 ifdef DISABLE_LTO
433 EXTRA_LOPT_OPTIONS += -disable-opt
434 EXTRA_LINKTIME_OPT_FLAGS += -disable-opt
435 endif
438 # Compile commands with libtool.
440 Compile  := $(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS)
441 CompileC  := $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS)
443 # Compile a cpp file, don't link...
444 CompileG := $(Compile) -g  -D_DEBUG
445 CompileO := $(Compile) $(OPTFLAGS) -felide-constructors -fomit-frame-pointer
446 CompileP := $(Compile) $(OPTFLAGS) -felide-constructors $(PROFILE)
448 # Compile a c file, don't link...
449 CompileCG := $(CompileC) -g  -D_DEBUG
450 CompileCO := $(CompileC) $(OPTFLAGS) -fomit-frame-pointer
451 CompileCP := $(CompileC) $(OPTFLAGS) $(PROFILE)
453 ###########################################################################
454 # Link Time Options
455 ###########################################################################
458 # Link final executable
459 #       (Note that we always link with the C++ compiler).
461 Link     := $(LIBTOOL) --tag=CXX --mode=link $(CXX)
463 # link both projlib and llvmlib libraries
464 LinkG    := $(Link) -g -L$(PROJLIBDEBUGSOURCE)  -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
465 LinkO    := $(Link) $(OPTFLAGS) -L$(PROJLIBRELEASESOURCE) -L$(LLVMLIBRELEASESOURCE)
466 LinkP    := $(Link) $(OPTFLAGS) -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
468 # TOOLLINKOPTSB to pass options to the linker like library search path etc
469 # Note that this is different from TOOLLINKOPTS, these options
470 # are passed to the linker *before* the USEDLIBS options are passed.
471 # e.g. usage TOOLLINKOPTSB =  -L/home/xxx/lib
472 ifdef TOOLLINKOPTSB
473 LinkG    := $(LinkG) $(TOOLLINKOPTSB) 
474 LinkO    := $(LinkO) $(TOOLLINKOPTSB) 
475 LinkP    := $(LinkP) $(TOOLLINKOPTSB) 
476 endif
478 # Create one .o file from a bunch of .o files...
479 Relink := ${LIBTOOL} --tag=CXX --mode=link $(CXX)
482 # Configure where the item being compiled should go.
484 ifdef SHARED_LIBRARY
485 Link += -rpath $(DESTLIBCURRENT)
486 endif
488 ifdef TOOLNAME
489 Link += -rpath $(DESTTOOLCURRENT)
490 endif
492 # Create dependency file from CPP file, send to stdout.
493 Depend   := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS) 
494 DependC  := $(CC)  -MM -I$(LEVEL)/include $(CPPFLAGS) 
496 # Archive a bunch of .o files into a .a file...
497 AR       = $(AR_PATH) cr
499 #----------------------------------------------------------
501 # Source includes all of the cpp files, and objects are derived from the
502 # source files...
503 # The local Makefile can list other Source files via ExtraSource = ...
505 ifndef Source
506 Source  := $(notdir $(ExtraSource) $(wildcard $(SourceDir)/*.cpp \
507                     $(SourceDir)/*.cc $(SourceDir)/*.c $(SourceDir)/*.y \
508                     $(SourceDir)/*.l $(SourceDir)/*.m $(SourceDir)/*.mm))
509 endif
512 # Libtool Objects
514 Srcs := $(sort $(basename $(Source)))
515 ObjectsO  := $(Srcs:%=$(PROJ_OBJ_DIR)/Release/%.lo)
516 ObjectsP  := $(Srcs:%=$(PROJ_OBJ_DIR)/Profile/%.lo)
517 ObjectsG  := $(Srcs:%=$(PROJ_OBJ_DIR)/Debug/%.lo)
518 ObjectsBC := $(Srcs:%=$(PROJ_OBJ_DIR)/BytecodeObj/%.bc)
521 # The real objects underlying the libtool objects
523 RObjs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source)))))
524 RObjectsO := $(addprefix $(PROJ_OBJ_DIR)/Release/,$(RObjs))
525 RObjectsP := $(addprefix $(PROJ_OBJ_DIR)/Profile/,$(RObjs))
526 RObjectsG := $(addprefix $(PROJ_OBJ_DIR)/Debug/,$(RObjs))
528 #---------------------------------------------------------
529 # Handle the DIRS and PARALLEL_DIRS options
530 #---------------------------------------------------------
532 ifdef DIRS
533 all install clean test bytecode native stripped-bytecode install-bytecode::
534         $(VERB) for dir in ${DIRS}; do \
535                 if [ ! -f $$dir/Makefile ]; \
536                 then \
537                         $(MKDIR) $$dir; \
538                         cp $(SourceDir)/$$dir/Makefile $$dir/Makefile; \
539                 fi; \
540                 ($(MAKE) -C $$dir $@ $(MFLAGS)) || exit 1; \
541         done
542 endif
544 # Handle PARALLEL_DIRS
545 ifdef PARALLEL_DIRS
546 all      :: $(addsuffix /.makeall     , $(PARALLEL_DIRS))
547 install  :: $(addsuffix /.makeinstall , $(PARALLEL_DIRS))
548 clean    :: $(addsuffix /.makeclean   , $(PARALLEL_DIRS))
549 test     :: $(addsuffix /.maketest    , $(PARALLEL_DIRS))
550 bytecode :: $(addsuffix /.makebytecode, $(PARALLEL_DIRS))
551 native   :: $(addsuffix /.makenative, $(PARALLEL_DIRS))
552 stripped-bytecode :: $(addsuffix /.makestripped-bytecode, $(PARALLEL_DIRS))
553 install-bytecode :: $(addsuffix /.makeinstall-bytecode, $(PARALLEL_DIRS))
555 %/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode \
556 %/.makestripped-bytecode %/.makeinstall-bytecode %/.makenative:
557         $(VERB) if [ ! -f $(@D)/Makefile ]; \
558         then \
559                 $(MKDIR) $(@D); \
560                 cp $(SourceDir)/$(@D)/Makefile $(@D)/Makefile; \
561         fi; \
562         $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) $(MFLAGS)
563 endif
565 # Handle directories that may or may not exist
566 ifdef OPTIONAL_DIRS
567 all install clean test bytecode stripped-bytecode install-bytecode::
568         $(VERB) for dir in ${OPTIONAL_DIRS}; do \
569                 if [ -d $(SourceDir)/$$dir ]; \
570                 then\
571                         if [ ! -f $$dir/Makefile ]; \
572                         then \
573                                 $(MKDIR) $$dir; \
574                                 cp $(SourceDir)/$$dir/Makefile $$dir/Makefile; \
575                         fi; \
576                         ($(MAKE) -C$$dir $@ $(MFLAGS)) || exit 1; \
577                 fi \
578         done
579 endif
581 #---------------------------------------------------------
582 # Handle the CONFIG_FILES options
583 #---------------------------------------------------------
584 ifdef CONFIG_FILES
585 install:: install-config-files
587 $(sysconfdir):
588         $(MKDIR) $(sysconfdir)
590 install-config-files: $(sysconfdir) $(CONFIG_FILES)
591         $(VERB)$(ECHO) Installing Configuration Files To $(sysconfdir)
592         $(VERB)for file in $(CONFIG_FILES); do \
593                 $(INSTALL) $(SourceDir)/$${file} $(sysconfdir) ; \
594         done
595 endif
597 ###########################################################################
598 # Library Build Rules:
600 #---------------------------------------------------------
601 # Handle the LIBRARYNAME option - used when building libs...
602 #---------------------------------------------------------
604 #  When libraries are built, they are allowed to optionally define the
605 #  DONT_BUILD_RELINKED make variable, which, when defined, prevents a .o file
606 #  from being built for the library. This .o files may then be linked to by a
607 #  tool if the tool does not need (or want) the semantics a .a file provides
608 #  (linking in only object files that are "needed").  If a library is never to
609 #  be used in this way, it is better to define DONT_BUILD_RELINKED, and define
610 #  BUILD_ARCHIVE instead.
612 ###########################################################################
614 # Install rule for making bytecode library directory if it does not exist.
615 # Trigger this by making libraries that need to be installed here depend on it.
616 $(DESTDIR)$(bytecode_libdir):
617         $(MKDIR) $@
619 ifdef LIBRARYNAME
621 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
622 LIBRARYNAME := $(strip $(LIBRARYNAME))
624 LIBNAME_O    := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).la
625 LIBNAME_P    := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).la
626 LIBNAME_G    := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).la
627 LIBNAME_CUR  := $(DESTLIBCURRENT)/lib$(LIBRARYNAME).la
628 LIBNAME_AO   := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a
629 LIBNAME_AP   := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a
630 LIBNAME_AG   := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a
631 LIBNAME_ACUR := $(DESTLIBCURRENT)/lib$(LIBRARYNAME).a
632 LIBNAME_OBJO := $(DESTLIBRELEASE)/$(LIBRARYNAME).o
633 LIBNAME_OBJP := $(DESTLIBPROFILE)/$(LIBRARYNAME).o
634 LIBNAME_OBJG := $(DESTLIBDEBUG)/$(LIBRARYNAME).o
635 LIBNAME_OBJCUR := $(DESTLIBCURRENT)/$(LIBRARYNAME).o
636 LIBNAME_BC   := $(DESTLIBBYTECODE)/lib$(LIBRARYNAME).bc
639 #--------------------------------------------------------------------
640 # Library Targets
641 #       Modify the top level targets to build the desired libraries.
642 #--------------------------------------------------------------------
644 # dynamic target builds a shared object version of the library...
645 dynamic:: $(LIBNAME_CUR)
646 bytecodelib:: $(LIBNAME_BC)
647 install-bytecode-library:: $(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc
649 $(DESTDIR)$(bytecode_libdir)/lib$(LIBRARYNAME).bc: $(LIBNAME_BC) $(DESTDIR)$(bytecode_libdir)
650         @${ECHO} ======= Installing $(LIBRARYNAME) bytecode library =======
651         $(VERB)cp $< $@
653 # Does the library want a .o version built?
654 ifndef DONT_BUILD_RELINKED
655 all:: $(LIBNAME_OBJCUR)
656 install:: install-single-object-library
657 endif
659 # Does the library want an archive version built?
660 ifdef BUILD_ARCHIVE
661 all:: $(LIBNAME_ACUR)
662 install:: install-archive-library
663 endif
665 #--------------------------------------------------------------------
666 # Rules for building libraries
667 #--------------------------------------------------------------------
669 LinkBCLib := $(LCC) -shared -nostdlib
670 ifdef EXPORTED_SYMBOL_LIST
671 LinkBCLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
672 else
673   ifdef EXPORTED_SYMBOL_FILE
674 LinkBCLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
675   else
676 LinkBCLib += -Xlinker -disable-internalize
677   endif
678 endif
681 # Rule for building bytecode libraries.
682 $(LIBNAME_BC): $(ObjectsBC) $(LibSubDirs) $(DESTLIBBYTECODE)/.dir
683         @${ECHO} Linking $(LIBRARYNAME) bytecode library
684         $(VERB) $(LinkBCLib) -o $@ $(ObjectsBC) $(LibSubDirs) $(LibLinkOpts)
685         @${ECHO} ======= Finished building $(LIBRARYNAME) bytecode library =======
687 # Rules for building dynamically linked libraries.
689 $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
690         @${ECHO} Linking $(LIBRARYNAME) dynamic release library
691         $(VERB) $(Link) -o $@ $(ObjectsO) $(LibSubDirs) $(LibLinkOpts)
692         $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $@ $(DESTLIBCURRENT)
693         @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic release library =======
695 $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
696         @${ECHO} Linking $(LIBRARYNAME) dynamic profile library
697         $(VERB) $(Link) -o $@ $(ObjectsP) $(LibSubDirs) $(LibLinkOpts)
698         $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $@ $(DESTLIBCURRENT)
699         @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic profile library =======
701 $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
702         @${ECHO} Linking $(LIBRARYNAME) dynamic debug library
703         $(VERB) $(Link) -o $@ $(ObjectsG) $(LibSubDirs) $(LibLinkOpts)
704         $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $@ $(DESTLIBCURRENT)
705         @${ECHO} ======= Finished building $(LIBRARYNAME) dynamic debug library =======
707 install-dynamic-library: $(LIBNAME_CUR)
708         $(MKDIR) $(DESTDIR)$(libdir)
709         $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_CUR) $(DESTDIR)$(libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
710         $(VERB) $(LIBTOOL) --finish $(DESTDIR)$(libdir)
713 # Rules for building static archive libraries.
715 $(LIBNAME_AO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
716         @${ECHO} Linking $(LIBRARYNAME) archive release library
717         $(VERB)$(RM) -f $@
718         $(VERB) $(Link) -03 -o $@ $(ObjectsO) $(LibSubDirs) -static
719         @${ECHO} Finished building $(LIBRARYNAME) archive release library =======
721 $(LIBNAME_AP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
722         @${ECHO} Linking $(LIBRARYNAME) archive profile library
723         @$(RM) -f $@
724         $(VERB) $(Link) -03 $(PROFILE) -o $@ $(ObjectsP) $(LibSubDirs) -static
725         @${ECHO} ======= Finished building $(LIBRARYNAME) archive profile library =======
727 $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
728         @${ECHO} Linking $(LIBRARYNAME) archive debug library
729         @$(RM) -f $@
730         $(VERB) $(Link) -g $(STRIP) -o $@ $(ObjectsG) $(LibSubDirs) -static
731         @${ECHO} ======= Finished building $(LIBRARYNAME) archive debug library =======
733 install-archive-library: $(LIBNAME_ACUR)
734         $(MKDIR) $(DESTDIR)$(libdir)
735         $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_ACUR) $(DESTDIR)$(libdir)/lib$(LIBRARYNAME).a
738 # Rules for building .o libraries.
740 #       JTC:
741 #       Note that for this special case, we specify the actual object files
742 #       instead of their libtool counterparts.  This is because libtool
743 #       doesn't want to generate a reloadable object file unless it is given
744 #       .o files explicitly.
746 #       Note that we're making an assumption here: If we build a .lo file,
747 #       its corresponding .o file will be placed in the same directory.
749 #       I think that is safe.
751 $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
752         @${ECHO} "Linking `basename $@`"
753         $(VERB) $(Relink) -o $@ $(RObjectsO) $(LibSubDirs)
755 $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
756         @${ECHO} "Linking `basename $@`"
757         $(VERB) $(Relink) -o $@ $(RObjectsP) $(LibSubDirs)
759 $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
760         @${ECHO} "Linking `basename $@`"
761         $(VERB) $(Relink) -o $@ $(RObjectsG) $(LibSubDirs)
763 install-single-object-library: $(LIBNAME_OBJCUR)
764         $(MKDIR) $(DESTDIR)$(libdir)
765         $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $(LIBNAME_OBJCUR) $(DESTDIR)$(libdir)/$(LIBRARYNAME).o
767 endif
769 #------------------------------------------------------------------------
770 # Handle the TOOLNAME option - used when building tool executables...
771 #------------------------------------------------------------------------
773 # The TOOLNAME option should be used with a USEDLIBS variable that tells the
774 # libraries (and the order of the libs) that should be linked to the
775 # tool. USEDLIBS should contain a list of library names (some with .a extension)
776 # that are automatically linked in as .o files unless the .a suffix is added.
778 ifdef TOOLNAME
780 # Handle compression libraries automatically
781 ifeq ($(HAVE_BZIP2),1)
782 TOOLLINKOPTS += -lbz2
783 endif
784 ifeq ($(HAVE_ZLIB),1)
785 TOOLLINKOPTS += -lz
786 endif
787 # TOOLEXENAME* - These compute the output filenames to generate...
788 TOOLEXENAME_G := $(DESTTOOLDEBUG)/$(TOOLNAME)
789 TOOLEXENAME_O := $(DESTTOOLRELEASE)/$(TOOLNAME)
790 TOOLEXENAME_P := $(DESTTOOLPROFILE)/$(TOOLNAME)
791 TOOLEXENAMES  := $(DESTTOOLCURRENT)/$(TOOLNAME)
793 # USED_LIBS_OPTIONS - Compute the options line that add -llib1 -llib2, etc.
794 PROJ_LIBS_OPTIONS   := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
795 PROJ_LIBS_OPTIONS_G := $(patsubst %.o, $(PROJLIBDEBUGSOURCE)/%.o,  $(PROJ_LIBS_OPTIONS))
796 PROJ_LIBS_OPTIONS_O := $(patsubst %.o, $(PROJLIBRELEASESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
797 PROJ_LIBS_OPTIONS_P := $(patsubst %.o, $(PROJLIBPROFILESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
799 LLVM_LIBS_OPTIONS   := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
800 LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o,  $(LLVM_LIBS_OPTIONS))
801 LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
802 LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
804 LIB_OPTS_G :=  $(LLVM_LIBS_OPTIONS_G) $(PROJ_LIBS_OPTIONS_G)
805 LIB_OPTS_O :=  $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_O)
806 LIB_OPTS_P :=  $(LLVM_LIBS_OPTIONS_P) $(PROJ_LIBS_OPTIONS_P)
808 # USED_LIB_PATHS - Compute the path of the libraries used so that tools are
809 # rebuilt if libraries change.  This has to make sure to handle .a/.so and .o
810 # files separately.
812 STATICUSEDLIBS   := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
813 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
814 USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS))
815 USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS))
817 LLVMSTATICUSEDLIBS   := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
818 LLVM_LIB_PATHS_G := $(addprefix $(LLVMLIBDEBUGSOURCE)/, $(LLVMSTATICUSEDLIBS))
819 LLVM_LIB_PATHS_O := $(addprefix $(LLVMLIBRELEASESOURCE)/, $(LLVMSTATICUSEDLIBS))
820 LLVM_LIB_PATHS_P := $(addprefix $(LLVMLIBPROFILESOURCE)/, $(LLVMSTATICUSEDLIBS))
823 # Libtool link options:
824 #       Ensure that all binaries have their symbols exported so that they can
825 #       by dlsym'ed.
827 LINK_OPTS := -export-dynamic $(TOOLLINKOPTS)
833 # Tell make that we need to rebuild subdirectories before we can link the tool.
834 # This affects things like LLI which has library subdirectories.
835 $(USED_LIB_PATHS_G) $(USED_LIB_PATHS_O) $(USED_LIB_PATHS_P): \
836         $(addsuffix /.makeall, $(PARALLEL_DIRS))
838 all::   $(TOOLEXENAMES)
840 clean::
841         $(VERB) $(RM) -f $(TOOLEXENAMES)
843 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(LLVM_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
844         @${ECHO} Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)
845         $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) $(LIBS)
846         @${ECHO} ======= Finished building $(TOOLNAME) debug executable $(STRIP_WARN_MSG) =======
848 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(LLVM_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir
849         @${ECHO} Linking $(TOOLNAME) release executable
850         $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS) $(LIBS)
851         @${ECHO} ======= Finished building $(TOOLNAME) release executable =======
853 $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(LLVM_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir
854         @${ECHO} Linking $(TOOLNAME) profile executable
855         $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS) $(LIBS)
856         @${ECHO} ======= Finished building $(TOOLNAME) profile executable =======
858 install:: $(TOOLEXENAMES)
859         @${ECHO} Installing $(TOOLEXENAMES) to $(DESTDIR)$(bindir)
860         $(VERB)$(MKDIR) $(DESTDIR)$(bindir)
861         $(VERB)$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) -c -m 0755 $(TOOLEXENAMES) $(DESTDIR)$(bindir)/$(TOOLNAME)
863 endif
865 #---------------------------------------------------------
866 .PRECIOUS: $(PROJ_OBJ_DIR)/Depend/.dir $(PROJ_OBJ_DIR)/BytecodeObj/.dir
867 .PRECIOUS: $(PROJ_OBJ_DIR)/Debug/.dir $(PROJ_OBJ_DIR)/Release/.dir
868 .PRECIOUS: $(PROJ_OBJ_DIR)/Profile/.dir
870 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
871 $(PROJ_OBJ_DIR)/Release/%.lo: %.cpp $(PROJ_OBJ_DIR)/Release/.dir
872         $(CompileO) $< -o $@
874 $(PROJ_OBJ_DIR)/Release/%.lo: %.c $(PROJ_OBJ_DIR)/Release/.dir
875         $(CompileCO) $< -o $@
877 $(PROJ_OBJ_DIR)/Profile/%.lo: %.cpp $(PROJ_OBJ_DIR)/Profile/.dir
878         $(CompileP) $< -o $@
880 $(PROJ_OBJ_DIR)/Profile/%.lo: %.c $(PROJ_OBJ_DIR)/Profile/.dir
881         $(CompileCP) $< -o $@
883 $(PROJ_OBJ_DIR)/Debug/%.lo: %.cpp $(PROJ_OBJ_DIR)/Debug/.dir
884         $(CompileG) $< -o $@
886 $(PROJ_OBJ_DIR)/Debug/%.lo: %.c $(PROJ_OBJ_DIR)/Debug/.dir 
887         $(CompileCG) $< -o $@
889 $(PROJ_OBJ_DIR)/BytecodeObj/%.bc: %.cpp $(PROJ_OBJ_DIR)/BytecodeObj/.dir $(LCC_PROGRAMS)
890         $(LCXX) $(CPPFLAGS) -c $< -o $@
892 $(PROJ_OBJ_DIR)/BytecodeObj/%.bc: %.c $(PROJ_OBJ_DIR)/BytecodeObj/.dir $(LCC_PROGRAMS)
893         $(LCC) $(CPPFLAGS) -c $< -o $@
895 $(PROJ_OBJ_DIR)/BytecodeObj/%.bc: %.ll $(PROJ_OBJ_DIR)/BytecodeObj/.dir $(LLVMAS)
896         $(LLVMAS) $< -o $@
900 # Rules for building lex/yacc files
902 LEX_FILES   = $(filter %.l, $(Source))
903 LEX_OUTPUT  = $(LEX_FILES:%.l=%.cpp)
904 YACC_FILES  = $(filter %.y, $(Source))
905 YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
906 .PRECIOUS: $(LEX_OUTPUT) $(YACC_OUTPUT)
908 # Create a .cpp source file from a flex input file... this uses sed to cut down
909 # on the warnings emited by GCC...
911 # The last line is a gross hack to work around flex aparently not being able to
912 # resize the buffer on a large token input.  Currently, for uninitialized string
913 # buffers in LLVM we can generate very long tokens, so this is a hack around it.
914 # FIXME.  (f.e. char Buffer[10000] )
916 %.cpp: %.l
917         @${ECHO} Flexing $<
918         $(VERB) $(FLEX) -t $< | \
919           $(SED) '/^find_rule/d' | \
920           $(SED) 's/void yyunput/inline void yyunput/' | \
921           $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
922           $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
923               > $@.tmp
924         $(VERB) cmp -s $@ $@.tmp > /dev/null || ${MV} -f $@.tmp $@
925         @# remove the output of flex if it didn't get moved over...
926         @rm -f $@.tmp
928 # Rule for building the bison parsers...
929 %.c: %.y     # Cancel built-in rules for yacc
930 %.h: %.y     # Cancel built-in rules for yacc
931 %.cpp %.h : %.y
932         @${ECHO} "Bisoning `basename $<`"
933         $(VERB) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c  $<
934         $(VERB) cmp -s $*.tab.c $*.cpp > /dev/null || ${MV} -f $*.tab.c $*.cpp
935         $(VERB) cmp -s $*.tab.h $*.h   > /dev/null || ${MV} -f $*.tab.h $*.h
936         @# If the files were not updated, don't leave them lying around...
937         @rm -f $*.tab.c $*.tab.h
939 # To create the directories...
940 %/.dir:
941         $(VERB) ${MKDIR} $* > /dev/null
942         @$(DATE) > $@
944 # To create postscript files from dot files...
945 ifneq ($(DOT),false)
946 %.ps: %.dot
947         ${DOT} -Tps < $< > $@
948 else
949 %.ps: %.dot
950         ${ECHO} "Cannot build $@: The program dot is not installed"
951 endif
954 # This rules ensures that header files that are removed still have a rule for
955 # which they can be "generated."  This allows make to ignore them and
956 # reproduce the dependency lists.
958 %.h:: ;
960 # 'make clean' nukes the tree
961 clean::
962         $(VERB) $(RM) -rf $(PROJ_OBJ_DIR)/Debug $(PROJ_OBJ_DIR)/Release
963         $(VERB) $(RM) -rf $(PROJ_OBJ_DIR)/Profile $(PROJ_OBJ_DIR)/Depend
964         $(VERB) $(RM) -rf $(PROJ_OBJ_DIR)/BytecodeObj
965         $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *~ *.flc
966 ifneq ($(strip $(SHLIBEXT)),) # Extra paranoia - make real sure SHLIBEXT is set
967         $(VERB) $(RM) -f *$(SHLIBEXT)
968 endif
969         $(VERB) $(RM) -f $(LEX_OUTPUT) $(YACC_OUTPUT)
971 ###########################################################################
972 # C/C++ Dependencies
973 #       Define variables and rules that generate header file dependencies
974 #       from C/C++ source files.
975 ###########################################################################
977 ifndef DISABLE_AUTO_DEPENDENCIES
979 # If dependencies were generated for the file that included this file,
980 # include the dependencies now...
982 SourceBaseNames := $(basename $(Source))
983 SourceDepend := $(SourceBaseNames:%=$(PROJ_OBJ_DIR)/Depend/%.d)
985 # Create dependencies for the *.cpp files...
986 $(PROJ_OBJ_DIR)/Depend/%.d: %.cpp $(PROJ_OBJ_DIR)/Depend/.dir
987         $(VERB) $(Depend) $< | $(SED) 's|\.o:|\.lo:|' | $(SED) 's|$*\.lo *|$(PROJ_OBJ_DIR)/Release/& $(PROJ_OBJ_DIR)/Profile/& $(PROJ_OBJ_DIR)/Debug/& $(PROJ_OBJ_DIR)/Depend/$(@F)|g' > $@
989 # Create dependencies for the *.c files...
990 $(PROJ_OBJ_DIR)/Depend/%.d: %.c $(PROJ_OBJ_DIR)/Depend/.dir
991         $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o:|\.lo:|' | $(SED) 's|$*\.lo *|$(PROJ_OBJ_DIR)/Release/& $(PROJ_OBJ_DIR)/Profile/& $(PROJ_OBJ_DIR)/Debug/& $(PROJ_OBJ_DIR)/Depend/$(@F)|g' > $@
994 # Autoconf Dependencies.
996 ifeq ($(HAS_LLVM),1)
997 $(LLVM_OBJ_ROOT)/config.status:: $(LLVM_SRC_ROOT)/configure
998         @${ECHO} "****************************************************************"
999         @${ECHO} "   You need to re-run $(LLVM_SRC_ROOT)/configure"
1000         @${ECHO} "   in directory $(LLVM_OBJ_ROOT)"
1001         @${ECHO} "****************************************************************"
1002         $(VERB) exit 1
1003 endif
1005 # If the Makefile in the source tree has been updated, copy it over into the
1006 # build tree.
1007 Makefile :: $(PROJ_SRC_DIR)/Makefile
1008         @${ECHO} "===== Updating Makefile from source dir: `dirname $<` ====="
1009         $(MKDIR) $(@D)
1010         cp -f $< $@
1013 # Include dependencies generated from C/C++ source files, but not if we
1014 # are cleaning (this example taken from the GNU Make Manual).
1016 ifneq ($(MAKECMDGOALS),clean)
1017 ifneq ($(MAKECMDGOALS),distclean)
1018 -include /dev/null $(SourceDepend)
1019 endif
1020 endif
1022 endif  # ifndef DISABLE_AUTO_DEPENDENCIES
1025 # Debugging
1027 # General debugging rule, use 'make dbg-print-XXX' to print the
1028 # definition, value and origin of XXX.
1029 make-print-%:
1030         $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))