makefile批量编译

来源:互联网 发布:淘宝代销平台官网 编辑:程序博客网 时间:2024/06/06 20:17

(一)外层makefile

SUBDIRS = cell-renderer-spin       \#文件夹名          custom-cell-renderer     \          custom-list-model        \          custom-list-model-sorted \          hello-world              \          simple-list              \          treeview-demoall: $(SUBDIRS)for dir in $(SUBDIRS); do\  cd $dir && make && cd ..;\#批量编译done; \clean: $(SUBDIRS)for dir in $(SUBDIRS); do\  cd $dir && make clean && cd ..;\done;rm -f `find -name "*~"` || /bin/true

(二)里层makefile


CC = gccOBJS = main.o custom-list.oCFLAGS = -g -O2 `pkg-config --cflags gtk+-2.0`customlist: $(OBJS)gcc -o customlist $(OBJS) `pkg-config --libs gtk+-2.0`clean:rm $(OBJS) customlist 2>/dev/null || /bin/true