Sunday, July 15, 2007

Aspect-oriented C ( ACC ) Set Up

First, we download ACC from www.aspectc.net and make it following the README. ACC script tacc can automatically compile aspect files (with suffix .acc) with regular .c files. To use tacc, we need setup several environment variables:
For example, in .bashrc

export PATH=$PATH:.:/ACC_PATH/bin
export CC=tacc
export SRCROOT=/PBXT_SOURCE_CODE_PATH/src
export AR=accar

SRCROOT is our source code (i.e. pbxt) directory. We also put .acc files in the same source code directory. Then, we can run ./configure inside PBXT source code directory as before. E.g,

./configure --with-mysql=/home/build/mysql-51 --libdir=/home/build/test/lib/mysql --with-debug=full

It will automatically generate a makefile which uses ACC command.
Note, in our case, we have mixed .cc and .c files. Since ACC does not work with .cc, we need use gcc to link file instead of using g++. So, we have to manually change TAG inside Makefile in PBXT src. That is, in line

CXXLINK = $(LIBTOOL) --tag=CXX …

We change the tag to be --tag=CC.

No comments: