-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 741 Bytes
/
Makefile
File metadata and controls
37 lines (27 loc) · 741 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
PROGNAME := easydevelop
SRCDIR := src
BUILDDIR := build
RESDIR := res
CFLAGS ?= -O2
CFLAGS += -Wall -Wextra -pedantic
CPPFLAGS ?=
CPPFLAGS += -DPROGNAME=\"$(PROGNAME)\" -DRESDIR=\"$(PWD)/$(RESDIR)\"
LDFLAGS ?= -s
CFLAGS_sdl != pkg-config --cflags sdl2 SDL2_ttf
LDLIBS_sdl != pkg-config --libs sdl2 SDL2_ttf
CFLAGS += $(CFLAGS_sdl)
LDLIBS += $(LDLIBS_sdl)
SRCS := $(wildcard $(SRCDIR)/*.c)
OBJS := $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SRCS))
.PHONY: all
all: $(PROGNAME)
.PHONY: clean
clean:
rm -f $(PROGNAME)
rm -rf $(BUILDDIR)
$(PROGNAME): $(OBJS)
$(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
$(BUILDDIR)/%.o: $(SRCDIR)/%.c | $(BUILDDIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(BUILDDIR):
mkdir -p $@