文章标签 » Makefile

接上一篇

有必要给blogo2加个追加功能。。可以直接把mail追加到最新一篇blog的后面
————————
gcc之预处理js和as,下面的makefile主要处理flash的两个版本,SSL版本要比普通版本大150K。。感谢gcc

FLAGS="-DDEBUG"
 
define make-all
	gcc $(FLAGS) $1 -E -x c src/swfsocket.js -o $2/swfsocket.js 
	gcc $(FLAGS) $1 -E -x c src/swf/SwfSocket.rel.as -o src/swf/SwfSocket.as
	sed -i "/^#/d" $2/swfsocket.js
	sed -i "/^#/d" src/swf/SwfSocket.as
	cd src/swf; \
	mxmlc -static-link-runtime-shared-libraries -output=./SwfSocket.swf SwfSocketMain.as
	mv src/swf/SwfSocket.swf $2 
endef
 
main:
	$(call make-all,,bin)
	$(call make-all,-DSSL,bin_ssl)

———–
post by gmail~

Makefile中配置debug版本

参考:http://hi.baidu.com/wg_wang/blog/item/c79a1a7a4d375ee02f73b377.html

CC=gcc 
CFLAGS= 
SYSLIBS= -lmysqlclient
LIBS=${SYSLIBS} ${OWNLIBS}
BIN_DIR=./bin
DEBUG_DIR=./debug
SOURCE=./src
VPATH=${SOURCE}
objects=log.o base64.o get_avatar.o
release_name=get_avatar
 
%.o:%.c
	$(CC) -c $(CFLAGS) $(LIBS) $< -o ${SOURCE}/$@
%.debug.o:%.c
	$(CC) -D DEBUG -c $(CFLAGS) $(LIBS) $< -o ${SOURCE}/$@
 
all: release 
release: $(objects)
	${CC} ${CFLAGS} ${LIBS} $^ -o ${BIN_DIR}/${release_name}
debug: $(objects:.o=.debug.o)
	${CC} -g ${CFLAGS} ${LIBS} $^ -o ${DEBUG_DIR}/${release_name} 
base64_debug: base64.c
	${CC} -g -D BASE64_DEBUG ${CFLAGS} ${LIBS} ${SOURCE}/base64.c -o ${DEBUG_DIR}/base64test
clean:
	rm ${SOURCE}/*.o

———–
post by gmail~