Integrating Ragel 5 with Xcode 2
Using a single custom build rule for C, C++, Objective-C and Objective-C++
By naming your source files as you intend the output to be, then appending rather than replacing the extension with '.rl', Xcode can use the following single build rule to process '.rl' files targeting C, C++, Objective-C, and Objective-C++.
Screenshot of configured build rule
Source files with names matching:
*.c.rl *.cpp.rl *.cp.rl *.cxx.rl *.m.rl *.mm.rl
This script uses an intermediate file with the extension '.ragel', this same file is processed by 'rlcodegen' to generate the source code and '.dot' graph.
Custom script:
RAGEL=/opt/local/bin/ragel
RLCODEGEN=/opt/local/bin/rlcodegen
${RAGEL} -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.ragel ${INPUT_FILE_PATH} || exit
${RLCODEGEN} -G2 -C -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE} ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.ragel || exit
${RLCODEGEN} -V ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.ragel > ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.dot
Output files:
$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE) $(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).dot
Links
In case you want to download the latest:
- Ragel State Machine Compiler - Ragel compiles finite state machines from regular languages into subsequently compilable C/C++/Objective-C/D code, with no other dependencies.
- Graphviz - Automated graph layout software using a very simple text file.
- Pixelglow Graphviz - The Mac OS X port of the above automated graph layout software, featuring a new document-based GUI, export to PDF and many more bitmap formats, full alpha transparency, native font and shapefile support and anti-aliasing.