runsisi AT hust
http://www.cppblog.com/runsisi
前期将FreeBSD的TCP栈移到用户态的时候没有参考项目已有的Makefile,主要是项目的Makefile写的太复杂,看上去有点晕,而且前期也基本上不需要依赖已有Makefile定义的变量,因此单独弄了个Makefile,自我感觉良好:),以后一些小东西也可以继续用~
关于Makefile可以参考:http://www.gnu.org/software/make/manual/
# author: runsisi AT hust
# date: 2013/08/24
.PHONY : all clean
CC := /opt/zte/x86_64_gcc4.5.2_glibc2.13.0/bin/x86_64-pc-linux-gnu-gcc
AR := /opt/zte/x86_64_gcc4.5.2_glibc2.13.0/bin/x86_64-pc-linux-gnu-ar
CODE_DIR := $(CURDIR)/../../..
ROOT_DIR := $(CURDIR)
TARGET := $(ROOT_DIR)/libbsdtcp.a
INC_DIRS := $(ROOT_DIR)/include \
$(ROOT_DIR)/include/opt \
$(ROOT_DIR)/include/amd64 \
$(ROOT_DIR)/include/x86 \
$(ROOT_DIR)/include/contrib/altq \
$(CODE_DIR)/dps/pub/include
SRC_DIRS := $(ROOT_DIR)/source/kern \
$(ROOT_DIR)/source/libkern \
$(ROOT_DIR)/source/net \
$(ROOT_DIR)/source/netinet \
$(ROOT_DIR)/source/vm
INCS := $(addprefix -I, $(INC_DIRS))
SRCS := $(foreach dir, $(SRC_DIRS), $(wildcard $(dir)/*.c))
OBJS := $(SRCS:.c=.o)
DEPS := $(OBJS:.o=.d)
MACROS := -D_KERNEL
CFLAGS := -MD -MP $(INCS) $(MACROS)
all : $(TARGET)
@printf "Compilation done:)\n"
$(TARGET) : $(OBJS)
$(AR) -crs $@ $^
%.o : %.c
$(CC) -c $(CFLAGS) -o $@ $<
-include $(DEPS)
clean:
@rm -f $(OBJS) $(DEPS) $(TARGET)
/Files/runsisi/Makefile.pdf
/Files/runsisi/Makefile.rar