CC = gcc C++ = g++ LINK = g++ INCLUDES = -L. -Isconv LIBS = -lz -lm CCFLAGS = $(COMPILER_FLAGS) --std=c99 -c -g -MMD -MP $(DEFINES) C++FLAGS = $(COMPILER_FLAGS) -std=c++11 -c -g -O2 -W -Wall TARGET=222 CFILES = sconv/sconv.c C++FILES = 2.cpp OBJFILE = $(CFILES:.c=.o) $(C++FILES:.cpp=.o) all:$(TARGET) $(TARGET): $(OBJFILE) $(LINK) $^ $(LIBS) -fpermissive -fvisibility=hidden -Wl,-rpath,$ORIGIN -Wl,-Bsymbolic -o $@ #$(LINK) $^ -Wall -o $@ -ldl -pthread %.o:%.c $(CC) $(CCFLAGS) $(INCLUDES) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" %.o:%.cpp $(C++) -o $@ $(C++FLAGS) $< $(INCLUDES) install: tsxs -i -o $(TARGET) clean: rm -rf $(TARGET) rm -rf $(OBJFILE)
标签:%.,TARGET,makefile,C++,编译,LINK,c++,FLAGS From: https://www.cnblogs.com/hshy/p/17700082.html