4 ms·
Alternative way without shelling out: SRC = $(wildcard src/\*.c) OBJ = $(SRC:.c=.o) SDEPS = $(SRC:.c=.d) EXE = myapp INC = include CFLAGS ?=
by oso2k 3y ago
Alternative way without shelling out:
SRC = $(wildcard src/\*.c)
OBJ = $(SRC:.c=.o)
SDEPS = $(SRC:.c=.d)
EXE = myapp
INC = include
CFLAGS ?= -Os -MMD -MP
LDFLAGS ?=
%.o: %.c $(INC) Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(EXE): $(OBJ)
$(LD) $^ $(LDFLAGS) -o $@
# near the bottom of your Makefile
-include $(SDEPS)