1 #===-- Makefile.common - Common make rules for LLVM -------*- makefile -*--====
3 # This file is included by all of the LLVM makefiles. This file defines common
4 # rules to do things like compile a .cpp file or generate dependancy info.
5 # These are platform dependant, so this is the file used to specify these
6 # system dependant operations.
8 # The following functionality can be set by setting incoming variables.
9 # The variable $(LEVEL) *must* be set:
11 # 1. LEVEL - The level of the current subdirectory from the top of the
12 # MagicStats view. This level should be expressed as a path, for
13 # example, ../.. for two levels deep.
15 # 2. DIRS - A list of subdirectories to be built. Fake targets are set up
16 # so that each of the targets "all", "install", and "clean" each build
17 # the subdirectories before the local target. DIRS are guaranteed to be
20 # 3. PARALLEL_DIRS - A list of subdirectories to be built, but that may be
21 # built in any order. All DIRS are built in order before PARALLEL_DIRS are
22 # built, which are then built in any order.
24 # 4. Source - If specified, this sets the source code filenames. If this
25 # is not set, it defaults to be all of the .cpp, .c, .y, and .l files
26 # in the current directory. Also, if you want to build files in addition
27 # to the local files, you can use the ExtraSource variable
29 # 5. SourceDir - If specified, this specifies a directory that the source files
30 # are in, if they are not in the current directory. This should include a
31 # trailing / character.
33 #===-----------------------------------------------------------------------====
35 # Configuration file to set paths specific to local installation of LLVM
37 include $(LEVEL)/Makefile.config
39 # These are options that can either be enabled here, or can be enabled on the
40 # make command line (ie, make ENABLE_PROFILING=1)
43 # When ENABLE_PROFILING is enabled, the llvm source base is built with profile
44 # information to allow gprof to be used to get execution frequencies.
48 # When ENABLE_PURIFY is enabled, the LLVM tools are linked with purify (which
49 # must be locally installed) to allow for some automated memory error debugging.
53 # When ENABLE_OPTIMIZED is enabled, Release builds of all of the LLVM code are
54 # turned on, and Debug builds are turned off.
59 # Figure out how to do platform specific stuff on this platform. This is really
60 # gross and should be autoconfiscated (automake actually), but should hopefully
61 # work on Linux and solaris (SunOS).
63 UNAME := $(shell uname)
64 include $(LEVEL)/Makefile.$(UNAME)
67 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
71 # Default Rule: Make sure it's also a :: rule
74 # Default for install is to at least build everything...
78 # Figure out which directory to build stuff into. We want to build into the
79 # /shared directory by default because it is guaranteed to be local to the
82 ifeq ($(LLVM_OBJ_DIR),.)
83 BUILD_ROOT = $(LLVM_OBJ_DIR)
84 BUILD_ROOT_TOP = $(LEVEL)
87 BUILD_ROOT := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(shell pwd))
89 # Calculate the BUILD_ROOT_TOP variable, which is the top of the llvm/ tree.
90 # Note that although this is just equal to $(BUILD_ROOT)/$(LEVEL), we cannot use
91 # this expression because some of the directories on the source tree may not
92 # exist in the build tree (for example the test/ heirarchy). Thus we evaluate
93 # the directory to eliminate the ../'s
96 TOP_DIRECTORY := $(shell cd $(TOPLEVEL); pwd)
98 TOP_DIRECTORY := $(shell cd $(LEVEL); pwd)
101 BUILD_ROOT_TOP := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(TOP_DIRECTORY))
107 #--------------------------------------------------------------------
108 # Variables derived from configuration options...
109 #--------------------------------------------------------------------
111 #BinInstDir=/usr/local/bin
112 #LibInstDir=/usrl/local/lib/xxx
113 #DocInstDir=/usr/doc/xxx
117 PURIFY := $(PURIFY) -cache-dir="$(BUILD_ROOT_TOP)/../purifycache" -chain-length="30" -messages=all
119 ifdef ENABLE_PROFILING
121 CONFIGURATION := Profile
123 ifdef ENABLE_OPTIMIZED
124 CONFIGURATION := Release
126 CONFIGURATION := Debug
130 # Shorthand for commonly accessed directories
131 DESTLIBDEBUG := $(BUILD_ROOT_TOP)/lib/Debug
132 DESTLIBRELEASE := $(BUILD_ROOT_TOP)/lib/Release
133 DESTLIBPROFILE := $(BUILD_ROOT_TOP)/lib/Profile
134 DESTLIBCURRENT := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
137 LLVMLIBDEBUGSOURCE := $(LLVM_LIB_DIR)/lib/Debug
138 LLVMLIBRELEASESOURCE := $(LLVM_LIB_DIR)/lib/Release
139 LLVMLIBPROFILESOURCE := $(LLVM_LIB_DIR)/lib/Profile
140 LLVMLIBCURRENTSOURCE := $(LLVM_LIB_DIR)/lib/$(CONFIGURATION)
142 PROJLIBDEBUGSOURCE := $(BUILD_ROOT_TOP)/lib/Debug
143 PROJLIBRELEASESOURCE := $(BUILD_ROOT_TOP)/lib/Release
144 PROJLIBPROFILESOURCE := $(BUILD_ROOT_TOP)/lib/Profile
145 PROJLIBCURRENTSOURCE := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
149 LLVMLIBDEBUGSOURCE := $(BUILD_ROOT_TOP)/lib/Debug
150 LLVMLIBRELEASESOURCE := $(BUILD_ROOT_TOP)/lib/Release
151 LLVMLIBPROFILESOURCE := $(BUILD_ROOT_TOP)/lib/Profile
152 LLVMLIBCURRENTSOURCE := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
156 TOOLDEBUG := $(BUILD_ROOT_TOP)/tools/Debug
157 TOOLRELEASE := $(BUILD_ROOT_TOP)/tools/Release
158 TOOLPROFILE := $(BUILD_ROOT_TOP)/tools/Profile
159 TOOLCURRENT := $(BUILD_ROOT_TOP)/tools/$(CONFIGURATION)
166 #---------------------------------------------------------
167 # Compilation options...
168 #---------------------------------------------------------
170 # Special tools used while building the LLVM tree. Burg is built as part of the
173 BURG := $(TOOLCURRENT)/burg
174 RunBurg := $(BURG) $(BURG_OPTS)
177 # Enable this for profiling support with 'gprof'
178 # This automatically enables optimized builds.
179 ifdef ENABLE_PROFILING
183 #if PROJDIR is defined then we include PROJ DIR includes and libraries
187 PROJ_INCLUDE = $(PROJ_DIR)/include
190 # By default, strip symbol information from executable
192 STRIP = $(PLATFORMSTRIPOPTS)
193 STRIP_WARN_MSG = "(without symbols) "
196 # Allow gnu extensions...
197 CPPFLAGS += -D_GNU_SOURCE
199 # -Wno-unused-parameter
200 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include -I$(PROJ_INCLUDE)
201 CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions -fshort-enums
203 # Compile a cpp file, don't link...
204 Compile := $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
205 CompileG := $(Compile) -g -D_DEBUG
206 CompileO := $(Compile) $(CompileOptimizeOpts) -felide-constructors -fomit-frame-pointer
207 CompileP := $(Compile) $(CompileOptimizeOpts) -felide-constructors $(PROFILE)
209 # Compile a c file, don't link...
210 CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
211 CompileCG := $(CompileC) -g -D_DEBUG
212 CompileCO := $(CompileC) $(CompileOptimizeOpts) -fomit-frame-pointer
213 CompileCP := $(CompileC) $(CompileOptimizeOpts) $(PROFILE)
216 # Link final executable
218 ifdef ENABLE_PURIFY # To enable purify, build with 'gmake ENABLE_PURIFY=1'
219 Link := $(PURIFY) $(CXX) -static
225 LinkG := $(Link) -g -L$(PROJLIBDEBUGSOURCE) -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
226 LinkO := $(Link) -O3 -L$(PROJLIBRELEASESOURCE) -L$(LLVMLIBRELEASESOURCE)
227 LinkP := $(Link) -O3 -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
229 LinkG := $(Link) -g -L$(LLVMLIBDEBUGSOURCE) $(STRIP)
230 LinkO := $(Link) -O3 -L$(LLVMLIBRELEASESOURCE)
231 LinkP := $(Link) -O3 -L$(LLVMLIBPROFILESOURCE) $(PROFILE)
236 # Create one .o file from a bunch of .o files...
239 # MakeSO - Create a .so file from a .o files...
240 MakeSO := $(CXX) $(MakeSharedObjectOption)
241 MakeSOO := $(MakeSO) -O3
242 MakeSOP := $(MakeSOO) $(PROFILE)
244 # Create dependancy file from CPP file, send to stdout.
245 Depend := $(CXX) -MM -I$(LEVEL)/include -I$(PROJ_INCLUDE) $(CPPFLAGS)
246 DependC := $(CC) -MM -I$(LEVEL)/include -I$(PROJ_INCLUDE) $(CPPFLAGS)
248 # Archive a bunch of .o files into a .a file...
252 #----------------------------------------------------------
254 # Source includes all of the cpp files, and objects are derived from the
256 # The local Makefile can list other Source files via ExtraSource = ...
259 Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
262 Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source))))))
263 ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(Objs))
264 ObjectsP := $(addprefix $(BUILD_ROOT)/Profile/,$(Objs))
265 ObjectsG := $(addprefix $(BUILD_ROOT)/Debug/,$(Objs))
268 #---------------------------------------------------------
269 # Handle the DIRS and PARALLEL_DIRS options
270 #---------------------------------------------------------
273 all install clean test ::
274 $(VERB) for dir in ${DIRS}; do \
275 (cd $$dir; $(MAKE) $@) || exit 1; \
279 # Handle PARALLEL_DIRS
281 all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
282 install :: $(addsuffix /.makeinstall, $(PARALLEL_DIRS))
283 clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS))
284 test :: $(addsuffix /.maketest , $(PARALLEL_DIRS))
286 %/.makeall %/.makeinstall %/.makeclean %/.maketest:
287 $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
290 #---------------------------------------------------------
291 # Handle the LIBRARYNAME option - used when building libs...
292 #---------------------------------------------------------
294 # When libraries are built, they are allowed to optionally define the
295 # DONT_BUILD_RELINKED make variable, which, when defined, prevents a .o file
296 # from being built for the library. This .o files may then be linked to by a
297 # tool if the tool does not need (or want) the semantics a .a file provides
298 # (linking in only object files that are "needed"). If a library is never to
299 # be used in this way, it is better to define DONT_BUILD_RELINKED, and define
300 # BUILD_ARCHIVE instead.
302 # Some libraries must be built as .a files (libscalar for example) because if
303 # it's built as a .o file, then all of the constituent .o files in it will be
304 # linked into tools (for example gccas) even if they only use one of the parts
305 # of it. For this reason, sometimes it's useful to use libraries as .a files.
309 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
310 LIBRARYNAME := $(strip $(LIBRARYNAME))
312 LIBNAME_O := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).so
313 LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).so
314 LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).so
315 LIBNAME_AO := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a
316 LIBNAME_AP := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a
317 LIBNAME_AG := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a
318 LIBNAME_OBJO := $(DESTLIBRELEASE)/$(LIBRARYNAME).o
319 LIBNAME_OBJP := $(DESTLIBPROFILE)/$(LIBRARYNAME).o
320 LIBNAME_OBJG := $(DESTLIBDEBUG)/$(LIBRARYNAME).o
322 # dynamic target builds a shared object version of the library...
323 dynamic:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).so
325 # Does the library want a .o version built?
326 ifndef DONT_BUILD_RELINKED
327 all:: $(DESTLIBCURRENT)/$(LIBRARYNAME).o
330 # Does the library want an archive version built?
332 all:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).a
335 $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
336 @echo ======= Linking $(LIBRARYNAME) release library =======
337 $(VERB) $(MakeSOO) -o $@ $(ObjectsO) $(LibSubDirs) $(LibLinkOpts)
339 $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
340 @echo ======= Linking $(LIBRARYNAME) profile library =======
341 $(VERB) $(MakeSOP) -o $@ $(ObjectsP) $(LibSubDirs) $(LibLinkOpts)
343 $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
344 @echo ======= Linking $(LIBRARYNAME) debug library =======
345 $(VERB) $(MakeSO) -g -o $@ $(ObjectsG) $(LibSubDirs) $(LibLinkOpts)
347 $(LIBNAME_AO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
348 @echo ======= Linking $(LIBRARYNAME) release library =======
350 $(VERB) $(AR) $@ $(ObjectsO) $(LibSubDirs)
352 $(LIBNAME_AP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
353 @echo ======= Linking $(LIBRARYNAME) profile library =======
355 $(VERB) $(AR) $@ $(ObjectsP) $(LibSubDirs)
357 $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
358 @echo ======= Linking $(LIBRARYNAME) debug library =======
360 $(VERB) $(AR) $@ $(ObjectsG) $(LibSubDirs)
362 $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
364 $(VERB) $(Relink) -o $@ $(ObjectsO) $(LibSubDirs)
366 $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
368 $(VERB) $(Relink) -o $@ $(ObjectsP) $(LibSubDirs)
370 $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
372 $(VERB) $(Relink) -o $@ $(ObjectsG) $(LibSubDirs)
376 #------------------------------------------------------------------------
377 # Create a TAGS database for emacs
378 #------------------------------------------------------------------------
382 etags -l c++ `find include lib tools -name '*.cpp' -o -name '*.h'`
386 #------------------------------------------------------------------------
387 # Handle the TOOLNAME option - used when building tool executables...
388 #------------------------------------------------------------------------
390 # The TOOLNAME option should be used with a USEDLIBS variable that tells the
391 # libraries (and the order of the libs) that should be linked to the
392 # tool. USEDLIBS should contain a list of library names (some with .a extension)
393 # that are automatically linked in as .o files unless the .a suffix is added.
397 # TOOLEXENAME* - These compute the output filenames to generate...
398 TOOLEXENAME_G := $(BUILD_ROOT_TOP)/tools/Debug/$(TOOLNAME)
399 TOOLEXENAME_O := $(BUILD_ROOT_TOP)/tools/Release/$(TOOLNAME)
400 TOOLEXENAME_P := $(BUILD_ROOT_TOP)/tools/Profile/$(TOOLNAME)
401 TOOLEXENAMES := $(BUILD_ROOT_TOP)/tools/$(CONFIGURATION)/$(TOOLNAME)
403 # USED_LIBS_OPTIONS - Compute the options line that add -llib1 -llib2, etc.
406 PROJ_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
407 PROJ_LIBS_OPTIONS_G := $(patsubst %.o, $(PROJLIBDEBUGSOURCE)/%.o, $(PROJ_LIBS_OPTIONS))
408 PROJ_LIBS_OPTIONS_O := $(patsubst %.o, $(PROJLIBRELEASESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
409 PROJ_LIBS_OPTIONS_P := $(patsubst %.o, $(PROJLIBPROFILESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
411 LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
412 LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o, $(LLVM_LIBS_OPTIONS))
413 LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
414 LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
416 LIB_OPTS_G := $(LLVM_LIBS_OPTIONS_G) $(PROJ_LIBS_OPTIONS_G)
417 LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_P)
418 LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P) $(PROJ_LIBS_OPTIONS_P)
422 LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
423 LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o, $(LLVM_LIBS_OPTIONS))
424 LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
425 LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
427 LIB_OPTS_G := $(LLVM_LIBS_OPTIONS_G)
428 LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O)
429 LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P)
437 # USED_LIB_PATHS - Compute the path of the libraries used so that tools are
438 # rebuilt if libraries change. This has to make sure to handle .a/.so and .o
441 STATICUSEDLIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
442 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
443 USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS))
444 USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS))
445 LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
452 # Tell make that we need to rebuild subdirectories before we can link the tool.
453 # This affects things like LLI which has library subdirectories.
454 $(USED_LIB_PATHS_G) $(USED_LIB_PATHS_O) $(USED_LIB_PATHS_P): \
455 $(addsuffix /.makeall, $(PARALLEL_DIRS))
457 all:: $(TOOLEXENAMES)
459 $(VERB) rm -f $(TOOLEXENAMES)
461 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(TOOLDEBUG)/.dir
462 @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)=======
463 $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS)
465 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(TOOLRELEASE)/.dir
466 @echo ======= Linking $(TOOLNAME) release executable =======
467 $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS)
469 $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(TOOLPROFILE)/.dir
470 @echo ======= Linking $(TOOLNAME) profile executable =======
471 $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS)
477 #---------------------------------------------------------
478 .PRECIOUS: $(BUILD_ROOT)/Depend/.dir
479 .PRECIOUS: $(BUILD_ROOT)/Debug/.dir $(BUILD_ROOT)/Release/.dir
481 # Create .o files in the ObjectFiles directory from the .cpp and .c files...
482 $(BUILD_ROOT)/Release/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Release/.dir
484 $(VERB) $(CompileO) $< -o $@
486 $(BUILD_ROOT)/Release/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Release/.dir
487 $(VERB) $(CompileCO) $< -o $@
489 $(BUILD_ROOT)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Profile/.dir
491 $(VERB) $(CompileP) $< -o $@
493 $(BUILD_ROOT)/Profile/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Profile/.dir
495 $(VERB) $(CompileCP) $< -o $@
497 $(BUILD_ROOT)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Debug/.dir
499 $(VERB) $(CompileG) $< -o $@
501 $(BUILD_ROOT)/Debug/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Debug/.dir
502 $(VERB) $(CompileCG) $< -o $@
505 # Rules for building lex/yacc files
507 LEX_FILES = $(filter %.l, $(Source))
508 LEX_OUTPUT = $(LEX_FILES:%.l=%.cpp)
509 YACC_FILES = $(filter %.y, $(Source))
510 YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
511 .PRECIOUS: $(LEX_OUTPUT) $(YACC_OUTPUT)
513 # Create a .cpp source file from a flex input file... this uses sed to cut down
514 # on the warnings emited by GCC...
516 # The last line is a gross hack to work around flex aparently not being able to
517 # resize the buffer on a large token input. Currently, for uninitialized string
518 # buffers in LLVM we can generate very long tokens, so this is a hack around it.
519 # FIXME. (f.e. char Buffer[10000]; )
522 flex -t $< | sed '/^find_rule/d' | \
523 sed 's/void yyunput/inline void yyunput/' | \
524 sed 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
525 sed 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@
527 # Rule for building the bison parsers...
528 %.c: %.y # Cancel built-in rules for yacc
529 %.h: %.y # Cancel built-in rules for yacc
531 @echo Bison\'ing $<...
532 $(VERB) $(BISON) -v -d -p $(<:%Parser.y=%) $*.y
533 $(VERB) mv -f $*.tab.c $*.cpp
534 $(VERB) mv -f $*.tab.h $*.h
536 # To create the directories...
541 # To create postscript files from dot files...
545 # 'make clean' nukes the tree
547 $(VERB) rm -rf $(BUILD_ROOT)/Debug $(BUILD_ROOT)/Release $(BUILD_ROOT)/Profile $(BUILD_ROOT)/Depend
548 $(VERB) rm -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
549 $(VERB) rm -f $(LEX_OUTPUT) $(YACC_OUTPUT)
551 # If dependencies were generated for the file that included this file,
552 # include the dependancies now...
554 SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source))))
555 SourceDepend := $(SourceBaseNames:%=$(BUILD_ROOT)/Depend/%.d)
557 # Create dependencies for the *.cpp files...
559 $(BUILD_ROOT)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_ROOT)/Depend/.dir
560 $(VERB) $(Depend) $< | sed 's|$*\.o *|$(BUILD_ROOT)/Release/& $(BUILD_ROOT)/Profile/& $(BUILD_ROOT)/Debug/& $(BUILD_ROOT)/Depend/$(@F)|g' > $@
562 # Create dependencies for the *.c files...
564 $(BUILD_ROOT)/Depend/%.d: $(SourceDir)%.c $(BUILD_ROOT)/Depend/.dir
565 $(VERB) $(DependC) $< | sed 's|$*\.o *|Release/& Profile/& Debug/& Depend/$(@F)|g' > $@
567 ifneq ($(SourceDepend),)
568 -include $(SourceDepend)