forked from simple2d/simple2d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNMakefile
91 lines (72 loc) · 3.05 KB
/
NMakefile
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Makefile for Windows using Visual C++
# Sources
SRCS=src\simple2d.c src\shapes.c src\image.c src\sprite.c src\text.c src\sound.c src\music.c src\input.c src\controllers.c src\window.c src\gl.c src\gl2.c src\gl3.c
OBJS=build\simple2d.obj build\shapes.obj build\image.obj build\sprite.obj build\text.obj build\sound.obj build\music.obj build\input.obj build\controllers.obj build\window.obj build\gl.obj build\gl2.obj build\gl3.obj
# Includes
INC_GLEW_DIR=deps\vc\glew\include
INC_SDL2_DIR=deps\vc\SDL2\include
INCLS=/I $(INC_GLEW_DIR) /I $(INC_SDL2_DIR)
# Libraries
LIB_GLEW_DIR=deps\vc\glew\lib
LIB_GLEW=$(LIB_GLEW_DIR)\glew32.lib
LIB_SDL2_DIR=deps\vc\SDL2\lib
LIB_SDL2=$(LIB_SDL2_DIR)\SDL2.lib
LIB_SDL2_MAIN=$(LIB_SDL2_DIR)\SDL2main.lib
LIB_SDL2_IMAGE=$(LIB_SDL2_DIR)\SDL2_image.lib
LIB_SDL2_MIXER=$(LIB_SDL2_DIR)\SDL2_mixer.lib
LIB_SDL2_TTF=$(LIB_SDL2_DIR)\SDL2_ttf.lib
LIBS=opengl32.lib $(LIB_GLEW) $(LIB_SDL2) $(LIB_SDL2_MAIN) $(LIB_SDL2_IMAGE) $(LIB_SDL2_MIXER) $(LIB_SDL2_TTF)
# Install directory: C:\Users\<user_name>\AppData\Local
INSTALL_DIR=$(LOCALAPPDATA)\simple2d
# Install directory and filename for the release
VC_RELEASE=simple2d-windows-vc-VERSION
all: build
build: .phony
if not exist build mkdir build
cl /c /EHsc /Fo.\build\ $(SRCS) $(INCLS)
lib $(OBJS) $(LIBS)
cl /LD /Fo.\build\ $(SRCS) $(INCLS) /link /LIBPATH $(LIBS) /SUBSYSTEM:CONSOLE /OUT:build\simple2d.dll
del build\*.obj
install:
if not exist $(INSTALL_DIR) mkdir $(INSTALL_DIR)
xcopy /e /y $(INC_GLEW_DIR)\* $(INSTALL_DIR)
xcopy /e /y $(LIB_GLEW_DIR)\*.dll $(INSTALL_DIR)
xcopy /e /y $(INC_SDL2_DIR)\* $(INSTALL_DIR)
xcopy /e /y $(LIB_SDL2_DIR)\*.dll $(INSTALL_DIR)
copy include\simple2d.h $(INSTALL_DIR)
copy build\simple2d.lib $(INSTALL_DIR)
copy build\simple2d.dll $(INSTALL_DIR)
copy bin\simple2d.cmd $(INSTALL_DIR)
release: uninstall clean build install
if not exist build\$(VC_RELEASE)\simple2d mkdir build\$(VC_RELEASE)\simple2d
xcopy /e /y $(INSTALL_DIR) build\$(VC_RELEASE)\simple2d
copy deps\LICENSES.md build\$(VC_RELEASE)
copy bin\win-installer-vc.cmd build\$(VC_RELEASE)\install.cmd
PowerShell -Command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('build\$(VC_RELEASE)', 'build\$(VC_RELEASE).zip'); }"
clean:
if exist build\$(VC_RELEASE) rmdir /s /q build\$(VC_RELEASE)
if exist build\$(VC_RELEASE).zip del build\$(VC_RELEASE).zip
if exist build\simple2d.lib del build\simple2d.lib
if exist build\simple2d.dll del build\simple2d.dll
if exist test\*.exe del test\*.exe
uninstall:
if exist $(INSTALL_DIR) rmdir /s /q $(INSTALL_DIR)
test: .phony
cd test
simple2d build auto.c
simple2d build triangle.c
simple2d build testcard.c
simple2d build audio.c
simple2d build controller.c
rebuild: uninstall clean build install test
auto:
cd test & auto.exe
triangle:
cd test & triangle.exe
testcard:
cd test & testcard.exe
audio:
cd test & audio.exe
controller:
cd test & controller.exe
.phony: