#Aaron.xu 13174115@qq.com
targets = main
#CFLAGS = -g
#LDFLAGS = -rdynamic
#INC_PATH = -I ../
CXX = g++
SRC_EXT = cpp
SRC_FILE = $(wildcard *.$(SRC_EXT))
ifeq (,$(SRC_FILE))
SRC_EXT = c
SRC_FILE = $(wildcard *.$(SRC_EXT))
endif
OBJ_FILE = $(patsubst %.$(SRC_EXT),%.o,$(wildcard *.$(SRC_EXT)))
HEADER_FILE = $(wildcard *.h)
.PHONY:all,clean,test
all:$(targets)
$(targets):$(OBJ_FILE)
$(CXX) -o $@ $^ $(LDFLAGS) $(INC_PATH)
#$(OBJ_FILE):
#$(CXX) $(patsubst %.o,%.$(SRC_EXT),$@) -c $(CFLAGS) -o $@
%.o : %.$(SRC_EXT) $(HEADER_FILE)
$(CXX) -o $@ -c $< $(CFLAGS) $(INC_PATH)
clean:
rm -f *.o
rm -f $(targets)
test:
./$(targets)