Build System Source Code Generation Module


Overview

The Build System Source Code Generation Module provides the build system with the ability to generate source code from other sources. This includes the ability to run lex and yacc.

Macros and Controls

XXX Not yet doc'ed

Targets


LEX_TARGETS

LEX_TARGETS Overview

LEX_TARGETS is the lex pre-processor pattern target. This pattern target is used to produce C source code from lex files. LEX_TARGETS patten targets will be built during the "pretarget" phase of a build. The general form of the lex command used to generate source code files is as follows:
<lex> <lex flags> -o <lex target> <lex source>

The <lex flags> used to build the source code file are assembled from the following macros in the indicated order:

FLAGS_LEX

LEX_TARGETS Options

<lex target>_LEX
Override the default lex binary for the current target.

<lex target>_LEXFLAGS
Override FLAGS_LEX for the current <lex target>.

<lex target>_DEP
Specify additional dependancies for the current <lex target>.

<lex target>_SRC
Override the default source file location of <lex target:%.yy.c=%.l>


YACC_TARGETS

YACC_TARGETS Overview

YACC_TARGETS is the yacc pre-processor pattern target. This pattern target is used to produce C source code from yacc files. YACC_TARGETS patten targets will be built during the "pretarget" phase of a build. The general form of the yacc command used to generate source code files is as follows:
<yacc> <yacc flags> --output=<yacc target> <yacc source>

The <yacc flags> used to build the source code file are assembled from the following macros in the indicated order:

FLAGS_YACC

YACC_TARGETS Options

<yacc target>_YACC
Override the default yacc binary for the current target.

<yacc target>_YACCFLAGS
Override FLAGS_YACC for the current <yacc target>.

<yacc target>_DEP
Specify additional dependancies for the current <yacc target>.

<yacc target>_SRC
Override the default source file location of <yacc target:%.tab.c=%.y>


codegen_lex

codegen_lex Overview

Simple target to trigger the building of LEX_TARGETS pattern targets independent of the main build "pretarget" phase.

codegen_yacc

codegen_lex Overview

Simple target to trigger the building of YACC_TARGETS pattern targets independent of the main build "pretarget" phase.

codegen_info

codegen_info Overview

Simple target to display information about the macro settings of all global macros used by the source code generation module of the build system. The codegen_info target will be built during the "info" phase of a build, and can be built in isolation by requesting the codegen_info target.

codegen_man

codegen_man Overview

Simple targes to display usage information and help pertaining to the source code generation module of the build system. The codegen_man target will be built during the "man" phase of a build, and can be built in isolation by requesting the codegen_man target.

Example Makefile


# The source root of this Component
COMPONENT_ROOT=../..

# The root of the build system
BS_ROOT=$(COMPONENT_ROOT)/../build3

# Boostrap Build system definitions.
include $(BS_ROOT)/defines.mk

#
# Set up global C flags for Lex/Yacc
#

FLAGS_CC+=-I$(BS_ARCH_TARGET_DIR)

# Generate src code from lex code.
LEX_TARGETS=foo.yy.c

# Generate src code from yacc code.
YACC_TARGETS=bar.tab.c


# Specify bare C object pattern targets
OBJ_CC_TARGETS=foo.yy.o bar.tab.o


foo.yy.o_SRC=$(BS_ARCH_TARGET_DIR)/foo.yy.c
bar.tab.o_SRC=$(BS_ARCH_TARGET_DIR)/bar.tab.c


# Finally, include the rules to make the build system go.
include $(BS_ROOT)/rules.mk