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 # 6. PROJ_COMPILE - If set to 1, then this makefile can also be used to
34 # compile other projects using llvm. Note if this option is set then the
35 # following *must* hold
36 # PROJLEVEL should be set to the top of the source directory for the
38 # LEVEL should be set to the top of LLVM source tree
39 # LLVM_LIB_DIR should be set to the top of the LLVM build tree
42 #===-----------------------------------------------------------------------====
44 # Configuration file to set paths specific to local installation of LLVM
46 include $(LEVEL)/Makefile.config
48 # Figure out how to do platform specific stuff on this platform. This is really
49 # gross and should be autoconfiscated (automake actually), but should hopefully
50 # work on Linux and solaris (SunOS).
52 UNAME := $(shell uname)
53 include $(LEVEL)/Makefile.$(UNAME)
56 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
60 # Default Rule: Make sure it's also a :: rule
63 # Default for install is to at least build everything...
67 # Figure out which directory to build stuff into. We want to build into the
68 # /shared directory by default because it is guaranteed to be local to the
72 ifeq ($(LLVM_OBJ_DIR),.)
73 BUILD_ROOT = $(LLVM_OBJ_DIR)
76 BUILD_ROOT_TOP = $(PROJLEVEL)
78 BUILD_ROOT_TOP = $(LEVEL)
83 BUILD_ROOT := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(shell pwd))
85 # Calculate the BUILD_ROOT_TOP variable, which is the top of the llvm/ tree.
86 # Note that although this is just equal to $(BUILD_ROOT)/$(LEVEL), we cannot use
87 # this expression because some of the directories on the source tree may not
88 # exist in the build tree (for example the test/ heirarchy). Thus we evaluate
89 # the directory to eliminate the ../'s
92 TOP_DIRECTORY := $(shell cd $(PROJLEVEL); pwd)
94 TOP_DIRECTORY := $(shell cd $(LEVEL); pwd)
97 BUILD_ROOT_TOP := $(LLVM_OBJ_DIR)$(patsubst $(HOME)%,%,$(TOP_DIRECTORY))
103 #--------------------------------------------------------------------
104 # Variables derived from configuration options...
105 #--------------------------------------------------------------------
107 #BinInstDir=/usr/local/bin
108 #LibInstDir=/usr/local/lib/xxx
109 #DocInstDir=/usr/doc/xxx
113 PURIFY := $(PURIFY) -cache-dir="$(BUILD_ROOT_TOP)/../purifycache" -chain-length="30" -messages=all
115 ifdef ENABLE_PROFILING
117 CONFIGURATION := Profile
119 ifdef ENABLE_OPTIMIZED
120 CONFIGURATION := Release
122 CONFIGURATION := Debug
126 # Shorthand for commonly accessed directories
127 # DESTLIBXYZ indicates destination for the libraries built
128 DESTLIBDEBUG := $(BUILD_ROOT_TOP)/lib/Debug
129 DESTLIBRELEASE := $(BUILD_ROOT_TOP)/lib/Release
130 DESTLIBPROFILE := $(BUILD_ROOT_TOP)/lib/Profile
131 DESTLIBCURRENT := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
134 #get the llvm libraries from LLVM_LIB_DIR
135 LLVMLIBDEBUGSOURCE := $(LLVM_LIB_DIR)/lib/Debug
136 LLVMLIBRELEASESOURCE := $(LLVM_LIB_DIR)/lib/Release
137 LLVMLIBPROFILESOURCE := $(LLVM_LIB_DIR)/lib/Profile
138 LLVMLIBCURRENTSOURCE := $(LLVM_LIB_DIR)/lib/$(CONFIGURATION)
140 PROJLIBDEBUGSOURCE := $(BUILD_ROOT_TOP)/lib/Debug
141 PROJLIBRELEASESOURCE := $(BUILD_ROOT_TOP)/lib/Release
142 PROJLIBPROFILESOURCE := $(BUILD_ROOT_TOP)/lib/Profile
143 PROJLIBCURRENTSOURCE := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
146 #when we are building llvm, destination is same as source
147 LLVMLIBDEBUGSOURCE := $(BUILD_ROOT_TOP)/lib/Debug
148 LLVMLIBRELEASESOURCE := $(BUILD_ROOT_TOP)/lib/Release
149 LLVMLIBPROFILESOURCE := $(BUILD_ROOT_TOP)/lib/Profile
150 LLVMLIBCURRENTSOURCE := $(BUILD_ROOT_TOP)/lib/$(CONFIGURATION)
154 TOOLDEBUG := $(BUILD_ROOT_TOP)/tools/Debug
155 TOOLRELEASE := $(BUILD_ROOT_TOP)/tools/Release
156 TOOLPROFILE := $(BUILD_ROOT_TOP)/tools/Profile
157 TOOLCURRENT := $(BUILD_ROOT_TOP)/tools/$(CONFIGURATION)
164 #---------------------------------------------------------
165 # Compilation options...
166 #---------------------------------------------------------
168 # Special tools used while building the LLVM tree. Burg is built as part of the
171 BURG := $(TOOLCURRENT)/burg
172 RunBurg := $(BURG) $(BURG_OPTS)
174 TBLGEN := $(TOOLCURRENT)/tblgen
176 # Enable this for profiling support with 'gprof'
177 # This automatically enables optimized builds.
178 ifdef ENABLE_PROFILING
182 #if PROJDIR is defined then we include project include directory
186 PROJ_INCLUDE = $(TOP_DIRECTORY)/include
189 # By default, strip symbol information from executable
191 STRIP = $(PLATFORMSTRIPOPTS)
192 STRIP_WARN_MSG = "(without symbols) "
195 # Allow gnu extensions...
196 CPPFLAGS += -D_GNU_SOURCE
198 # -Wno-unused-parameter
199 CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include -I$(PROJ_INCLUDE)
200 CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions -fshort-enums
202 # Compile a cpp file, don't link...
203 Compile := $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts)
204 CompileG := $(Compile) -g -D_DEBUG
205 CompileO := $(Compile) $(CompileOptimizeOpts) -felide-constructors -fomit-frame-pointer
206 CompileP := $(Compile) $(CompileOptimizeOpts) -felide-constructors $(PROFILE)
208 # Compile a c file, don't link...
209 CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
210 CompileCG := $(CompileC) -g -D_DEBUG
211 CompileCO := $(CompileC) $(CompileOptimizeOpts) -fomit-frame-pointer
212 CompileCP := $(CompileC) $(CompileOptimizeOpts) $(PROFILE)
215 # Link final executable
217 ifdef ENABLE_PURIFY # To enable purify, build with 'gmake ENABLE_PURIFY=1'
218 Link := $(PURIFY) $(CXX) -static
224 # include both projlib source and llvmlib source
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...
251 #----------------------------------------------------------
253 # Source includes all of the cpp files, and objects are derived from the
255 # The local Makefile can list other Source files via ExtraSource = ...
258 Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l)
261 Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source))))))
262 ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(Objs))
263 ObjectsP := $(addprefix $(BUILD_ROOT)/Profile/,$(Objs))
264 ObjectsG := $(addprefix $(BUILD_ROOT)/Debug/,$(Objs))
267 #---------------------------------------------------------
268 # Handle the DIRS and PARALLEL_DIRS options
269 #---------------------------------------------------------
272 all install clean test ::
273 $(VERB) for dir in ${DIRS}; do \
274 (cd $$dir; $(MAKE) $@) || exit 1; \
278 # Handle PARALLEL_DIRS
280 all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
281 install :: $(addsuffix /.makeinstall, $(PARALLEL_DIRS))
282 clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS))
283 test :: $(addsuffix /.maketest , $(PARALLEL_DIRS))
285 %/.makeall %/.makeinstall %/.makeclean %/.maketest:
286 $(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
289 #---------------------------------------------------------
290 # Handle the LIBRARYNAME option - used when building libs...
291 #---------------------------------------------------------
293 # When libraries are built, they are allowed to optionally define the
294 # DONT_BUILD_RELINKED make variable, which, when defined, prevents a .o file
295 # from being built for the library. This .o files may then be linked to by a
296 # tool if the tool does not need (or want) the semantics a .a file provides
297 # (linking in only object files that are "needed"). If a library is never to
298 # be used in this way, it is better to define DONT_BUILD_RELINKED, and define
299 # BUILD_ARCHIVE instead.
301 # Some libraries must be built as .a files (libscalar for example) because if
302 # it's built as a .o file, then all of the constituent .o files in it will be
303 # linked into tools (for example gccas) even if they only use one of the parts
304 # of it. For this reason, sometimes it's useful to use libraries as .a files.
308 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
309 LIBRARYNAME := $(strip $(LIBRARYNAME))
311 LIBNAME_O := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).so
312 LIBNAME_P := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).so
313 LIBNAME_G := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).so
314 LIBNAME_AO := $(DESTLIBRELEASE)/lib$(LIBRARYNAME).a
315 LIBNAME_AP := $(DESTLIBPROFILE)/lib$(LIBRARYNAME).a
316 LIBNAME_AG := $(DESTLIBDEBUG)/lib$(LIBRARYNAME).a
317 LIBNAME_OBJO := $(DESTLIBRELEASE)/$(LIBRARYNAME).o
318 LIBNAME_OBJP := $(DESTLIBPROFILE)/$(LIBRARYNAME).o
319 LIBNAME_OBJG := $(DESTLIBDEBUG)/$(LIBRARYNAME).o
321 # dynamic target builds a shared object version of the library...
322 dynamic:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).so
324 # Does the library want a .o version built?
325 ifndef DONT_BUILD_RELINKED
326 all:: $(DESTLIBCURRENT)/$(LIBRARYNAME).o
329 # Does the library want an archive version built?
331 all:: $(DESTLIBCURRENT)/lib$(LIBRARYNAME).a
334 $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
335 @echo ======= Linking $(LIBRARYNAME) release library =======
336 $(VERB) $(MakeSOO) -o $@ $(ObjectsO) $(LibSubDirs) $(LibLinkOpts)
338 $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
339 @echo ======= Linking $(LIBRARYNAME) profile library =======
340 $(VERB) $(MakeSOP) -o $@ $(ObjectsP) $(LibSubDirs) $(LibLinkOpts)
342 $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
343 @echo ======= Linking $(LIBRARYNAME) debug library =======
344 $(VERB) $(MakeSO) -g -o $@ $(ObjectsG) $(LibSubDirs) $(LibLinkOpts)
346 $(LIBNAME_AO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
347 @echo ======= Linking $(LIBRARYNAME) release library =======
349 $(VERB) $(AR) $@ $(ObjectsO) $(LibSubDirs)
351 $(LIBNAME_AP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
352 @echo ======= Linking $(LIBRARYNAME) profile library =======
354 $(VERB) $(AR) $@ $(ObjectsP) $(LibSubDirs)
356 $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
357 @echo ======= Linking $(LIBRARYNAME) debug library =======
359 $(VERB) $(AR) $@ $(ObjectsG) $(LibSubDirs)
361 $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
363 $(VERB) $(Relink) -o $@ $(ObjectsO) $(LibSubDirs)
365 $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
367 $(VERB) $(Relink) -o $@ $(ObjectsP) $(LibSubDirs)
369 $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
371 $(VERB) $(Relink) -o $@ $(ObjectsG) $(LibSubDirs)
375 #------------------------------------------------------------------------
376 # Create a TAGS database for emacs
377 #------------------------------------------------------------------------
381 etags -l c++ `find include lib tools -name '*.cpp' -o -name '*.h'`
385 #------------------------------------------------------------------------
386 # Handle the TOOLNAME option - used when building tool executables...
387 #------------------------------------------------------------------------
389 # The TOOLNAME option should be used with a USEDLIBS variable that tells the
390 # libraries (and the order of the libs) that should be linked to the
391 # tool. USEDLIBS should contain a list of library names (some with .a extension)
392 # that are automatically linked in as .o files unless the .a suffix is added.
396 # TOOLEXENAME* - These compute the output filenames to generate...
397 TOOLEXENAME_G := $(BUILD_ROOT_TOP)/tools/Debug/$(TOOLNAME)
398 TOOLEXENAME_O := $(BUILD_ROOT_TOP)/tools/Release/$(TOOLNAME)
399 TOOLEXENAME_P := $(BUILD_ROOT_TOP)/tools/Profile/$(TOOLNAME)
400 TOOLEXENAMES := $(BUILD_ROOT_TOP)/tools/$(CONFIGURATION)/$(TOOLNAME)
402 # USED_LIBS_OPTIONS - Compute the options line that add -llib1 -llib2, etc.
405 PROJ_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
406 PROJ_LIBS_OPTIONS_G := $(patsubst %.o, $(PROJLIBDEBUGSOURCE)/%.o, $(PROJ_LIBS_OPTIONS))
407 PROJ_LIBS_OPTIONS_O := $(patsubst %.o, $(PROJLIBRELEASESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
408 PROJ_LIBS_OPTIONS_P := $(patsubst %.o, $(PROJLIBPROFILESOURCE)/%.o,$(PROJ_LIBS_OPTIONS))
410 LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
411 LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o, $(LLVM_LIBS_OPTIONS))
412 LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
413 LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
415 LIB_OPTS_G := $(LLVM_LIBS_OPTIONS_G) $(PROJ_LIBS_OPTIONS_G)
416 LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O) $(PROJ_LIBS_OPTIONS_P)
417 LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P) $(PROJ_LIBS_OPTIONS_P)
421 LLVM_LIBS_OPTIONS := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
422 LLVM_LIBS_OPTIONS_G := $(patsubst %.o, $(LLVMLIBDEBUGSOURCE)/%.o, $(LLVM_LIBS_OPTIONS))
423 LLVM_LIBS_OPTIONS_O := $(patsubst %.o, $(LLVMLIBRELEASESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
424 LLVM_LIBS_OPTIONS_P := $(patsubst %.o, $(LLVMLIBPROFILESOURCE)/%.o,$(LLVM_LIBS_OPTIONS))
426 LIB_OPTS_G := $(LLVM_LIBS_OPTIONS_G)
427 LIB_OPTS_O := $(LLVM_LIBS_OPTIONS_O)
428 LIB_OPTS_P := $(LLVM_LIBS_OPTIONS_P)
436 # USED_LIB_PATHS - Compute the path of the libraries used so that tools are
437 # rebuilt if libraries change. This has to make sure to handle .a/.so and .o
440 STATICUSEDLIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
441 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
442 USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS))
443 USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS))
444 LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
451 # Tell make that we need to rebuild subdirectories before we can link the tool.
452 # This affects things like LLI which has library subdirectories.
453 $(USED_LIB_PATHS_G) $(USED_LIB_PATHS_O) $(USED_LIB_PATHS_P): \
454 $(addsuffix /.makeall, $(PARALLEL_DIRS))
456 all:: $(TOOLEXENAMES)
458 $(VERB) rm -f $(TOOLEXENAMES)
460 $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(TOOLDEBUG)/.dir
461 @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)=======
462 $(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS)
464 $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(TOOLRELEASE)/.dir
465 @echo ======= Linking $(TOOLNAME) release executable =======
466 $(VERB) $(LinkO) -o $@ $(ObjectsO) $(LIB_OPTS_O) $(LINK_OPTS)
468 $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(TOOLPROFILE)/.dir
469 @echo ======= Linking $(TOOLNAME) profile executable =======
470 $(VERB) $(LinkP) -o $@ $(ObjectsP) $(LIB_OPTS_P) $(LINK_OPTS)
476 #---------------------------------------------------------
477 .PRECIOUS: $(BUILD_ROOT)/Depend/.dir
478 .PRECIOUS: $(BUILD_ROOT)/Debug/.dir $(BUILD_ROOT)/Release/.dir
480 # Create .o files in the ObjectFiles directory from the .cpp and .c files...
481 $(BUILD_ROOT)/Release/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Release/.dir
483 $(VERB) $(CompileO) $< -o $@
485 $(BUILD_ROOT)/Release/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Release/.dir
486 $(VERB) $(CompileCO) $< -o $@
488 $(BUILD_ROOT)/Profile/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Profile/.dir
490 $(VERB) $(CompileP) $< -o $@
492 $(BUILD_ROOT)/Profile/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Profile/.dir
494 $(VERB) $(CompileCP) $< -o $@
496 $(BUILD_ROOT)/Debug/%.o: $(SourceDir)%.cpp $(BUILD_ROOT)/Debug/.dir
498 $(VERB) $(CompileG) $< -o $@
500 $(BUILD_ROOT)/Debug/%.o: $(SourceDir)%.c $(BUILD_ROOT)/Debug/.dir
501 $(VERB) $(CompileCG) $< -o $@
504 # Rules for building lex/yacc files
506 LEX_FILES = $(filter %.l, $(Source))
507 LEX_OUTPUT = $(LEX_FILES:%.l=%.cpp)
508 YACC_FILES = $(filter %.y, $(Source))
509 YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
510 .PRECIOUS: $(LEX_OUTPUT) $(YACC_OUTPUT)
512 # Create a .cpp source file from a flex input file... this uses sed to cut down
513 # on the warnings emited by GCC...
515 # The last line is a gross hack to work around flex aparently not being able to
516 # resize the buffer on a large token input. Currently, for uninitialized string
517 # buffers in LLVM we can generate very long tokens, so this is a hack around it.
518 # FIXME. (f.e. char Buffer[10000]; )
521 $(FLEX) -t $< | sed '/^find_rule/d' | \
522 sed 's/void yyunput/inline void yyunput/' | \
523 sed 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \
524 sed 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' > $@
526 # Rule for building the bison parsers...
527 %.c: %.y # Cancel built-in rules for yacc
528 %.h: %.y # Cancel built-in rules for yacc
530 @echo Bison\'ing $<...
531 $(VERB) $(BISON) -v -d -p $(<:%Parser.y=%) $*.y
532 $(VERB) mv -f $*.tab.c $*.cpp
533 $(VERB) mv -f $*.tab.h $*.h
535 # To create the directories...
540 # To create postscript files from dot files...
544 # 'make clean' nukes the tree
546 $(VERB) rm -rf $(BUILD_ROOT)/Debug $(BUILD_ROOT)/Release $(BUILD_ROOT)/Profile $(BUILD_ROOT)/Depend
547 $(VERB) rm -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
548 $(VERB) rm -f $(LEX_OUTPUT) $(YACC_OUTPUT)
550 # If dependencies were generated for the file that included this file,
551 # include the dependancies now...
553 SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source))))
554 SourceDepend := $(SourceBaseNames:%=$(BUILD_ROOT)/Depend/%.d)
556 # Create dependencies for the *.cpp files...
558 $(BUILD_ROOT)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_ROOT)/Depend/.dir
559 $(VERB) $(Depend) $< | sed 's|$*\.o *|$(BUILD_ROOT)/Release/& $(BUILD_ROOT)/Profile/& $(BUILD_ROOT)/Debug/& $(BUILD_ROOT)/Depend/$(@F)|g' > $@
561 # Create dependencies for the *.c files...
563 $(BUILD_ROOT)/Depend/%.d: $(SourceDir)%.c $(BUILD_ROOT)/Depend/.dir
564 $(VERB) $(DependC) $< | sed 's|$*\.o *|Release/& Profile/& Debug/& Depend/$(@F)|g' > $@
566 ifneq ($(SourceDepend),)
567 -include $(SourceDepend)