target: $(patsubst %.c,%.o,$(wildcard ./src/*.c))
@echo "making target"
$(cc) $(patsubst %.c,%.o,$(wildcard ./src/*.c)) $(LIBS) -o gif
# $(cc) $(wildcard ./objects/*.o) $(LIBS) -o gif
./objects/%.o: %.c
@echo "making objects now"
@mkdir -p ./objs
$(cc) $(CFLAGS) $(LDFLAGS) -c $< -o ./objects/$@
问题是对象 .o 文件是在 src 文件夹中创建的。我希望在对象文件夹中创建对象。请帮忙?
输出是
making target
gcc ./src/gif_display.o ./src/gif_lzw.o ./src/gif_read.o ./src/sysm.o ./src/x86_main.o -lm -lc -o gif