分类: C/C++
2007-03-22 21:13:27
CC = g++ps: 之所以CC = g++是因为其中用到gts等C++写就的library,而且头文件里就包含有C++语法,因此将就着应付一下。。。
GTK_CFLAGS = $(shell gdk-pixbuf-config --cflags)
GTK_LIBS = $(shell gdk-pixbuf-config --libs) $(shell pkg-config --libs gthread)
MYSQL_CFLAGS = $(shell mysql_config --cflags)
MYSQL_LIBS = $(shell mysql_config --libmysqld-libs)
CFLAGS = $(GTK_CFLAGS) $(MYSQL_CFLAGS) -I/usr/include/lclibs -DMYSQL_EMBED -DETC_THREAD
LIBS = $(GTK_LIBS) $(MYSQL_LIBS) -L./libs -ldl -rdynamic -llclibs -ldsrc -lgts
SRC_PATH = src
OBJ_PATH = obj
SOURCES = $(wildcard $(SRC_PATH)/*.c)
OBJECTS = $(patsubst $(SRC_PATH)/%.c, $(OBJ_PATH)/%.o, $(SOURCES))
DEPENDS = $(patsubst $(SRC_PATH)/%.c, $(OBJ_PATH)/%.d, $(SOURCES))
all: hwetc
$(DEPENDS): $(OBJ_PATH)/%.d: $(SRC_PATH)/%.c
$(CC) -MM $(CFLAGS) $< > $@; \
sed -i 's,\($*\)\.o[ :]*,$(OBJ_PATH)/\1.o $@ : ,g' $@include $(DEPENDS)
hwetc: $(OBJECTS)
$(CC) $(OBJECTS) $(LIBS) -o $@
$(OBJECTS):
$(CC) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean: rm -f hwetc $(OBJECTS) $(DEPENDS)