|
|
发表于 2006-7-4 13:48:06
|
显示全部楼层
假设*.h在当前目录下./include , *.c/cpp在当前目录下./source, *.o放到当前目录./source下。
- # Options for compilers
- CC = gcc
- CCPLUS = g++
- OPTS = -fno-rtti -fno-exceptions
- # Directories.
- BASE_DIR =.
- INCS =-I$(BASE_DIR)./include // Path of includes.
- CFLAGS +=$(INCS) $(OPTS)
- LDFLAGS = -pthread -rdynamic // Thread and dynamic libs inside yours
- OBJS =$(BASE_DIR)./source // Paht of objects
- LIBS = -ldl
- all:: bin-name
- clean::
- rm -f $(OBJS) bin-name // Note: begin of the line with TAB NOT others
- bin-name: $(OBJS)
- $(CCPLUS) -o $@ $(LDFLAGS) $(OJBS)
- # Rules to compiler C/C++ files.
- $(BASE_DIR)source/%.o : $(BASE_DIR)source/%.cpp
- $(CCPLUS) -c (CFLAGS) $< $@
复制代码 |
|