~/bin 可执行程序目录
~/etc 配置文件目录
~/inc 头文件目录
~/lib 函数库文件目录
~/log 日志文件目录
~/src 源程序文件目录
~/src/lib 函数库源程序目录
~/src/lib/LIB_1 函数库libLIB_1源程序目录
~/src/APP_A 子系统APP_A源程序目录
~/src/APP_A/mod_a 子系统APP_A模块mod_a源程序目录
~/.profile
~/makefile
~/makefile文件内容如下:
all:
@MakeSubDir() \
{ \
for DIR in `ls|grep&nbs'''l''';ls|grep -v&nbs'''l'''`; do \
if [ -d $${DIR} ]; then \
cd $${DIR}; \
MakeSubDir; \
if [ -f makefile -o -f Makefile ]; then \
echo ""; \
pwd; \
make all; \
fi; \
cd ..; \
fi; \
done; \
}; \
MakeSubDir
tar:
@tar -cf `date +%Y%m%d-%H%M%S`.tar .profile `ls|grpbpv&nbs;'''.tar''''`
~/src/lib/LIB_1/makefile文件内容如下:
ALL: INFO all
BASEDIR = $(HOME)
INC = $(BASEDIR)/inc
LIB = $(BASEDIR)/lib
PRDNAME = $(LIB)/libLIB_1
PRODUCT = $(PRDNAME).a $(PRDNAME).so
OBJS = LIB_1_f1.o LIB_1_f2.o
AR = ar <特定平台ar可选参数>
CC = cc <特定平台cc可选参数>
all: $(PRODUCT)
$(PRDNAME).a: $(OBJS)
@echo " Making $@ ..."
@$(AR) -r $@ $(OBJS)
$(PRDNAME).so: $(OBJS)
@echo " Making $@ ..."
@$(CC) -G -o $@ $(OBJS)
.c.o: *.h $(INC)/*.h
@echo " Compiling $< ..."
@$(CC) -c -I$(INC) $<
INFO:
@echo " make all - samenpwh&nbs;'''make'''' except this message"
@echo " make clear - remove object files"
@echo " make clean - remove all object and target files"
@echo ""
clear: FORCE
@rm -f *.o
clean: FORCE clear
@rm -f $(PRODUCT)
FORCE: