-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (38 loc) · 1.1 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
CC = gcc
LINKER = gcc
CFLAGS = -pedantic -Og -g
LDFLAGS = -lSDL2 -lSDL2_gfx -lSDL2_image \
-lrnd_game -lrnd_bitarray -lrnd_priorityqueue -lrnd_linkedlist -lrnd_hashmap -lrnd_utils \
-lchipmunk -lm
# All SRCDIR subdirectories that contain source files
DIRS = . objects
SRCDIR = src
OBJDIR = obj
SRCDIRS := $(foreach dir, $(DIRS), $(addprefix $(SRCDIR)/, $(dir)))
OBJDIRS := $(foreach dir, $(DIRS), $(addprefix $(OBJDIR)/, $(dir)))
SRCS := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.c))
OBJS := $(patsubst $(SRCDIR)/%, $(OBJDIR)/%, $(SRCS:.c=.o))
TARGET = space-etcher
DESTDIR =
PREFIX = /usr/local/bin
.PHONY: directories all main clean install docs gen profile
all: directories gen main
directories:
mkdir -p $(SRCDIRS) $(OBJDIRS)
main: $(OBJS)
$(LINKER) $(OBJS) $(LDFLAGS) -o $(TARGET)
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) -c $(CFLAGS) $^ -o $@
clean:
rm -f $(OBJS)
profile: CFLAGS += -pg
profile: LDFLAGS += -pg
profile: clean all
install: CFLAGS += -O3
install: LDFLAGS += -O3
install: clean all
cp -- $(TARGET) $(DESTDIR)$(PREFIX)/
docs:
doxygen Doxyfile
gen:
./$(SRCDIR)/objects/generate.sh