-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
47 lines (32 loc) · 898 Bytes
/
Makefile
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
CC = gcc
CFLAGS = -Wall -g -pg -std=c99
SRCS = $(shell find . -maxdepth 1 -name '*.c' -not -name '*main.c')
OBJS = $(patsubst %.c, %.o, $(SRCS))
UTILS_SRCS = \
utils/hash_table.c \
utils/seg_vector.c \
utils/string.c \
utils/vector.c
UTILS_OBJS = $(patsubst %.c, %.o, $(UTILS_SRCS))
ELOI = eloi
ELOC = eloc
all: $(ELOI) $(ELOC)
depend: .depend
.depend: $(SRCS)
rm -f ./.depend
$(CC) $(CFLAGS) -MM $^ > ./.depend
include .depend
# objects
utils/hash_table.o: utils/hash_table.c utils/hash_table.h
utils/string.o: utils/string.c utils/string.h
utils/vector.o: utils/vector.c utils/vector.h
# executables
$(ELOI): main.o $(OBJS) $(UTILS_OBJS)
$(CC) $(CFLAGS) -o $@ $^
$(ELOC): cv_main.o $(OBJS) $(UTILS_OBJS)
$(CC) $(CFLAGS) -o $@ $^
.PHONY: clean
clean:
if [ -f $(ELOI) ]; then rm -vf $(ELOI); fi
if [ -f $(ELOC) ]; then rm -vf $(ELOC); fi
find . -name '*.o' -exec rm -rvf {} \;