switch tile label
[pp] / sdl / Makefile
1 SDLCONFIG = /home/frank/local/sdl/bin/sdl2-config
2 CFLAGS = $(shell $(SDLCONFIG) --cflags) -Wall -O2
3 LFLAGS = $(shell $(SDLCONFIG) --libs) -lSDL2_image
4 export ANDROID_HOME = /home/frank/ext/software/android-sdk
5 export ANDROID_NDK_HOME = /home/frank/ext/software/android-ndk-r8d
6 BUILDDIR = build
7 ANDROIDPROJECT = com.tarecontrol.demo
8 SDLHOME = /home/frank/ext/software/SDL2-2.0.8
9 PROJECTHOME = /home/frank/projects/public/games/pp/sdl
10 EMSCRIPTENHOME = /home/frank/ext/software/emsdk/emscripten/tag-1.38.12
11 SDLEMLIBSHOME = $(SDLHOME)/build/em/build/.libs
12 EMBUILDDIR = em
13 WINBUILDDIR = win
14 SDLMINGWHOME = $(SDLHOME)/i686-w64-mingw32
15 APPDIR = Main.app/Contents
16 SYSFWPATH = /Library/Frameworks
17 PICC = /home/frank/ext/software/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
18 # PICC = /home/frank/ext/software/rpi-tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-g++
19 PIMOUNT = /mnt
20 PIBUILDDIR = $(PIMOUNT)/home/pi
21
22 linux :
23 g++ -c $(CFLAGS) -D__LINUX__ main.cpp
24 g++ -o main $(LFLAGS) main.o -lGL
25
26 android :
27 if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi;
28 cd $(SDLHOME)/build-scripts/ && \
29 ./androidbuild.sh $(ANDROIDPROJECT) $(PROJECTHOME)/main.cpp
30 cp -r $(SDLHOME)/build/$(ANDROIDPROJECT) $(BUILDDIR)
31 sed -i s/2\.3\.3/2\.2\.3/g $(BUILDDIR)/$(ANDROIDPROJECT)/build.gradle
32 sed -i s/26\.0\.1/23\.0\.1/g $(BUILDDIR)/$(ANDROIDPROJECT)/app/build.gradle
33 cd $(BUILDDIR)/$(ANDROIDPROJECT) && ./gradlew assembleDebug
34
35 emscripten :
36 if [ ! -d $(BUILDDIR)/$(EMBUILDDIR) ]; then mkdir -p $(BUILDDIR)/$(EMBUILDDIR); fi;
37 cd $(BUILDDIR)/$(EMBUILDDIR) && \
38 $(EMSCRIPTENHOME)/em++ -O2 $(PROJECTHOME)/main.cpp -I$(SDLHOME)/include \
39 -Wall -s USE_SDL=2 -o main.html
40
41 mingw :
42 if [ ! -d $(BUILDDIR)/$(WINBUILDDIR) ]; then mkdir -p $(BUILDDIR)/$(WINBUILDDIR); fi;
43 cd $(BUILDDIR)/$(WINBUILDDIR) && \
44 i686-w64-mingw32-g++ $(PROJECTHOME)/main.cpp -I$(SDLMINGWHOME)/include/SDL2 -L$(SDLMINGWHOME)/lib \
45 -Wl,-rpath,$(SDLMINGWHOME)/lib -lmingw32 -lSDL2main -lSDL2 -lopengl32 -Wall -O2 -o main.exe && \
46 cp $(SDLMINGWHOME)/bin/SDL2.dll .
47
48 osx :
49 if [ ! -d "$(APPDIR)" ]; then mkdir -p $(APPDIR); fi;
50 if [ ! -d "$(APPDIR)" ]; then mkdir $(APPDIR); fi;
51 if [ ! -d "$(APPDIR)/MacOS" ]; then mkdir $(APPDIR)/MacOS; fi;
52 if [ ! -d "$(APPDIR)/Frameworks" ]; then mkdir $(APPDIR)/Frameworks; fi;
53 if [ ! -d "$(APPDIR)/Resources" ]; then mkdir $(APPDIR)/Resources; fi;
54 touch $(APPDIR)/Info.plist
55 cp -r $(SYSFWPATH)/SDL2.framework $(APPDIR)/Frameworks
56 g++ -I $(SYSFWPATH)/SDL2.framework/Headers \
57 -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,$(SYSFWPATH) \
58 -framework SDL2 -framework OpenGL main.cpp -o $(APPDIR)/MacOS/main
59
60 pi :
61 $(PICC) --sysroot=$(PIMOUNT) main.cpp -I$(PIMOUNT)/opt/vc/include \
62 -I$(PIMOUNT)/opt/vc/include/interface/vcos/pthreads \
63 -I$(PIMOUNT)/opt/vc/include/interface/vmcs_host/linux \
64 -I$(PIMOUNT)/usr/local/include/SDL2 -D_REENTRANT -Wall -O2 -L$(PIMOUNT)/opt/vc/lib \
65 -Wl,-rpath,$(PIMOUNT)/opt/vc/lib -L$(PIMOUNT)/usr/local/lib -Wl,-rpath,$(PIMOUNT)/usr/local/lib \
66 -Wl,--enable-new-dtags -lSDL2 -lGLESv2 -o $(PIBUILDDIR)/main
67
68 pi-local :
69 g++ main.cpp $(shell sdl2-config --cflags) -Wall -O2 \
70 -L/opt/vc/lib -Wl,-rpath,/opt/vc/lib $(shell sdl2-config --libs) \
71 -lGLESv2 -o main
72
73 cross : linux android emscripten mingw
74
75 # main : main.o
76 # g++ -o main $(LFLAGS) -lGL main.o
77
78 # main.o : main.cpp
79 # g++ -c $(CFLAGS) -DLINUX main.cpp