#compiler
CC := gcc
#generate target file
TARGET := main.o
#source file path
SUBDIRS := ./
SUBDIRS += demo/aa/
SUBDIRS += bb/
SUBDIRS += cc/
#header file path
INCLUDES := -I ./
INCLUDES += -I ./demo/aa/
INCLUDES += -I ./bb
INCLUDES += -I ./cc
INCLUDES += -I ./dd
#corresponding target file
C_OBJS := aa/bb.o
C_OBJS += demo/aa/bb.o
C_OBJS += cc/xbc.o
#.so file
LDFLAGS += ./lib/yy.so
LDFLAGS += ./lib/zz.so
#pthread compile link
LIB := -lm
LIB += -lpthread
#.PHONY: subdirs ${SUBDIRS} cleansubdirs
#subdirs: ${SUBDIRS}
#${SUBDIRS}:
# ${MAKE} -C $@ all
#%.o: %.c
# ${CC} ${INCLUDES} -c $< -o $@
#cleansubdirs:
# @for dir in ${SUBDIRS}; do \
# ${MAKE} -C $$dir clean; \
# done
#all:subdirs ${C_OBJS}
# ${CC} -o ${TARGET} $$(find ${SUBDIRS} -name '*.o') ${INCLUDES} ${LIB}
all: $(TARGET)
$(TARGET):$(C_OBJS)
$(CC) -o $@ $^ $(INCLUDES) $(LIB) $(LDFLAGS)
$(C_OBJS):%o:%c
$(CC) -o $@ -c $< $(INCLUDES) $(LIB)
clean:
rm -f ${TARGET} ${C_OBJS}