-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (95 loc) · 4.14 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
C = g++
#ARCH = -m32
ARCH = -m64
#CFLAGS = -Wall -Wextra -Werror -fno-diagnostics-show-option $(ARCH) -std=gnu99 -I . -I/usr/include/lua5.1 -Isrc -pg
CFLAGS = -Wall -Wextra -Werror -fno-diagnostics-show-option $(ARCH) -std=gnu++1y -I . -I/usr/include/lua5.1 -Isrc -pg
LFLAGS = $(ARCH) -pg
#PLATFORM_LIBS = -L/usr/lib/i386-linux-gnu -L/usr/local/lib/i386-linux-gnu
PLATFORM_LIBS = -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib/x86_64-linux-gnu
LIBS = -L/usr/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/mesa $(PLATFORM_LIBS) -lGLESv2 -lGLU -lEGL -llua5.1 -lm -lX11 -lpthread -ldl
EXECUTABLE = vitae
include Makelist
OBJS = $(SRCS:src/%.cpp=bin/release/%.o)
OBJS_DBG = $(SRCS:src/%.cpp=bin/debug/%.o)
OBJS_PROF = $(SRCS:src/%.cpp=bin/profile/%.o)
include Makemoon
MOON_LUA = $(MOON_SRCS:%.moon=SpaceSim/lua/compiled/%.lua)
all : $(EXECUTABLE)_release
# pull in dependency info for *existing* .o files
#-include $(OBJS:.o=.d)
-include $(SRCS:src/%.cpp=bin/release/%.d)
-include $(SRCS:src/%.cpp=bin/debug/%.d)
-include $(SRCS:src/%.cpp=bin/profile/%.d)
.PHONY : clean cleandebug android cleanandroid
clean :
@echo "--- Removing Object Files ---"
@find bin/release -name '*.o' -exec rm -vf {} \;
@find bin/release -name '*.d' -exec rm -vf {} \;
@echo "--- Removing Executable ---"
@-rm -vf $(EXECUTABLE);
cleandebug :
@echo "--- Removing Object Files ---"
@find bin/debug -name '*.o' -exec rm -vf {} \;
@find bin/debug -name '*.d' -exec rm -vf {} \;
@echo "--- Removing Debug Executable ---"
@-rm -vf $(EXECUTABLE)_debug;
android : $(MOON_LUA)
@echo "--- Building Native Code for Android NDK ---"
@ndk-build -C android NDK_DEBUG=1 APP_OPTIM=debug
@echo "--- Compiling Android Java and packaging APK ---"
@ant debug -f android/build.xml
@echo "--- Installing APK to device ---"
@android/install.sh
cleanandroid :
@echo "--- Cleaning Android ---"
@find /home/nick/Projects/Vitae/android/obj/local/armeabi/objs-debug -name '*.o' -exec rm {} \;
@ant clean -f android/build.xml
android_release :
@echo "--- Building Native Code for Android NDK ---"
@ndk-build -C android NDK_DEBUG=0 APP_OPTIM=release
@echo "--- Compiling Android Java and packaging APK ---"
@ant release -v -f android/build.xml
@echo "--- Signing apk ---"
@cp android/bin/vitae-release-unsigned.apk android/bin/vitae-release-unaligned.apk
@jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore android-release-key.keystore android/bin/vitae-release-unaligned.apk vitae
@echo "--- running zipalign ---"
@rm -f android/bin/vitae-release.apk
@zipalign -v 4 android/bin/vitae-release-unaligned.apk android/bin/vitae-release.apk
@echo "--- Installing APK to device ---"
@android/install_release.sh
cleanandroid_release :
@echo "--- Cleaning Android ---"
@find /home/nick/Projects/Vitae/android/obj/local/armeabi/objs -name '*.o' -exec rm {} \;
@ant clean -f android/build.xml
$(EXECUTABLE)_release : $(SRCS) $(OBJS) $(MOON_LUA)
@echo "- Linking $@"
@$(C) $(LFLAGS) -O2 -o $(EXECUTABLE)_release $(OBJS) $(LIBS)
profile : $(EXECUTABLE)_profile
$(EXECUTABLE)_profile : $(SRCS) $(OBJS_PROF) $(MOON_LUA)
@echo "- Linking $@"
@$(C) -g $(LFLAGS) -O2 -o $(EXECUTABLE)_profile $(OBJS_PROF) $(LIBS)
debug : $(EXECUTABLE)_debug
$(EXECUTABLE)_debug : $(SRCS) $(OBJS_DBG) $(MOON_LUA)
@echo "- Linking $@"
@$(C) -g $(LFLAGS) -O2 -o $(EXECUTABLE)_debug $(OBJS_DBG) $(LIBS)
bin/debug/%.o : src/%.cpp
# Calculate the directory required and create it
@mkdir -pv `echo "$@" | sed -e 's/\/[^/]*\.o//'`
@echo "- Compiling $@"
@$(C) -g $(CFLAGS) -MD -D ARCH_64BIT -D DEBUG -c -o $@ $<
bin/profile/%.o : src/%.cpp
# Calculate the directory required and create it
@mkdir -pv `echo "$@" | sed -e 's/\/[^/]*\.o//'`
@echo "- Compiling $@"
@$(C) $(CFLAGS) -g -O2 -MD -D ARCH_64BIT -c -o $@ $<
bin/release/%.o : src/%.cpp
# Calculate the directory required and create it
@mkdir -pv `echo "$@" | sed -e 's/\/[^/]*\.o//'`
@echo "- Compiling $@"
@$(C) $(CFLAGS) -O2 -MD -D ARCH_64BIT -c -o $@ $<
SpaceSim/lua/compiled/%.lua : SpaceSim/moon/%.moon
@echo "compiling $< to $@"
@(cd SpaceSim/moon && moonc -t ../../SpaceSim/lua/compiled `echo "$<" | sed -e 's/SpaceSim\/moon\///'`)
tags :
@echo building tags file: vitae.tags
@./tags.sh