Permalink
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (72 sloc) 3.05 KB
# 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: