-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (41 loc) · 1.27 KB
/
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
48
49
50
51
52
53
54
55
.PHONY: clean
EXE = renderer
LIBS = -lm
CFLAGS = -std=c99 -Wall -Wextra -Wconversion -Wpedantic -pedantic-errors -pipe
SRC_DIR = src
BUILD_DIR = build
OBJS = \
$(BUILD_DIR)/main.o \
$(BUILD_DIR)/model.o \
$(BUILD_DIR)/screen.o \
$(BUILD_DIR)/screen_draw.o \
$(BUILD_DIR)/util.o \
$(BUILD_DIR)/vec2i.o \
$(BUILD_DIR)/vec3f.o \
$(BUILD_DIR)/stb_image_write.o
### Main ###
all: $(BUILD_DIR)/$(EXE)
### Link ###
$(BUILD_DIR)/$(EXE): $(OBJS)
$(CC) $(LIBS) $(OBJS) -o $@
### Build ###
$(BUILD_DIR)/main.o: $(SRC_DIR)/main.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/model.o: $(SRC_DIR)/model.c $(SRC_DIR)/model.h
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/screen.o: $(SRC_DIR)/screen.c $(SRC_DIR)/screen.h
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/screen_draw.o: $(SRC_DIR)/screen_draw.c $(SRC_DIR)/screen_draw.h
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/util.o: $(SRC_DIR)/util.c $(SRC_DIR)/util.h
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/vec2i.o: $(SRC_DIR)/vec2i.c $(SRC_DIR)/vec2i.h
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/vec3f.o: $(SRC_DIR)/vec3f.c $(SRC_DIR)/vec3f.h
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/stb_image_write.o: $(SRC_DIR)/stb/stb_image_write.c $(SRC_DIR)/stb/stb_image_write.h
$(CC) $(CFLAGS) -c $< -o $@
### Clean ###
clean:
$(RM) $(EXE)
$(RM) $(OBJS)