1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| CC = gcc
CFLAGS = -Wall -Wextra -O2 -std=c11
LDFLAGS = -lm
TARGETS = main01 main02
main01_OBJ = main01.o func01.o
main02_OBJ = main02.o func02.o
.PHONY = all clean
all: $(TARGETS)
.SECONDEXPANSION:
$(TARGETS): $$($$@_OBJ)
$(CC) $^ -o $@ $(LDFLAGS)
%.o: $@.c
clean:
-$(RM) $(TARGETS) $(foreach targ,$(TARGETS),$(foreach obj, $($(targ)_OBJ), $(obj)))
|