代码: |
~/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 |
代码: |
all: @MakeSubDir() \ { \ for DIR in `ls|grep 'lib';ls|grep -v 'lib'`; 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|grep -v '.tar'` |
代码: |
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 - same with '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: |
代码: |
ALL: INFO all BASEDIR = $(HOME) INC = $(BASEDIR)/inc LIB = $(BASEDIR)/lib BIN = $(BASEDIR)/bin MODULE = $(BIN)/APP_A_mod_a TESTER = APP_A_mod_a_t PRODUCT = $(SERVER) $(TESTER) CC = cc <特定平台cc可选参数> all: $(PRODUCT) $(MODULE): APP_A_mod_a.o @echo " Making $@ ..." @$(CC) $? -o$@ -L$(LIB) -lLIB_1 APP_A_mod_a_t: APP_A_mod_a_t.o @echo " Making $@ ..." @$(CC) $? -o$@ -L$(LIB) -lLIB_1 .c.o: *.h $(INC)/*.h @echo " Compiling $< ..." @$(CC) -c -I$(INC) $< INFO: @echo " make all - same with '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: |