-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (77 loc) · 1.92 KB
/
Makefile
File metadata and controls
96 lines (77 loc) · 1.92 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
###############################
# If no target was given
help:
@echo "Currently OpenGL 4.2 is hardcoded."
@echo "Dependencies that need to be installed:"
@echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo "xorg-dev"
@echo "libgl1-mesa-dev"
@echo "GLFW3 (build and install from source)"
@echo ""
@echo "Other dependencies that are included:"
@echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@echo "recp/cglm"
@echo "Dav1dde/glad"
@echo ""
@echo "Available commands:"
@echo "~~~~~~~~~~~~~~~~~~~"
@echo "make clean Clean temporary files."
@echo "make terr Build the program."
@echo "./terr <resolution> <mode> <seed> <auto>"
###############################
# Compiler/Linker options
# Environment
OUT = obj
CC = gcc
# Flags for all binaries
CFLAGS = -std=c99 -Wall -Wsign-compare -Iinclude -Idepend
# Flags for object files only
OFLAGS = $(CFLAGS) -c -s
# Linker flags
LFLAGS = -lglfw3 -lX11 -lGL -pthread -lm -ldl
###############################
# Directory management
# Creation
$(OUT):
@mkdir -p $(OUT)
@mkdir -p $(OUT)/generators
@mkdir -p $(OUT)/modifiers
# Cleaning
clean:
@rm -Rf $(OUT)
@rm -f *.txt
@rm -f *.json
###############################
# Builds
HEADERS = \
include/constants.h \
include/deps.h \
include/generators.h \
include/modifiers.h \
include/output.h \
include/patch.h \
include/scene.h \
include/shader.h
OBJS = \
$(OUT)/glad.o \
$(OUT)/generators/input.o \
$(OUT)/generators/mpd.o \
$(OUT)/generators/noise.o \
$(OUT)/modifiers/flatten.o \
$(OUT)/modifiers/output.o \
$(OUT)/modifiers/relax.o \
$(OUT)/modifiers/stats.o \
$(OUT)/modifiers/subdivide.o \
$(OUT)/output.o \
$(OUT)/patch.o \
$(OUT)/scene.o \
$(OUT)/shader.o
# Dependencies
$(OUT)/glad.o: depend/glad/glad.c | $(OUT)
$(CC) $(OFLAGS) $< -o $@
# Object files
$(OUT)/%.o: src/%.c $(HEADERS) | $(OUT)
$(CC) $(OFLAGS) $< -o $@
# Main binary
terr: src/main.c $(OBJS)
$(CC) $(CFLAGS) $< $(OBJS) -o $@ $(LFLAGS)