-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
67 lines (48 loc) · 1.89 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
ODIR = o
BGFXSRC = ../bgfx
BXSRC = ../bx
BIMGSRC = ../bimg
LUAINC = -I/usr/local/include
LUALIB = -L/usr/local/bin -L$(MINGW)/bin -llua54
SDLINC = -I../SDL/include
SDLLIB = -Lbin -lSDL2
CC= gcc
CXX = g++
CFLAGS = -g -Wall -DBX_CONFIG_DEBUG=1
.PHONY : all math sdlwnd
all :
# bgfx
BGFXVER = Debug
#BGFXVER = Release
BGFXLIB = -L$(BGFXSRC)/.build/win64_mingw-gcc/bin -lbgfx$(BGFXVER) -lbimg$(BGFXVER) -lbx$(BGFXVER) -lstdc++ -lgdi32 -lpsapi -luuid
BGFXINC = -I$(BGFXSRC)/include -I$(BXSRC)/include/compat/mingw -I$(BXSRC)/include
BGFX3RDINC = -I$(BGFXSRC)/3rdparty
BGFXUTILLIB = -lexample-common$(BGFXVER)
BGFXUTILINC = $(BGFX3RDINC) -I$(BGFXSRC)/examples/common
$(ODIR)/luabgfx.o : luabgfx.c | $(ODIR)
$(CC) $(CFLAGS) -c -DBGFX_STATIC_LINK -DLUA_BUILD_AS_DLL -o $@ $^ $(LUAINC) $(BGFXINC)
$(ODIR)/luabgfxutil.o : luabgfxutil.c | $(ODIR)
$(CC) $(CFLAGS) -c -DLUA_BUILD_AS_DLL -o $@ $^ $(LUAINC) $(BGFXINC)
$(ODIR)/luabgfximgui.o : luabgfximgui.cpp | $(ODIR)
$(CXX) $(CFLAGS) -c -DLUA_BUILD_AS_DLL -o $@ $^ $(LUAINC) $(BGFXINC) $(BGFXUTILINC)
$(ODIR)/bgfx_alloc.o : bgfx_alloc.cpp | $(ODIR)
$(CXX) $(CFLAGS) -c -DLUA_BUILD_AS_DLL -o $@ $^ $(LUAINC) $(BGFXINC) $(BGFXUTILINC)
$(ODIR)/bgfx_interface.o : bgfx_interface.cpp | $(ODIR)
$(CXX) $(CFLAGS) -c -DLUA_BUILD_AS_DLL -o $@ $^ $(LUAINC) $(BGFXINC) $(BGFXUTILINC)
bin :
mkdir $@
bin/bgfx.dll : $(ODIR)/luabgfx.o $(ODIR)/luabgfxutil.o $(ODIR)/luabgfximgui.o $(ODIR)/bgfx_alloc.o $(ODIR)/bgfx_interface.o | bin
$(CC) $(CFLAGS) --shared -o $@ $^ $(LUALIB) $(BGFXUTILLIB) $(BIMGLIB) $(BGFXLIB)
math :
cd math3d && $(MAKE) OUTPUT=../bin/
sdlwnd : bin/sdlwnd.dll
bin/sdlwnd.dll : sdlwnd.c
$(CC) $(CFLAGS) --shared -o $@ $^ $(SDLINC) $(SDLLIB) $(LUAINC) $(LUALIB)
bin/math3d.dll : | bin
cd math3d && $(MAKE) OUTPUT=../bin/
all : bin/bgfx.dll bin/math3d.dll
# all
$(ODIR) :
mkdir $@
clean :
rm -rf $(ODIR) && rm -f bin/bgfx.dll bin/math3d.dll bin/sdlwnd.dll