llvm.org GIT mirror llvm / 7f33695
Checkin of autoconf-style object root. Moved Makefile.common to Makefile.rules. This makes project Makefiles easier to support, and allows for easier overriding of default configuration values that used to be in Makefile.common. Modified Makefile.config.in to determine paths for directories (like LLVM_SRC_ROOT) and to use the pwd binary as opposed to the shell builtin (this works better for symbolic links). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8377 91177308-0d34-0410-b5e6-96231b3b80d8 John Criswell 16 years ago
3 changed file(s) with 105 addition(s) and 900 deletion(s). Raw diff Collapse all Expand all
4949 #
5050 # Configuration file to set paths specific to local installation of LLVM
5151 #
52 ifdef LLVM_SRC_ROOT
53 include $(LLVM_SRC_ROOT)/Makefile.config
54 else
5552 include $(LEVEL)/Makefile.config
56 endif
57
58 ###########################################################################
59 # Directory Configuration
60 # This section of the Makefile determines what is where. To be
61 # specific, there are several locations that need to be defined:
62 #
63 # o LLVM_SRC_ROOT : The root directory of the LLVM source code.
64 # o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
65 #
66 # o BUILD_SRC_DIR : The directory containing the code to build.
67 # o BUILD_SRC_ROOT : The root directory of the code to build.
68 #
69 # o BUILD_OBJ_DIR : The directory in which compiled code will be placed.
70 # o BUILD_OBJ_ROOT : The root directory in which compiled code is placed.
71 #
72 ###########################################################################
7353
7454 #
75 # Set the source build directory. That is almost always the current directory.
55 # Include all of the build rules used for making LLVM
7656 #
77 ifndef BUILD_SRC_DIR
78 BUILD_SRC_DIR = $(shell pwd)
79 endif
57 include $(LLVM_SRC_ROOT)/Makefile.rules
8058
81 #
82 # Set the source root directory.
83 #
84 ifndef BUILD_SRC_ROOT
85 BUILD_SRC_ROOT = $(shell cd $(BUILD_SRC_DIR)/$(LEVEL); pwd)
86 endif
87
88 #
89 # Determine the path of the source tree relative from $HOME (the mythical
90 # home directory).
91 #
92 HOME_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(BUILD_SRC_ROOT))
93
94 #
95 # Set the object build directory. Its location depends upon the source path
96 # and where object files should go.
97 #
98 ifndef BUILD_OBJ_DIR
99 ifeq ($(OBJ_ROOT),.)
100 BUILD_OBJ_DIR = $(BUILD_SRC_DIR)
101 else
102 BUILD_OBJ_DIR := $(HOME_OBJ_ROOT)$(patsubst $(BUILD_SRC_ROOT)%,%,$(BUILD_SRC_DIR))
103 endif
104 endif
105
106 #
107 # Set the root of the object directory.
108 #
109 ifndef BUILD_OBJ_ROOT
110 ifeq ($(OBJ_ROOT),.)
111 BUILD_OBJ_ROOT = $(BUILD_SRC_ROOT)
112 else
113 BUILD_OBJ_ROOT := $(HOME_OBJ_ROOT)
114 endif
115 endif
116
117 #
118 # Set the LLVM object directory.
119 #
120 ifndef LLVM_OBJ_ROOT
121 ifdef LLVM_SRC_ROOT
122 LLVM_OBJ_ROOT := $(shell cd $(BUILD_OBJ_DIR); cd $(LLVM_SRC_ROOT); pwd)
123 else
124 LLVM_OBJ_ROOT := $(shell cd $(BUILD_OBJ_ROOT); pwd)
125 endif
126 endif
127
128 #
129 # Set the LLVM source directory.
130 # It is typically the root directory of what we're compiling now.
131 #
132 ifndef LLVM_SRC_ROOT
133 LLVM_SRC_ROOT := $(BUILD_SRC_ROOT)
134 endif
135
136 ###########################################################################
137 # Default Targets:
138 # The following targets are the standard top level targets for
139 # building.
140 ###########################################################################
141
142 ifdef SHARED_LIBRARY
143 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
144 all:: dynamic
145 endif
146
147 ifdef BYTECODE_LIBRARY
148 # if BYTECODE_LIBRARY is specified, the default is to build the bytecode lib
149 all:: bytecodelib
150 install:: bytecodelib-install
151 endif
152
153 # Default Rule: Make sure it's also a :: rule
154 all ::
155
156 # Default for install is to at least build everything...
157 install ::
158
159 # Default rule for test. It ensures everything has a test rule
160 test::
161
162 # Default rule for building only bytecode.
163 bytecode::
164
165 # Print out the directories used for building
166 prdirs::
167 @echo "Home Offset : " $(HOME_OBJ_ROOT)
168 @echo "Build Source Root: " $(BUILD_SRC_ROOT)
169 @echo "Build Source Dir : " $(BUILD_SRC_DIR)
170 @echo "Build Object Root: " $(BUILD_OBJ_ROOT)
171 @echo "Build Object Dir : " $(BUILD_OBJ_DIR)
172 @echo "LLVM Source Root: " $(LLVM_SRC_ROOT)
173 @echo "LLVM Object Root: " $(LLVM_OBJ_ROOT)
174
175 ###########################################################################
176 # Suffixes and implicit rules:
177 # Empty out the list of suffixes, generate a list that is only
178 # used by this Makefile, and cancel useless implicit rules. This
179 # will hopefully speed up compilation a little bit.
180 ###########################################################################
181 .SUFFIXES:
182 .SUFFIXES: .c .cpp .h .hpp .y .l
183 .SUFFIXES: .lo .o .a .so .bc
184 .SUFFIXES: .ps .dot .d
185
186 #
187 # Mark all of these targets as phony. This will hopefully speed up builds
188 # slightly since GNU Make will not try to find implicit rules for targets
189 # which are marked as Phony.
190 #
191 .PHONY: all dynamic bytecodelib bytecodelib-install
192 .PHONY: clean distclean install test bytecode prdirs
193
194 ###########################################################################
195 # Miscellaneous paths and commands:
196 # This section defines various configuration macros, such as where
197 # to find burg, tblgen, and libtool.
198 ###########################################################################
199
200 #--------------------------------------------------------------------
201 # Variables derived from configuration options...
202 #--------------------------------------------------------------------
203
204 #BinInstDir=/usr/local/bin
205 #LibInstDir=/usr/local/lib/xxx
206 #DocInstDir=/usr/doc/xxx
207
208 BURG_OPTS = -I
209
210 ifdef ENABLE_PROFILING
211 ENABLE_OPTIMIZED = 1
212 CONFIGURATION := Profile
213 else
214 ifdef ENABLE_OPTIMIZED
215 CONFIGURATION := Release
216 else
217 CONFIGURATION := Debug
218 endif
219 endif
220
221 #
222 # Enable this for profiling support with 'gprof'
223 # This automatically enables optimized builds.
224 #
225 ifdef ENABLE_PROFILING
226 PROFILE = -pg
227 endif
228
229 ###########################################################################
230 # Library Locations:
231 # These variables describe various library locations:
232 #
233 # DEST* = Location of where libraries that are built will be placed.
234 # LLVM* = Location of LLVM libraries used for linking.
235 # PROJ* = Location of previously built libraries used for linking.
236 ###########################################################################
237
238 # Libraries that are being built
239 DESTLIBDEBUG := $(BUILD_OBJ_ROOT)/lib/Debug
240 DESTLIBRELEASE := $(BUILD_OBJ_ROOT)/lib/Release
241 DESTLIBPROFILE := $(BUILD_OBJ_ROOT)/lib/Profile
242 DESTLIBBYTECODE := $(BUILD_OBJ_ROOT)/lib/Bytecode
243 DESTLIBCURRENT := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION)
244
245 # LLVM libraries used for linking
246 LLVMLIBDEBUGSOURCE := $(LLVM_OBJ_ROOT)/lib/Debug
247 LLVMLIBRELEASESOURCE := $(LLVM_OBJ_ROOT)/lib/Release
248 LLVMLIBPROFILESOURCE := $(LLVM_OBJ_ROOT)/lib/Profile
249 LLVMLIBCURRENTSOURCE := $(LLVM_OBJ_ROOT)/lib/$(CONFIGURATION)
250
251 # Libraries that were built that will now be used for linking
252 PROJLIBDEBUGSOURCE := $(BUILD_OBJ_ROOT)/lib/Debug
253 PROJLIBRELEASESOURCE := $(BUILD_OBJ_ROOT)/lib/Release
254 PROJLIBPROFILESOURCE := $(BUILD_OBJ_ROOT)/lib/Profile
255 PROJLIBCURRENTSOURCE := $(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION)
256
257 ###########################################################################
258 # Tool Locations
259 # These variables describe various tool locations:
260 #
261 # DEST* = Location of where tools that are built will be placed.
262 # LLVM* = Location of LLVM tools used for building.
263 # PROJ* = Location of previously built tools used for linking.
264 ###########################################################################
265
266 DESTTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug
267 DESTTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release
268 DESTTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile
269 DESTTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)
270
271 LLVMTOOLDEBUG := $(LLVM_OBJ_ROOT)/tools/Debug
272 LLVMTOOLRELEASE := $(LLVM_OBJ_ROOT)/tools/Release
273 LLVMTOOLPROFILE := $(LLVM_OBJ_ROOT)/tools/Profile
274 LLVMTOOLCURRENT := $(LLVM_OBJ_ROOT)/tools/$(CONFIGURATION)
275
276 PROJTOOLDEBUG := $(BUILD_OBJ_ROOT)/tools/Debug
277 PROJTOOLRELEASE := $(BUILD_OBJ_ROOT)/tools/Release
278 PROJTOOLPROFILE := $(BUILD_OBJ_ROOT)/tools/Profile
279 PROJTOOLCURRENT := $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)
280
281 #
282 # Libtool is found in the current directory.
283 #
284 LIBTOOL := $(LLVM_SRC_ROOT)/mklib
285
286 #
287 # If we're not building a shared library, use the disable-shared tag with
288 # libtool. This will disable the building of objects for shared libraries and
289 # only generate static library objects.
290 #
291 # For dynamic libraries, we'll take the performance hit for now, since we
292 # almost never build them.
293 #
294 # This should speed up compilation and require no modifications to future
295 # versions of libtool.
296 #
297 ifndef SHARED_LIBRARY
298 LIBTOOL += --tag=disable-shared
299 endif
300
301 #
302 # Verbosity levels
303 #
304 ifndef VERBOSE
305 VERB := @
306 LIBTOOL += --silent
307 endif
308
309 ###########################################################################
310 # Miscellaneous paths and commands (part deux):
311 # This section defines various configuration macros, such as where
312 # to find burg, tblgen, and libtool.
313 ###########################################################################
314
315 #--------------------------------------------------------------------------
316 # Utilities used while building the LLVM tree, which live in the utils dir
317 #
318 BURG := $(LLVMTOOLCURRENT)/burg
319 RunBurg := $(BURG) $(BURG_OPTS)
320 TBLGEN := $(LLVMTOOLCURRENT)/tblgen
321
322 #--------------------------------------------------------------------------
323 # The LLVM GCC front-end in C and C++ flavors
324 #
325 LLVMGCC := PATH=$(LLVMTOOLCURRENT):$(PATH) $(LLVMGCCDIR)/bin/gcc
326 LCC1 := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1
327 LLVMGXX := PATH=$(LLVMTOOLCURRENT):$(PATH) $(LLVMGCCDIR)/bin/g++
328 LCC1XX := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1plus
329
330 #--------------------------------------------------------------------------
331 # Some of the compiled LLVM tools which are used for compilation of runtime
332 # libraries.
333 #
334 LLVMAS := $(LLVMTOOLCURRENT)/llvm-as
335
336
337 ###########################################################################
338 # Compile Time Flags
339 ###########################################################################
340
341 #
342 # Include both the project headers and the LLVM headers for compilation and
343 # dependency computation.
344 #
345 CPPFLAGS += -I$(BUILD_SRC_ROOT)/include -I$(LLVM_SRC_ROOT)/include
346
347 # By default, strip symbol information from executable
348 ifndef KEEP_SYMBOLS
349 STRIP = $(PLATFORMSTRIPOPTS)
350 STRIP_WARN_MSG = "(without symbols)"
351 endif
352
353 # Allow gnu extensions...
354 CPPFLAGS += -D_GNU_SOURCE
355
356 CompileWarnings := -Wall -W -Wwrite-strings -Wno-unused
357 CompileCommonOpts := $(CompileWarnings) -I$(LEVEL)/include -fshort-enums
358 CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions
359
360 #
361 # Compile commands with libtool.
362 #
363 Compile := $(LIBTOOL) --mode=compile $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
364 CompileC := $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(CompileCommonOpts)
365
366 # Compile a cpp file, don't link...
367 CompileG := $(Compile) -g -D_DEBUG
368 CompileO := $(Compile) $(CompileOptimizeOpts) -felide-constructors -fomit-frame-pointer
369 CompileP := $(Compile) $(CompileOptimizeOpts) -felide-constructors $(PROFILE)
370
371 # Compile a c file, don't link...
372 CompileCG := $(CompileC) -g -D_DEBUG
373 CompileCO := $(CompileC) $(CompileOptimizeOpts) -fomit-frame-pointer
374 CompileCP := $(CompileC) $(CompileOptimizeOpts) $(PROFILE)
375
376 ###########################################################################
377 # Link Time Options
378 ###########################################################################
379
380 #
381 # Link final executable
382 # (Note that we always link with the C++ compiler).
383 #
384 Link := $(LIBTOOL) --mode=link $(CXX)
385
386 # link both projlib and llvmlib libraries
387 LinkG := $(Link) -g -L$(PROJLIBDEBUGSOURCE) -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
388 LinkO := $(Link) -O3 -L$(PROJLIBRELEASESOURCE) -L$(LLVMLIBRELEASESOURCE)
389 LinkP := $(Link) -O3 -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
390
391 # Create one .o file from a bunch of .o files...
392 Relink := ${LIBTOOL} --mode=link $(CXX)
393
394 #
395 # Configure where the item being compiled should go.
396 #
397 ifdef SHARED_LIBRARY
398 Link += -rpath $(DESTLIBCURRENT)
399 endif
400
401 ifdef TOOLNAME
402 Link += -rpath $(DESTTOOLCURRENT)
403 endif
404
405 # Create dependency file from CPP file, send to stdout.
406 Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS)
407 DependC := $(CC) -MM -I$(LEVEL)/include $(CPPFLAGS)
408
409 # Archive a bunch of .o files into a .a file...
410 AR = ${AR_PATH} cq
411
412 #----------------------------------------------------------
413
414 # Source includes all of the cpp files, and objects are derived from the
415 # source files...
416 # The local Makefile can list other Source files via ExtraSource = ...
417 #
418 ifndef Source
419 Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
420 endif
421
422 #
423 # Libtool Objects
424 #
425 Srcs := $(sort $(notdir $(basename $(Source))))
426 Objs := $(addsuffix .lo, $(Srcs))
427 ObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(Objs))
428 ObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(Objs))
429 ObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(Objs))
430 ObjectsBC := $(addprefix $(BUILD_OBJ_DIR)/Bytecode/,$(addsuffix .bc, $(Srcs)))
431
432 #
433 # The real objects underlying the libtool objects
434 #
435 RObjs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source))))))
436 RObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(RObjs))
437 RObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(RObjs))
438 RObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(RObjs))
439
440 #---------------------------------------------------------
441 # Handle the DIRS and PARALLEL_DIRS options
442 #---------------------------------------------------------
443
444 ifdef DIRS
445 all install clean test bytecode ::
446 $(VERB) for dir in ${DIRS}; do \
447 (cd $$dir; $(MAKE) $@) || exit 1; \
448 done
449 endif
450
451 # Handle PARALLEL_DIRS
452 ifdef PARALLEL_DIRS
453 all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
454 install :: $(addsuffix /.makeinstall , $(PARALLEL_DIRS))
455 clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS))
456 test :: $(addsuffix /.maketest , $(PARALLEL_DIRS))
457 bytecode :: $(addsuffix /.makebytecode, $(PARALLEL_DIRS))
458
459 %/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode:
460 $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
461 endif
462
463 # Handle directories that may or may not exist
464 ifdef OPTIONAL_DIRS
465 all install clean test bytecode ::
466 $(VERB) for dir in ${OPTIONAL_DIRS}; do \
467 if [ -d $$dir ]; \
468 then\
469 (cd $$dir; $(MAKE) $@) || exit 1; \
470 fi \
471 done
472 endif
473
474 ###########################################################################
475 # Library Build Rules:
476 #
477 #---------------------------------------------------------
478 # Handle the LIBRARYNAME option - used when building libs...
479 #---------------------------------------------------------
480 #
481 # When libraries are built, they are allowed to optionally define the
482 # DONT_BUILD_RELINKED make variable, which, when defined, prevents a .o file
483 # from being built for the library. This .o files may then be linked to by a
484 # tool if the tool does not need (or want) the semantics a .a file provides
485 # (linking in only object files that are "needed"). If a library is never to
486 # be used in this way, it is better to define DONT_BUILD_RELINKED, and define
487 # BUILD_ARCHIVE instead.
488 #
489 # Some libraries must be built as .a files (libscalar for example) because if
490 # it's built as a .o file, then all of the constituent .o files in it will be
491 # linked into tools (for example gccas) even if they only use one of the parts
492 # of it. For this reason, sometimes it's useful to use libraries as .a files.
493 ###########################################################################
494
495 ifdef LIBRARYNAME
496
497 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
498 LIBRARYNAME := $(strip $(LIBRARYNAME))
499
500 LIBNAME_O := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).so
501 LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).so
502 LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).so
503 LIBNAME_AO := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a
504 LIBNAME_AP := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a
505 LIBNAME_AG := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a
506 LIBNAME_OBJO := $(DESTLIBRELEASE)/$(LIBRARYNAME).o
507 LIBNAME_OBJP := $(DESTLIBPROFILE)/$(LIBRARYNAME).o
508 LIBNAME_OBJG := $(DESTLIBDEBUG)/$(LIBRARYNAME).o
509 LIBNAME_BC := $(DESTLIBBYTECODE)/lib$(LIBRARYNAME).bc
510
511 #--------------------------------------------------------------------
512 # Library Targets
513 # Modify the top level targets to build the desired libraries.
514 #--------------------------------------------------------------------
515
516 # dynamic target builds a shared object version of the library...
517 dynamic:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).so
518 bytecodelib:: $(LIBNAME_BC)
519 bytecodelib-install:: $(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc
520
521 $(LLVMGCCDIR)/bytecode-libs/lib$(LIBRARYNAME).bc: $(LIBNAME_BC)
522 @echo ======= Installing $(LIBRARYNAME) bytecode library =======
523 cp $< $@
524
525 # Does the library want a .o version built?
526 ifndef DONT_BUILD_RELINKED
527 all:: $(DESTLIBCURRENT)/$(LIBRARYNAME).o
528 endif
529
530 # Does the library want an archive version built?
531 ifdef BUILD_ARCHIVE
532 all:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).a
533 endif
534
535 #--------------------------------------------------------------------
536 # Rules for building libraries
537 #--------------------------------------------------------------------
538
539 LinkBCLib := $(LLVMGCC) -shared
540 ifdef EXPORTED_SYMBOL_LIST
541 LinkBCLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
542 else
543 LinkBCLib += -Xlinker -disable-internalize
544 endif
545
546
547 # Rule for building bytecode libraries.
548 $(LIBNAME_BC): $(ObjectsBC) $(LibSubDirs) $(DESTLIBBYTECODE)/.dir
549 @echo ======= Linking $(LIBRARYNAME) bytecode library =======
550 $(VERB) $(LinkBCLib) -o $@ $(ObjectsBC) $(LibSubDirs) $(LibLinkOpts)
551 #
552 # Rules for building dynamically linked libraries.
553 #
554 $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
555 @echo ======= Linking $(LIBRARYNAME) dynamic release library =======
556 $(VERB) $(Link) -o $*.la $(ObjectsO) $(LibSubDirs) $(LibLinkOpts)
557 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT)
558
559 $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
560 @echo ======= Linking $(LIBRARYNAME) dynamic profile library =======
561 $(VERB) $(Link) -o $*.la $(ObjectsP) $(LibSubDirs) $(LibLinkOpts)
562 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT)
563
564 $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
565 @echo ======= Linking $(LIBRARYNAME) dynamic debug library =======
566 $(VERB) $(Link) -o $*.la $(ObjectsG) $(LibSubDirs) $(LibLinkOpts)
567 $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT)
568
569 #
570 # Rules for building static archive libraries.
571 #
572 $(LIBNAME_AO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
573 @echo ======= Linking $(LIBRARYNAME) archive release library =======
574 @$(RM) -f $@
575 $(VERB) $(Link) -03 -o $@ $(ObjectsO) $(LibSubDirs) -static
576
577 $(LIBNAME_AP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
578 @echo ======= Linking $(LIBRARYNAME) archive profile library =======
579 @$(RM) -f $@
580 $(VERB) $(Link) -03 $(PROFILE) -o $@ $(ObjectsP) $(LibSubDirs) -static
581
582 $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
583 @echo ======= Linking $(LIBRARYNAME) archive debug library =======
584 @$(RM) -f $@
585 $(VERB) $(Link) -g $(STRIP) -o $@ $(ObjectsG) $(LibSubDirs) -static
586
587
588 #
589 # Rules for building .o libraries.
590 #
591 # JTC:
592 # Note that for this special case, we specify the actual object files
593 # instead of their libtool counterparts. This is because libtool
594 # doesn't want to generate a reloadable object file unless it is given
595 # .o files explicitly.
596 #
597 # Note that we're making an assumption here: If we build a .lo file,
598 # it's corresponding .o file will be placed in the same directory.
599 #
600 # I think that is safe.
601 #
602 $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
603 @echo "Linking $@"
604 $(VERB) $(Relink) -o $@ $(RObjectsO) $(LibSubDirs)
605
606 $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
607 @echo "Linking $@"
608 $(VERB) $(Relink) -o $@ $(RObjectsP) $(LibSubDirs)
609
610 $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
611 @echo "Linking $@"
612 $(VERB) $(Relink) -o $@ $(RObjectsG) $(LibSubDirs)
613
614 endif
615
616 #------------------------------------------------------------------------
617 # Create a TAGS database for emacs
618 #------------------------------------------------------------------------
619
620 ifdef ETAGS
621 ifeq ($(LEVEL), .)
622 SRCDIRS := $(wildcard include lib tools)
623
624 tags:
625 $(ETAGS) -l c++ `find $(SRCDIRS) -name '*.cpp' -o -name '*.h'`
626 all:: tags
627 endif
628 else
629 tags:
630 ${ECHO} "Cannot build $@: The program etags is not installed"
631 endif
632
633 #------------------------------------------------------------------------
634 # Handle the TOOLNAME option - used when building tool executables...
635 #------------------------------------------------------------------------
636 #
637 # The TOOLNAME option should be used with a USEDLIBS variable that tells the
638 # libraries (and the order of the libs) that should be linked to the
639 # tool. USEDLIBS should contain a list of library names (some with .a extension)
640 # that are automatically linked in as .o files unless the .a suffix is added.
641 #
642 ifdef TOOLNAME
643
644 # TOOLEXENAME* - These compute the output filenames to generate...
645 TOOLEXENAME_G := $(DESTTOOLDEBUG)/$(TOOLNAME)
646 TOOLEXENAME_O := $(DESTTOOLRELEASE)/$(TOOLNAME)
647 TOOLEXENAME_P := $(DESTTOOLPROFILE)/$(TOOLNAME)
648 TOOLEXENAMES := $(DESTTOOLCURRENT)/$(TOOLNAME)
649
650 # USED_LIBS_OPTIONS - Compute the options line that add -llib1 -llib2, etc.
651 PROJ_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
652 PROJ_LIBS_OPTIONS_G := $(patsubst %.o, $(PROJLIBDEBUGSOURCE)/%.o, $(PROJ_LIBS_OPTIONS))
653 PROJ_LIBS_OPTIONS_O := $(patsubst %.o, $(PROJLIBRELEASESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
654 PROJ_LIBS_OPTIONS_P := $(patsubst %.o, $(PROJLIBPROFILESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
655
656 LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
657 LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o, $(LLVM_LIBS_OPTIONS))
658 LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
659 LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
660
661 LIB_OPTS_G := $(LLVM_LIBS_OPTIONS_G) $(PROJ_LIBS_OPTIONS_G)
662 LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_O)
663 LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P) $(PROJ_LIBS_OPTIONS_P)
664
665 # USED_LIB_PATHS - Compute the path of the libraries used so that tools are
666 # rebuilt if libraries change. This has to make sure to handle .a/.so and .o
667 # files separately.
668 #
669 STATICUSEDLIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
670 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
671 USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS))
672 USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS))
673
674 #
675 # Libtool link options:
676 # Ensure that all binaries have their symbols exported so that they can
677 # by dlsym'ed.
678 #
679 LINK_OPTS := -export-dynamic $(TOOLLINKOPTS)
680
681
682
683
684
685 # Tell make that we need to rebuild subdirectories before we can link the tool.
686 # This affects things like LLI which has library subdirectories.
687 $(USED_LIB_PATHS_G) $(USED_LIB_PATHS_O) $(USED_LIB_PATHS_P): \
688 $(addsuffix /.makeall, $(PARALLEL_DIRS))
689
690 all:: $(TOOLEXENAMES)
691
692 clean::
693 $(VERB) $(RM) -f $(TOOLEXENAMES)
694
695 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
696 @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG) =======
697 $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) $(LIBS)
698
699 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir
700 @echo ======= Linking $(TOOLNAME) release executable =======
701 $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS) $(LIBS)
702
703 $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(DESTTOOLPROFILE)/.dir
704 @echo ======= Linking $(TOOLNAME) profile executable =======
705 $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS) $(LIBS)
706
707 endif
708
709
710
711 #---------------------------------------------------------
712 .PRECIOUS: $(BUILD_OBJ_DIR)/Depend/.dir $(BUILD_OBJ_DIR)/Bytecode/.dir
713 .PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir
714
715 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
716 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
717 @echo "Compiling $<"
718 $(VERB) $(CompileO) $< -o $@
719
720 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
721 @echo "Compiling $<"
722 $(VERB) $(CompileCO) $< -o $@
723
724 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
725 @echo "Compiling $<"
726 $(VERB) $(CompileP) $< -o $@
727
728 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
729 @echo "Compiling $<"
730 $(VERB) $(CompileCP) $< -o $@
731
732 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
733 @echo "Compiling $<"
734 $(VERB) $(CompileG) $< -o $@
735
736 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
737 @echo "Compiling $<"
738 $(VERB) $(CompileCG) $< -o $@
739
740 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1XX)
741 @echo "Compiling $< to bytecode"
742 $(VERB) $(LLVMGXX) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
743
744 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1)
745 @echo "Compiling $< to bytecode"
746 $(VERB) $(LLVMGCC) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
747
748 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LLVMAS)
749 @echo "Compiling $< to bytecode"
750 $(VERB) $(LLVMAS) $< -f -o $@
751
752
753 #
754 # Rules for building lex/yacc files
755 #
756 LEX_FILES = $(filter %.l, $(Source))
757 LEX_OUTPUT = $(LEX_FILES:%.l=%.cpp)
758 YACC_FILES = $(filter %.y, $(Source))
759 YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
760 .PRECIOUS: $(LEX_OUTPUT) $(YACC_OUTPUT)
761
762 # Create a .cpp source file from a flex input file... this uses sed to cut down
763 # on the warnings emited by GCC...
764 #
765 # The last line is a gross hack to work around flex aparently not being able to
766 # resize the buffer on a large token input. Currently, for uninitialized string
767 # buffers in LLVM we can generate very long tokens, so this is a hack around it.
768 # FIXME. (f.e. char Buffer[10000] )
769 #
770 %.cpp: %.l
771 @echo Flex\'ing $<...
772 $(VERB) $(FLEX) -t $< | \
773 $(SED) '/^find_rule/d' | \
774 $(SED) 's/void yyunput/inline void yyunput/' | \
775 $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
776 $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \
777 > $@.tmp
778 $(VERB) cmp -s $@ $@.tmp > /dev/null || ${MV} -f $@.tmp $@
779 @# remove the output of flex if it didn't get moved over...
780 @rm -f $@.tmp
781
782 # Rule for building the bison parsers...
783 %.c: %.y # Cancel built-in rules for yacc
784 %.h: %.y # Cancel built-in rules for yacc
785 %.cpp %.h : %.y
786 @echo Bison\'ing $<...
787 $(VERB) $(BISON) -v -d -p $(<:%Parser.y=%) $*.y
788 $(VERB) cmp -s $*.tab.c $*.cpp > /dev/null || ${MV} -f $*.tab.c $*.cpp
789 $(VERB) cmp -s $*.tab.h $*.h > /dev/null || ${MV} -f $*.tab.h $*.h
790 @# If the files were not updated, don't leave them lying around...
791 @rm -f $*.tab.c $*.tab.h
792
793 # To create the directories...
794 %/.dir:
795 $(VERB) ${MKDIR} $* > /dev/null
796 @$(DATE) > $@
797
798 # To create postscript files from dot files...
799 ifdef DOT
800 %.ps: %.dot
801 ${DOT} -Tps < $< > $@
802 else
803 %.ps: %.dot
804 ${ECHO} "Cannot build $@: The program dot is not installed"
805 endif
806
807 # 'make clean' nukes the tree
808 clean::
809 $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release
810 $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend
811 $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Bytecode
812 $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
813 $(VERB) $(RM) -f $(LEX_OUTPUT) $(YACC_OUTPUT)
814
815 ###########################################################################
816 # C/C++ Dependencies
817 # Define variables and rules that generate header file dependencies
818 # from C/C++ source files.
819 ###########################################################################
820
821 ifndef DISABLE_AUTO_DEPENDENCIES
822
823 # If dependencies were generated for the file that included this file,
824 # include the dependencies now...
825 #
826 SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source))))
827 SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d)
828
829 # Create dependencies for the *.cpp files...
830 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Depend/.dir
831 $(VERB) $(Depend) $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
832 $(VERB) $(Depend) $< | $(SED) 's|$*.o: $*.cpp||' | $(SED) 's|[^\]$$|&::|' >> $@
833
834 # Create dependencies for the *.c files...
835 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Depend/.dir
836 $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
837 $(VERB) $(Depend) $< | $(SED) 's|$*.o: $*.c||' | $(SED) 's|[^\]$$|&::|' >> $@
838
839 #
840 # Include dependencies generated from C/C++ source files, but not if we
841 # are cleaning (this example taken from the GNU Make Manual).
842 #
843 ifneq ($(MAKECMDGOALS),clean)
844 ifneq ($(MAKECMDGOALS),distclean)
845 -include /dev/null $(SourceDepend)
846 endif
847 endif
848
849 endif # ifndef DISABLE_AUTO_DEPENDENCIES
6363 #
6464 # Paths to miscellaneous programs.
6565 #
66 RPWD = @RPWD@
6667 SED = @SED@
6768 RM = @RM@
6869 ECHO = @ECHO@
8384 # object files.
8485 #
8586 #OBJ_ROOT = .
86 OBJ_ROOT := @OBJROOT@
87 OBJ_ROOT := .
8788
8889 # Path to location for LLVM front-end this should only be specified here if you
8990 # want to override the value set in Makefile.$(uname)
168169 #
169170 @DISABLE_LLC_DIFFS@
170171
172 ###########################################################################
173 # Directory Configuration
174 # This section of the Makefile determines what is where. To be
175 # specific, there are several locations that need to be defined:
176 #
177 # o LLVM_SRC_ROOT : The root directory of the LLVM source code.
178 # o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
179 #
180 # o BUILD_SRC_DIR : The directory containing the code to build.
181 # o BUILD_SRC_ROOT : The root directory of the code to build.
182 #
183 # o BUILD_OBJ_DIR : The directory in which compiled code will be placed.
184 # o BUILD_OBJ_ROOT : The root directory in which compiled code is placed.
185 #
186 ###########################################################################
187
188 #
189 # Set the object build directory. By default, it is the current directory.
190 #
191 ifndef BUILD_OBJ_DIR
192 BUILD_OBJ_DIR := $(subst //,/,$(shell $(RPWD)))
193 endif
194
195 #
196 # Set the root of the object directory.
197 #
198 ifndef BUILD_OBJ_ROOT
199 BUILD_OBJ_ROOT := $(subst //,/,$(shell cd $(BUILD_OBJ_DIR)/$(LEVEL); $(RPWD)))
200 endif
201
202 #
203 # Set the source build directory. That is almost always the current directory.
204 #
205 ifndef BUILD_SRC_DIR
206 BUILD_SRC_DIR := $(subst //,/,@abs_top_srcdir@/$(patsubst $(BUILD_OBJ_ROOT)%,%,$(BUILD_OBJ_DIR)))
207 endif
208
209 #
210 # Set the source root directory.
211 #
212 ifndef BUILD_SRC_ROOT
213 BUILD_SRC_ROOT := $(subst //,/,@abs_top_srcdir@)
214 endif
215
216 #
217 # Set the LLVM object directory.
218 #
219 ifndef LLVM_OBJ_ROOT
220 ifdef LLVM_SRC_ROOT
221 LLVM_OBJ_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(RPWD))
222 else
223 LLVM_OBJ_ROOT := $(BUILD_OBJ_ROOT)
224 endif
225 endif
226
227 #
228 # Set the LLVM source directory.
229 # It is typically the root directory of what we're compiling now.
230 #
231 ifndef LLVM_SRC_ROOT
232 LLVM_SRC_ROOT := $(BUILD_SRC_ROOT)
233 endif
234
4747 #===-----------------------------------------------------------------------====
4848
4949 #
50 # Configuration file to set paths specific to local installation of LLVM
51 #
52 ifdef LLVM_SRC_ROOT
53 include $(LLVM_SRC_ROOT)/Makefile.config
54 else
55 include $(LEVEL)/Makefile.config
56 endif
57
58 ###########################################################################
59 # Directory Configuration
60 # This section of the Makefile determines what is where. To be
61 # specific, there are several locations that need to be defined:
62 #
63 # o LLVM_SRC_ROOT : The root directory of the LLVM source code.
64 # o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
65 #
66 # o BUILD_SRC_DIR : The directory containing the code to build.
67 # o BUILD_SRC_ROOT : The root directory of the code to build.
68 #
69 # o BUILD_OBJ_DIR : The directory in which compiled code will be placed.
70 # o BUILD_OBJ_ROOT : The root directory in which compiled code is placed.
71 #
72 ###########################################################################
73
74 #
75 # Set the source build directory. That is almost always the current directory.
76 #
77 ifndef BUILD_SRC_DIR
78 BUILD_SRC_DIR = $(shell pwd)
79 endif
80
81 #
82 # Set the source root directory.
83 #
84 ifndef BUILD_SRC_ROOT
85 BUILD_SRC_ROOT = $(shell cd $(BUILD_SRC_DIR)/$(LEVEL); pwd)
86 endif
87
88 #
89 # Determine the path of the source tree relative from $HOME (the mythical
90 # home directory).
91 #
92 HOME_OBJ_ROOT := $(OBJ_ROOT)$(patsubst $(HOME)%,%,$(BUILD_SRC_ROOT))
93
94 #
95 # Set the object build directory. Its location depends upon the source path
96 # and where object files should go.
97 #
98 ifndef BUILD_OBJ_DIR
99 ifeq ($(OBJ_ROOT),.)
100 BUILD_OBJ_DIR = $(BUILD_SRC_DIR)
101 else
102 BUILD_OBJ_DIR := $(HOME_OBJ_ROOT)$(patsubst $(BUILD_SRC_ROOT)%,%,$(BUILD_SRC_DIR))
103 endif
104 endif
105
106 #
107 # Set the root of the object directory.
108 #
109 ifndef BUILD_OBJ_ROOT
110 ifeq ($(OBJ_ROOT),.)
111 BUILD_OBJ_ROOT = $(BUILD_SRC_ROOT)
112 else
113 BUILD_OBJ_ROOT := $(HOME_OBJ_ROOT)
114 endif
115 endif
116
117 #
118 # Set the LLVM object directory.
119 #
120 ifndef LLVM_OBJ_ROOT
121 ifdef LLVM_SRC_ROOT
122 LLVM_OBJ_ROOT := $(shell cd $(BUILD_OBJ_DIR); cd $(LLVM_SRC_ROOT); pwd)
123 else
124 LLVM_OBJ_ROOT := $(shell cd $(BUILD_OBJ_ROOT); pwd)
125 endif
126 endif
127
128 #
129 # Set the LLVM source directory.
130 # It is typically the root directory of what we're compiling now.
131 #
132 ifndef LLVM_SRC_ROOT
133 LLVM_SRC_ROOT := $(BUILD_SRC_ROOT)
134 endif
50 # Set the VPATH so that we can find source files.
51 # Also set $SouceDir for backwards compatibility
52 #
53 VPATH=$(BUILD_SRC_DIR)
54 SourceDir=$(BUILD_SRC_DIR)
13555
13656 ###########################################################################
13757 # Default Targets:
16484
16585 # Print out the directories used for building
16686 prdirs::
167 @echo "Home Offset : " $(HOME_OBJ_ROOT)
16887 @echo "Build Source Root: " $(BUILD_SRC_ROOT)
16988 @echo "Build Source Dir : " $(BUILD_SRC_DIR)
17089 @echo "Build Object Root: " $(BUILD_OBJ_ROOT)
281200 #
282201 # Libtool is found in the current directory.
283202 #
284 LIBTOOL := $(LLVM_SRC_ROOT)/mklib
203 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
285204
286205 #
287206 # If we're not building a shared library, use the disable-shared tag with
342261 # Include both the project headers and the LLVM headers for compilation and
343262 # dependency computation.
344263 #
345 CPPFLAGS += -I$(BUILD_SRC_ROOT)/include -I$(LLVM_SRC_ROOT)/include
264 # BUILD_OBJ_DIR : Files local to the particular object directory
265 # (locallly generated header files).
266 # BUILD_SRC_DIR : Files local to the particular source directory.
267 # BUILD_SRC_ROOT/include : Files global to the project.
268 # LEVEL/include : config.h files for the project
269 # LLVM_SRC_ROOT/include : Files global to LLVM.
270 # LLVM_OBJ_ROOT/include : config.h files generated by autoconf
271 #
272 CPPFLAGS += -I$(BUILD_OBJ_DIR) -I$(BUILD_SRC_DIR) -I$(BUILD_SRC_ROOT)/include -I$(LEVEL)/include -I$(LLVM_SRC_ROOT)/include -I$(LLVM_OBJ_ROOT)/include
346273
347274 # By default, strip symbol information from executable
348275 ifndef KEEP_SYMBOLS
354281 CPPFLAGS += -D_GNU_SOURCE
355282
356283 CompileWarnings := -Wall -W -Wwrite-strings -Wno-unused
357 CompileCommonOpts := $(CompileWarnings) -I$(LEVEL)/include -fshort-enums
284 CompileCommonOpts := $(CompileWarnings) -fshort-enums
358285 CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions
359286
360287 #
416343 # The local Makefile can list other Source files via ExtraSource = ...
417344 #
418345 ifndef Source
419 Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
346 Source := $(ExtraSource) $(wildcard $(SourceDir)/*.cpp $(SourceDir)/*.c $(SourceDir)/*.y $(SourceDir)/*.l)
420347 endif
421348
422349 #
619546
620547 ifdef ETAGS
621548 ifeq ($(LEVEL), .)
622 SRCDIRS := $(wildcard include lib tools)
549 SRCDIRS := $(wildcard $(SourceDir)/include $(SourceDir)/lib $(SourceDir)/tools)
623550
624551 tags:
625552 $(ETAGS) -l c++ `find $(SRCDIRS) -name '*.cpp' -o -name '*.h'`
713640 .PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir
714641
715642 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
716 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Release/.dir
643 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Release/.dir
717644 @echo "Compiling $<"
718645 $(VERB) $(CompileO) $< -o $@
719646
720 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Release/.dir
647 $(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Release/.dir
721648 @echo "Compiling $<"
722649 $(VERB) $(CompileCO) $< -o $@
723650
724 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
651 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
725652 @echo "Compiling $<"
726653 $(VERB) $(CompileP) $< -o $@
727654
728 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Profile/.dir
655 $(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Profile/.dir
729656 @echo "Compiling $<"
730657 $(VERB) $(CompileCP) $< -o $@
731658
732 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
659 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
733660 @echo "Compiling $<"
734661 $(VERB) $(CompileG) $< -o $@
735662
736 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Debug/.dir
663 $(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Debug/.dir
737664 @echo "Compiling $<"
738665 $(VERB) $(CompileCG) $< -o $@
739666
740 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1XX)
667 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1XX)
741668 @echo "Compiling $< to bytecode"
742669 $(VERB) $(LLVMGXX) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
743670
744 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1)
671 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1)
745672 @echo "Compiling $< to bytecode"
746673 $(VERB) $(LLVMGCC) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
747674
748 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LLVMAS)
675 $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)/%.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LLVMAS)
749676 @echo "Compiling $< to bytecode"
750677 $(VERB) $(LLVMAS) $< -f -o $@
751678
784711 %.h: %.y # Cancel built-in rules for yacc
785712 %.cpp %.h : %.y
786713 @echo Bison\'ing $<...
787 $(VERB) $(BISON) -v -d -p $(<:%Parser.y=%) $*.y
714 $(VERB) $(BISON) -v -d -p $(<F:%Parser.y=%) $*.y
788715 $(VERB) cmp -s $*.tab.c $*.cpp > /dev/null || ${MV} -f $*.tab.c $*.cpp
789716 $(VERB) cmp -s $*.tab.h $*.h > /dev/null || ${MV} -f $*.tab.h $*.h
790717 @# If the files were not updated, don't leave them lying around...
804731 ${ECHO} "Cannot build $@: The program dot is not installed"
805732 endif
806733
734 #
735 # This rules ensures that header files that are removed still have a rule for
736 # which they can be "generated." This allows make to ignore them and
737 # reproduce the dependency lists.
738 #
739 %.h::
740
807741 # 'make clean' nukes the tree
808742 clean::
809743 $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release
823757 # If dependencies were generated for the file that included this file,
824758 # include the dependencies now...
825759 #
826 SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source))))
760 SourceBaseNames := $(basename $(notdir $(filter-out $(SourceDir)/$(CONFIGURATION)/%, $(Source))))
827761 SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d)
828762
829763 # Create dependencies for the *.cpp files...
830 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Depend/.dir
764 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Depend/.dir
831765 $(VERB) $(Depend) $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
832 $(VERB) $(Depend) $< | $(SED) 's|$*.o: $*.cpp||' | $(SED) 's|[^\]$$|&::|' >> $@
833766
834767 # Create dependencies for the *.c files...
835 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Depend/.dir
768 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Depend/.dir
836769 $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
837 $(VERB) $(Depend) $< | $(SED) 's|$*.o: $*.c||' | $(SED) 's|[^\]$$|&::|' >> $@
838770
839771 #
840772 # Include dependencies generated from C/C++ source files, but not if we