-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (52 loc) · 1.83 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
68
SC=csc
CC=gcc
CXX=g++
CFLAGS=-g -Wall
CXXFLAGS=-g -Wall -std=c++11 -fPIC
UNAME=$(shell uname)
# mingw is very quirky, we have to set PKG_CONFIG_PATH manually
ifeq ($(OS),Windows_NT)
PKG_CONFIG_PATH=/mingw64/lib/pkgconfig
LIBS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --static --libs glfw3 glew)
DLLEXT := .dll
else
UNAME := $(shell uname -s)
LIBS=$(shell pkg-config --static --libs glfw3 glew)
ifeq ($(UNAME),Darwin)
DLLEXT := .dylib
endif
ifeq ($(UNAME),Linux)
DLLEXT := .so
endif
endif
EXE=plum
SCFLAGS=-o $(EXE) -c++ $(LIBS)
all: plum
plum: plum.o sdl-ffi.o sdl.o
$(SC) plum.o sdl-ffi.o sdl.o $(SCFLAGS)
plum.o: plum.scm
$(SC) -c plum.scm -c++
sdl-ffi.o: sdl-ffi.scm
$(SC) -c sdl-ffi.scm -c++
sdl-ffi$(DLLEXT): sdl-ffi.scm sdl.o
$(SC) -s sdl-ffi.scm sdl.o -c++ $(LIBS)
## Building Graphics Engine
engine: libplumgraphics$(DLLEXT)
graphics_test: graphics_test.c libplumgraphics$(DLLEXT)
$(CC) $(CFLAGS) -o graphics_test graphics_test.c -L. -lplumgraphics
libplumgraphics$(DLLEXT): graphics.o model.o mesh_object.o libplumloader$(DLLEXT)
$(CXX) -shared -o libplumgraphics$(DLLEXT) graphics.o model.o mesh_object.o $(LIBS) -L. -lplumloader
graphics.o: graphics.cpp graphics.h mesh.h plum_loader.h shader.h *.vert *.frag
$(CXX) $(CXXFLAGS) -c graphics.cpp shader.h
plum_loader_test: test/plum_loader_test.c libplumloader$(DLLEXT)
$(CC) $(CFLAGS) -o plum_loader_test test/plum_loader_test.c -L. -lplumloader
libplumloader$(DLLEXT): plum_loader.o
$(CXX) -shared -o libplumloader$(DLLEXT) plum_loader.o $(LIBS)
plum_loader.o: plum_loader.cpp plum_loader.h mesh.h
$(CXX) $(CXXFLAGS) -c plum_loader.cpp
model.o: model.cpp model.h
$(CXX) $(CXXFLAGS) -c model.cpp
mesh_object.o: mesh_object.cpp mesh_object.h
$(CXX) $(CXXFLAGS) -c mesh_object.cpp
clean:
rm -rf *.o *$(DLLEXT) *.gch *.dSYM a.out plum graphics graphics_test