-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (25 loc) · 706 Bytes
/
Makefile
File metadata and controls
33 lines (25 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
CC = gcc
CFLAGS = -g -Wall
SRC = src
BIN = bin
INCLUDES = includes
SAMPLE_SRC = $(SRC)/samples
TARGETS = arraylist heap queue
TARGET_OBJS := $(addprefix $(SRC)/, $(TARGETS))
TARGET_OBJS := $(addsuffix .o, $(TARGET_OBJS))
SAMPLES := $(addprefix $(BIN)/, $(TARGETS))
SAMPLE_OBJS := $(addprefix $(SAMPLE_SRC)/sample_, $(TARGETS))
SAMPLE_OBJS := $(addsuffix .o, $(SAMPLE_OBJS))
all: $(SAMPLES)
$(SAMPLES): $(SAMPLE_OBJS) $(TARGET_OBJS)
mkdir -p $(BIN)
$(foreach TARGET, $(TARGETS),\
$(CC) $(CFLAGS) -I $(INCLUDES) -o $(BIN)/$(TARGET) \
$(SRC)/*.o $(SAMPLE_SRC)/sample_$(TARGET).o;\
)
.c.o:
$(CC) $(CFLAGS) -I $(INCLUDES) $^ -c -o $@
clean:
rm $(TARGET_OBJS)
rm $(SAMPLE_OBJS)
rm $(SAMPLES)