How to make specific binary from specific object file?
问题 Here is my makefile, i have object files in obj/ directory, and i need to compile them into binaries in bin/ folder, but somehow it doesn't work as i wanted it to work, any ideas? SOURCES= $(wildcard *.c) OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) OBJECTS:= $(addprefix obj/,$(OBJECTS)) NAMES:= $(patsubst %.c, %, $(SOURCES)) NAMES:= $(addprefix bin/,$(NAMES)) CC=gcc CFLAGS= -Wall -c -o DIRS = bin obj all: $(DIRS) $(NAMES) $(NAMES): $(OBJECTS) $(CC) -o $@ $< obj/%.o: %.c $(CC) $(CFLAGS) $@ $< $