-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
44 lines (31 loc) · 757 Bytes
/
Copy pathmakefile
File metadata and controls
44 lines (31 loc) · 757 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
34
35
36
37
38
39
40
41
42
CC = gcc
SDL_CFLAGS := $(shell pkg-config --cflags SDL2_image)
SDL_LDFALGS := $(shell pkg-config --libs SDL2_image) \
$(shell pkg-config --libs SDL2_mixer) \
$(shell pkg-config --libs SDL2_ttf)
CFLAGS := -Wall -g $(SDL_CFLAGS)
LDFLAGS := $(SDL_LDFALGS)
SDIR = src
ODIR = obj
HDIR = includes
SDIRS = $(wildcard $(SDIR)/*.c)
ODIRS = $(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(SDIRS))
HDRS = $(wildcard $(HDIR)/*.h)
BIN = main
all: $(BIN)
$(BIN): $(ODIRS) $(ODIR) $(HDRS)
$(CC) $(CFLAGS) $(ODIRS) -o $@ $(LDFLAGS)
$(ODIR)/%.o: $(SDIR)/%.c $(ODIR)
$(CC) $(CFLAGS) -c $< -o $@
$(ODIR):
mkdir -p $@
docs:
ifneq ("$(wildcard ./docs)", "")
rm -rf docs
endif
doxygen .doxygen
clean:
rm -fr $(ODIR)
ifneq ("$(wildcard ./$(BIN))","")
rm $(BIN)
endif