From: <sg...@us...> - 2003-09-05 09:35:32
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv25087/toc/make Added Files: flex.make Log Message: egg --- NEW FILE: flex.make --- #!make # snippet to compile .flex files into .cpp # usage: # define: # FLEXES = foo bar # all: flex_files # You must have foo.flex for each $(FLEXES) and foo.flex.cpp will # be generated. It will be "massaged" a bit to allow it to compile # under newer GCC versions (3.2+ish, i think). FLEX_CPPFILE_SUFFIX = .cpp FLEX_FILE_SUFFIX ?= .flex %$(FLEX_FILE_SUFFIX):# undefine make's implicite rule FLEX_MAKEFILE = $(toc_makesdir)/flex.make ifneq (,$(FLEXES)) FLEX_BIN = $(firstword $(wildcard $(addsuffix /flex,$(subst :, ,$(PATH))))) ifeq (,$(FLEX_BIN)) $(error This makefile snippet requires that 'flex' be found in the PATH!) endif FLEX_FLEX_FILES = $(addsuffix $(FLEX_FILE_SUFFIX),$(FLEXES)) FLEX_CPP_FILES = $(addsuffix $(FLEX_CPPFILE_SUFFIX),$(FLEX_FLEX_FILES)) # $(FLEX_FLEX_FILES): Makefile # %.flex: Makefile %$(FLEX_FILE_SUFFIX)$(FLEX_CPPFILE_SUFFIX): %$(FLEX_FILE_SUFFIX) $(FLEX_MAKEFILE) Makefile @echo "Flexing $< to $@, plus doing iostream hacks :/."; \ flex -+ -t $< | \ perl -p \ -e 's/iostream\.h/iostream/;' \ -e 'next if m/iostream/;' \ -e 'next if m/::[io]stream/;' \ -e 's/(ostream|istream)([^\.])/std::$$1$$2/g;' > $@ CLEAN_FILES += $(FLEX_CPP_FILES) flexes: $(FLEX_CPP_FILES) else flexes: endif |