makefile批量编译

(一)外层makefile

SUBDIRS = cell-renderer-spin       \#文件夹名
          custom-cell-renderer     \
          custom-list-model        \
          custom-list-model-sorted \
          hello-world              \
          simple-list              \
          treeview-demo

all: $(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 = gcc

OBJS = main.o custom-list.o

CFLAGS = -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 


你可能感兴趣的:(gcc,makefile,gtk)