forked from cloudwu/ejoy3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (33 loc) · 846 Bytes
/
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
BUILD=build
STANDALONE=ej3d.exe
CFLAGS=-g -Wall
CC=gcc
AR=ar rc
CSRC=\
carray.c\
log.c\
render.c
LUASRC=\
librender.c\
libglfw.c\
libmath.c
GLAD=\
3rd/glad/src/glad.c
LUAINC=/usr/local/include
LIBSRCS:= $(CSRC) $(LUASRC)
LIBOBJS:= $(addprefix $(BUILD)/,$(LIBSRCS:.c=.o))
LIBS:=-L/usr/local/lib -lglfw3 -llua -lopengl32 -lgdi32
.PHONY : all clean
all : $(BUILD)/$(STANDALONE)
$(BUILD) :
mkdir $@
$(LIBOBJS): $(BUILD)/%.o : clib/%.c | $(BUILD)
$(CC) $(CFLAGS) -I$(LUAINC) -I3rd/glad/include -c -o $@ $<
$(BUILD)/glad.o : 3rd/glad/src/glad.c | $(BUILD)
$(CC) $(CFLAGS) -I3rd/glad/include -c -o $@ $<
$(BUILD)/libejoy3d.a : $(LIBOBJS) $(BUILD)/glad.o
$(AR) $@ $^
$(BUILD)/$(STANDALONE) : clib/standalone.c $(BUILD)/libejoy3d.a
$(CC) $(CFLAGS) -I$(LUAINC) -Iinclude -o $@ $< -L$(BUILD) -lejoy3d $(LIBS)
clean :
rm -rf build